Coruja PHP Framework PMD Report
Resume
More than 5.00% of the project's methods have a Change Risk Analysis and Predictions (CRAP) index that is above the threshold of 30.
The CRAP index of a function or method uses cyclomatic complexity and code coverage from automated tests to help estimate the effort and risk associated with maintaining legacy code. A CRAP index over 30 is a good indicator of crappy code.
Totals
There are
213
violations
into
21 classes
and
21 files
Violations
File:
/var/www/coruja/coruja/coruja/components/autoloadGroup/DefaultInterfaceAutoloadGroup.class.php
Class:
DefaultInterfaceAutoloadGroup
/var/www/coruja/coruja/coruja/components/autoloadGroup/DefaultInterfaceAutoloadGroup.class.php
Method:
setDefaultComponentInterfaceFolder
public function setDefaultComponentInterfaceFolder( $strDefaultComponentInterfaceFolder ) { $this->strDefaultComponentInterfaceFolder = $strDefaultComponentInterfaceFolder; } /**
Method:
checkIfClassBelongToGroup
private function checkIfClassBelongToGroup( $strClassName ) { if( !$this->classBelongsToTheGroup( $strClassName ) ) { throw new CorujaAutoLoadGroupException( "Class " . $strClassName . "don't belong to this group" ); } } /**
File:
/var/www/coruja/coruja/coruja/CorujaBegins.class.php
Class:
CorujaBegins
/var/www/coruja/coruja/coruja/CorujaBegins.class.php
Method:
getInstance
public static function getInstance() { if( self::$objInstance == null ) { self::$objInstance = new CorujaBegins(); } return self::$objInstance; } /**
Method:
requireOnce
private static function requireOnce( $strFile ) { require_once( $strFile ); } /**
Method:
setFrameworkFolder
public function setFrameworkFolder( $strFrameworkFolder ) { $this->strFrameworkFolder = (string)$strFrameworkFolder; } /**
Method:
loadXmlPath
public function loadXmlPath() { $strAdminPath = $this->strFrameworkFolder . self::FOLDER_CORUJA_ADMIN; $this->objXmlPath = simplexml_load_file( $strAdminPath . self::XML_PATH_CONFIG ); }
Method:
getPatternFileStart
protected function getPatternFileStart() { return (string)$this->objXmlPath->pattern->start->file; } /**
Method:
getComponentsPath
public function getComponentsPath() { return (string)$this->objXmlPath->components->path; } /**
Method:
getComponentsInterfacePath
public function getComponentsInterfacePath() { return (string)$this->objXmlPath->components->interface->path; } /**
Method:
getComponentsDefaultPath
public function getComponentsDefaultPath() { return (string)$this->objXmlPath->components->default->path; } /**
Method:
getComponentsExtraPath
public function getComponentsExtraPath() { return (string)$this->objXmlPath->components->extra->path; } /**
Method:
getAutoloadPath
protected function getAutoloadPath() { return (string)$this->objXmlPath->components->autoload->path; } /**
Method:
getLibraryPath
protected function getLibraryPath() { return (string)$this->objXmlPath->components->library->path; } /**
Method:
getEnviromentsVarsPath
protected function getEnviromentsVarsPath() { return (string)$this->objXmlPath->components->enviromentvars->path; } /**
Method:
getPublicPath
public function getPublicPath() { return (string)$this->objXmlPath->public->path; } /**
Method:
loadFrameworkExceptions
protected function loadFrameworkExceptions() { self::requireOnce( $this->getFrameworkFolder() . $this->getExceptionFolderPattern() . "/" . $this->getPatternFileStart() ); } /**
Method:
loadFrameworkAutoLoadComponent
protected function loadFrameworkAutoLoadComponent() { $strComponentsExceptionFolder = $this->getFrameworkFolder() . $this->getComponentsPath() . "/" . $this->getExceptionFolderPattern() ; $this->includeDir( $strComponentsExceptionFolder ); self::requireOnce( $this->getFrameworkFolder() . $this->getComponentsInterfacePath() . "/" . $this->getAutoloadPath() . "/" . $this->getPatternFileStart() ); self::requireOnce( $this->getFrameworkFolder() . $this->getComponentsDefaultPath() . "/" . $this->getAutoloadPath() . "/" . $this->getPatternFileStart() ); CorujaAutoLoad::getInstance()->preLoadClassFolder( $this->getFrameworkFolder() . $this->getComponentsPath() . "/" . $this->getAutoloadGroupFolderPattern() ); } /**
Method:
loadDefaultAutoloadGroups
protected function loadDefaultAutoloadGroups() { // autoload group of the default components // $objDefaultComponentAutoLoadGroup = new DefaultComponentAutoloadGroup(); $objDefaultComponentAutoLoadGroup->setDefaultComponentFolder( $this->getFrameworkFolder() . $this->getComponentsDefaultPath() ); CorujaAutoLoad::getInstance()->addAutoLoadGroup( $objDefaultComponentAutoLoadGroup ); // autoload group of the default interfaces // $objDefaultInterfaceAutoloadGroup = new DefaultInterfaceAutoloadGroup(); $objDefaultInterfaceAutoloadGroup->setDefaultComponentInterfaceFolder( $this->getFrameworkFolder() . $this->getComponentsInterfacePath() ); CorujaAutoLoad::getInstance()->addAutoLoadGroup( $objDefaultInterfaceAutoloadGroup ); // autoload group of the extra components // $objExtraComponentAutoLoadGroup = new ExtraComponentAutoloadGroup(); $objExtraComponentAutoLoadGroup->setExtraComponentFolder( $this->getFrameworkFolder() . $this->getComponentsExtraPath() ); CorujaAutoLoad::getInstance()->addAutoLoadGroup( $objExtraComponentAutoLoadGroup ); // preload the library // CorujaAutoLoad::getInstance()->preLoadClassFolder( $this->getFrameworkFolder() . $this->getComponentsDefaultPath() . "/" . $this->getLibraryPath() ); // preload the enviroments vars // CorujaAutoLoad::getInstance()->preLoadClassFolder( $this->getFrameworkFolder() . $this->getComponentsDefaultPath() . "/" . $this->getEnviromentsVarsPath() ); } /**
Method:
__construct
public function __construct() { $this->intMicrotimeBegin = microtime( true ); ini_set( "display_errors", "On" ); error_reporting( E_ALL | E_NOTICE | E_WARNING | E_STRICT ); } /**
Method:
__destruct
public function __destruct() { $this->intMicrotimeEnd = microtime( true ); print "\n<!-- " . ( $this->intMicrotimeEnd - $this->intMicrotimeBegin ) . " seconds -->"; } /**
Method:
perform
public function perform() { $this->loadXmlPath(); $this->loadFrameworkExceptions(); $this->loadFrameworkAutoLoadComponent(); $this->loadDefaultAutoloadGroups(); CorujaComponentsManager::getInstance(); } /**
Method:
includeDir
public function includeDir( $strDirName ) { $objDir = dir( $strDirName ); while( false !== ( $strFile = $objDir->read() ) ) { if( substr( $strFile, -4) == ".php" ) { self::requireOnce( $strDirName . "/" . $strFile ); } } } /**
Method:
begin
public static function begin( $strFrameworkFolder ) { $objCorujaBegins = self::getInstance(); $objCorujaBegins->setFrameworkFolder( $strFrameworkFolder ); $objCorujaBegins->perform(); } public static function getCorujaFolderAdmin()
Method:
getCorujaFolderAdmin
public static function getCorujaFolderAdmin() { return self::getInstance()->getFrameworkFolder() . self::FOLDER_CORUJA_ADMIN; } public static function getCorujaFolderComponentsAdmin()
Method:
getCorujaFolderPublic
public static function getCorujaFolderPublic() { return CorujaFileManipulation::removeRelativeSlicesOfFile( self::getInstance()->getFrameworkFolder() . self::getInstance()->getPublicPath() . "/" ); } public static function getCorujaFolderComponentsDefault()
Method:
getCorujaFolderComponentsDefault
public static function getCorujaFolderComponentsDefault() { return CorujaFileManipulation::removeRelativeSlicesOfFile( self::getInstance()->getFrameworkFolder() . self::getInstance()->getComponentsDefaultPath() . "/" ); } } ?>
File:
/var/www/coruja/coruja/coruja/components/default/autoLoad/CorujaAutoLoad.class.php
Class:
CorujaAutoLoad
/var/www/coruja/coruja/coruja/components/default/autoLoad/CorujaAutoLoad.class.php
Method:
getInstance
public static function getInstance() { if( self::$objCorujaAutoLoad == null ) { self::$objCorujaAutoLoad = new CorujaAutoLoad(); } return self::$objCorujaAutoLoad; } /**
Method:
getFileNameByClass
public static function getFileNameByClass( $strClassName ) { CorujaAutoLoad::getInstance()->loadClass( $strClassName ); $strFileName = CorujaAutoLoad::getInstance()->getFilefromClass( $strClassName ); if( $strFileName == null ) { if( !class_exists( $strClassName ) ) { throw new CorujaAutoLoadException( "Unable to find the file of the class $strClassName " ); } $objReflection = new ReflectionClass( $strClassName ); $strFileName = $objReflection->getFileName(); } return $strFileName; } /**
Method:
addAutoLoadGroupFolder
public function addAutoLoadGroupFolder( $strFolder ) { $strDirName = $strFolder . "/" . $this->getAutoLoadFolderPattern() ; $oDirExceptions = dir( $strDirName ); while( false !== ( $strFile = $oDirExceptions->read() ) ) { if( substr( $strFile, -4) == ".php" ) { require_once( $strDirName . "/" . $strFile ); $strClassName = substr( $strFile , 0 , strpos( $strFile , "." ) ); $objElement = new $strClassName(); if( $objElement instanceof CorujaAutoLoadGroupInterface ) { $this->addAutoLoadGroup( $objElement ) ; } else { throw new CorujaAutoLoadException( "The Class " . $strClassName . " it is not a Coruja Autoload Group Interface" ); } } } } /**
Method:
addAutoLoadGroup
public function addAutoLoadGroup( CorujaAutoLoadGroupInterface $objAutoLoadGroup ) { $this->arrAutoLoadGroups[] = $objAutoLoadGroup; } public function removeAutoLoadGroup( CorujaAutoLoadGroupInterface $objAutoLoadGroup )
Method:
removeAutoLoadGroup
public function removeAutoLoadGroup( CorujaAutoLoadGroupInterface $objAutoLoadGroup ) { foreach( $this->arrAutoLoadGroups as $intKey => $objAutoLoadGroupElement ) { if( $objAutoLoadGroupElement == $objAutoLoadGroup ) { array_splice( $this->arrAutoLoadGroups , $intKey , 1 ); } } } /**
Method:
getFilefromClass
public function getFilefromClass( $strClassName ) { return CorujaArrayManipulation::getArrayField( $this->arrAutoLoadClassFile , $strClassName ); } /**
Method:
loadClass
public function loadClass( $strClassName ) { $strClassName = (string)$strClassName; $arrFilesNames = array(); if( array_key_exists( $strClassName, $this->arrAutoLoadClassFile ) ) { $strFileName = $this->arrAutoLoadClassFile[ $strClassName ]; $arrFilesNames[] = $strFileName; if( $this->tryLoadClass( $strFileName, $strClassName ) ) { return true; } } foreach( $this->arrAutoLoadGroups as $objAutoLoadGroup ) { /** * @var $objAutoLoadGroup CorujaAutoLoadGroupInterface */ if( $objAutoLoadGroup->classBelongsToTheGroup( $strClassName ) ) { $strFileName = $objAutoLoadGroup->getTheFileNameOfTheClass( $strClassName ); $arrFilesNames[] = $strFileName; if( $this->tryLoadClass( $strFileName, $strClassName ) ) { $objAutoLoadGroup->onLoadClass( $strClassName ); return true; } } } if( !class_exists( $strClassName , false ) && !interface_exists( $strClassName , false ) ) { if( strlen( $strClassName ) == 0 ) { throw new Exception( "Invalid Autoload Request, Empty class Name"); } $strLowerClass = strtolower( $strClassName ); if( ! in_array( $strLowerClass[0] , array( 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' , 'h' , 'i' , 'j' , 'k' , 'l' , 'm' , 'n' , 'o' , 'p' , 'q' , 'r' , 's' , 't' , 'v' , 'v' , 'x' , 'y' , 'w' , 'z' ) ) ) { throw new Exception( "Invalid Class Name $strClassName!"); } try { $strClassNotFounded = 'class ' . $strClassName . ' extends CorujaNotFoundedClass { protected static $strClassName = "' . $strClassName . '"; } '; eval( $strClassNotFounded ); } catch( Exception $objError ) { // nothing // } throw new Exception( " Unabled to find the file of the class " . $strClassName . ". File exists into: " . implode( "\n" , $arrFilesNames ) . " ? "); } } /**
Method:
preLoadClassFile
public function preLoadClassFile( $strClassName, $strFileName ) { $this->arrAutoLoadClassFile[ $strClassName ] = $strFileName; } /**
Method:
preLoadClassFolder
public function preLoadClassFolder( $strClassFolder ) { $oDirExceptions = dir( $strClassFolder ); while( false !== ( $strFileName = $oDirExceptions->read() ) ) { if( substr( $strFileName, -4) == ".php" ) { $strClassName = substr( $strFileName , 0 , strpos( $strFileName , "." ) ); $this->preLoadClassFile( $strClassName , $strClassFolder . "/" . $strFileName); } } } public function classExists( $strClassName )
Method:
classExists
public function classExists( $strClassName ) { if( in_array( $strClassName , array( "integer" , "string" , "number" , "float" ) ) ) { return false; } try { $this->loadClass( $strClassName ); } catch( Exception $objException ) { return false; } if( get_parent_class( $strClassName ) == 'CorujaNotFoundedClass' ) { return false; } else
File:
/var/www/coruja/coruja/coruja/components/autoloadGroup/DefaultComponentAutoloadGroup.class.php
Class:
DefaultComponentAutoloadGroup
/var/www/coruja/coruja/coruja/components/autoloadGroup/DefaultComponentAutoloadGroup.class.php
Method:
setDefaultComponentFolder
public function setDefaultComponentFolder( $strComponentFolder ) { $this->strDefaultComponentFolder = $strComponentFolder; } /**
Method:
classBelongsToTheGroup
public function classBelongsToTheGroup( $strClassName ) { if( self::DEFAULT_COMPONENT_PREFIX != "" ) { if ( strpos( $strClassName , self::DEFAULT_COMPONENT_PREFIX ) != 0 ) { return false; } } if( self::DEFAULT_COMPONENT_SUFIX != "" ) { if ( strpos( $strClassName , self::DEFAULT_COMPONENT_SUFIX ) != 0 ) { return false; } } return true; } /**
Method:
checkIfClassBelongToGroup
private function checkIfClassBelongToGroup( $strClassName ) { if( !$this->classBelongsToTheGroup( $strClassName ) ) { throw new CorujaAutoLoadGroupException( "Class " . $strClassName . "don't belong to this group" ); } } /**
Method:
onLoadClass
public function onLoadClass( $strClassName ) { $strFolderName = $this->getTheFolderName( $strClassName ); $this->loadFolder( $strFolderName , $strClassName ); $strExceptionFolder = $strFolderName . "/" . CorujaBegins::getInstance()->getExceptionFolderPattern() . "/"; if( is_dir( $strExceptionFolder ) ) { $this->loadFolder( $strExceptionFolder , $strClassName ); } $strAutoloadFolder = $strFolderName . "/" . CorujaBegins::getInstance()->getAutoloadGroupFolderPattern() . "/"; if( is_dir( $strAutoloadFolder ) ) { $this->loadFolder( $strAutoloadFolder , $strClassName ); } } /**
File:
/var/www/coruja/coruja/coruja/components/default/componentsManager/CorujaComponentsManager.class.php
Class:
CorujaComponentsManager
/var/www/coruja/coruja/coruja/components/default/componentsManager/CorujaComponentsManager.class.php
Method:
Priority:
0
Rule:
ExcessivePublicCount
class CorujaComponentsManager implements CorujaComponentsManagerInterface { /** * Singleton of the class * @var CorujaComponentsManager */ protected static $objInstance; /** * * @var CorujaTree */ protected $objConfiguration; /** * Error Component * * @var CorujaErrorInterface */ protected $objErrorComponent; /** * Check if the Error Component already as load, or try to load * * @var boolean */ protected $booErrorLoaded = false; /** * Log Component * * @var CorujaLogInterface */ protected $objLogComponent; /** * Check if the Log Component already as load, or try to load * * @var boolean */ protected $booLogLoaded = false; /** * Cache Component * * @var CorujaCacheInterface */ protected $objCacheComponent; /** * Check if the Cache Component already as load, or try to load * * @var boolean */ protected $booCacheLoaded = false; /** * Xml 2 Php Component * * @var CorujaXml2PhpInterface */ protected $objXml2PhpComponent; /** * Check if the Xml2Php Component already as load, or try to load * * @var boolean */ protected $booXml2PhpLoaded = false; /** * Authentication Component * * @var CorujaAuthenticationInterface */ protected $objAuthenticationComponent; /** * Check if the Authentication Component already as load, or try to load * * @var boolean */ protected $booAuthenticationLoaded = false; /** * Permission Component * * @var CorujaPermissionInterface */ protected $objPermissionComponent; /** * Check if the Permission Component already as load, or try to load * * @var boolean */ protected $booPermissionLoaded = false; /** * Profile Component * * @var CorujaProfileInterface */ protected $objProfileComponent; /** * Check if the Profile Component already as load, or try to load * * @var boolean */ protected $booProfileLoaded = false; /** * Annotation Component * * @var CorujaAnnotationInterface */ protected $objAnnotationComponent; /** * Check if the Annotation Component already as load, or try to load * * @var boolean */ protected $booAnnotationLoaded = false; /** * Exception Handler Component * * @var Component */ protected $objExceptionHandlerComponent; /** * Check if the Exception Component already as load, or try to load * * @var boolean */ protected $booExceptionLoaded = false; /** * Backtrace Component * * @var CorujaBacktraceInterface */ protected $objBacktraceComponent; /** * Check if the Backtrace Component already as load, or try to load * * @var boolean */ protected $booBacktraceLoaded = false; /** * Backtrace Explain Component * * @var CorujaBackTraceExplainInterface */ protected $objBacktraceExplainComponent; /** * Check if the Backtrace Explain Component already as load, or try to load * * @var boolean */ protected $booBacktraceExplainLoaded = false; /** * Session Component * * @var CorujaSessionInterface */ protected $objSessionComponent; /** * Check if the Session Component already as load, or try to load * * @var boolean */ protected $booSessionLoaded = false; /** * Template Component * * @var CorujaTemplateInterface */ protected $objTemplateComponent; /** * Check if the Template Component already as load, or try to load * * @var boolean */ protected $booTemplateLoaded = false; /** * Database Component * * @var CorujaDatabaseInterface */ protected $objDatabaseComponent; /** * Check if the Database Component already as load, or try to load * * @var boolean */ protected $booDatabaseLoaded = false; /** * Query Filter Component * * @var CorujaQueryFilterInterface */ protected $objQueryFilterComponent; /** * Check if the Query Filter Component already as load, or try to load * * @var boolean */ protected $booQueryFilterLoaded = false; /** * Coruja Request Component * * @var CorujaRequestInterface */ protected $objRequestComponent; /** * Check if the Request Component already as load, or try to load * * @var boolean */ protected $booRequestLoaded = false; /** * Coruja Layer Component * * @var CorujaLayers */ protected $objLayersComponent; /** * Check if the Layers Component already as load, or try to load * * @var boolean */ protected $booLayersLoaded = false; /** * * @return CorujaComponentsManager */ public static function getInstance() { if( self::$objInstance === null ) { self::$objInstance = new CorujaComponentsManager(); } return self::$objInstance; } public function loadConfiguration() { return CorujaComponentsManagerConfig::load(); } public function __construct() { $this->objConfiguration = $this->loadConfiguration(); $arrChildNodes = $this->objConfiguration->getChildNodes(); foreach( $arrChildNodes as $objChildNode ) { /** * @var $objChildNode CorujaTree */ if( !$objChildNode->isTextNode() && $objChildNode->autostart == "true") { $this->loadComponent( $objChildNode ); } } } /** * Load a component by its name * * @param string $strComponentName */ protected function loadComponentByName( $strComponentName ) { if( $this->objConfiguration->hasChildNode( $strComponentName ) ) { $strMethod = "get" . ucfirst( strtolower( $strComponentName ) ); $objChildNode = $this->objConfiguration->$strMethod(); $this->loadComponent( $objChildNode ); } } /** * Load a component by its configuration coruja tree * * @param CorujaTree $objChildNode */ protected function loadComponent( CorujaTree $objChildNode ) { $strTagName = ( $objChildNode->getNodeName() ); $strComponentName = ( $objChildNode->componentname ); $strMethodName = "set" . ucfirst( strtolower( $strTagName ) ) . "Component"; if( !method_exists($this, $strMethodName ) ) { throw new CorujaComponentManagerException( "Invalid component element " . $strMethodName , " to the component mananger " ); } if( !class_exists( $strComponentName ) ) { throw new CorujaComponentManagerException( "Invalid component class " . $strComponentName , " to the component mananger " ); } $objElement = new $strComponentName(); $this->$strMethodName( $objElement ); } /** * Try, to load the error component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadErrorComponent() { if( $this->objErrorComponent == null && $this->booErrorLoaded == false ) { $this->booErrorLoaded = true; $this->loadComponentByName( "Error" ); } } /** * Set the Error Component * * @param CorujaErrorInterface $objErrorComponent */ public function setErrorComponent( CorujaErrorInterface $objErrorComponent ) { $this->objErrorComponent = $objErrorComponent; } /** * Return a Error Component * * @return CorujaErrorInterface */ public function getErrorComponent() { $this->loadErrorComponent(); if( $this->objErrorComponent == null ) { throw new CorujaException( "No Error Component was defined. Without it you can not use Error resources." ); } return $this->objErrorComponent; } /** * Has a Error component * * @return boolean */ public function hasErrorComponent() { $this->loadErrorComponent(); return ( $this->objErrorComponent !== null ); } /** * Try, to load the Log component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadLogComponent() { if( $this->objLogComponent == null && $this->booLogLoaded == false ) { $this->booLogLoaded = true; $this->loadComponentByName( "Log" ); } } /** * Set the Log Component * * @param CorujaLogInterface $objLogComponent */ public function setLogComponent( CorujaLogInterface $objLogComponent ) { $this->objLogComponent = $objLogComponent; } /** * Return a Log Component * * @return CorujaLogInterface */ public function getLogComponent() { $this->loadLogComponent(); if( $this->objLogComponent == null ) { throw new CorujaException( "No Log Component was defined. Without it you can not use Log resources." ); } return $this->objLogComponent; } /** * Has Log Component Component * * @return boolean */ public function hasLogComponent() { $this->loadLogComponent(); return ( $this->objLogComponent !== null ); } /** * Try, to load the Cache component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadCacheComponent() { if( $this->objCacheComponent == null && $this->booCacheLoaded == false ) { $this->booCacheLoaded = true; $this->loadComponentByName( "Cache" ); } } /** * Set the Cache Component * * @param CorujaCacheInterface $objCacheComponent */ public function setCacheComponent( CorujaCacheInterface $objCacheComponent ) { $this->objCacheComponent = $objCacheComponent; } /** * Get The Cache Component * * @return CorujaCacheInterface */ public function getCacheComponent() { $this->loadCacheComponent(); if( $this->objCacheComponent == null ) { throw new CorujaException( "No Template Cache Component was defined. Without it you can not use Cache resources." ); } return $this->objCacheComponent; } /** * Has Cache Component * * @return boolean */ public function hasCacheComponent() { $this->loadCacheComponent(); return ( $this->objCacheComponent !== null ); } /** * Try, to load the Xml2Php component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadXml2PhpComponent() { if( $this->objXml2PhpComponent == null && $this->booXml2PhpLoaded == false ) { $this->booXml2PhpLoaded = true; $this->loadComponentByName( "Xml2Php" ); } } /** * Set the Template Xml To Script Component * * @param CorujaXml2PhpInterface $objXml2PhpComponent */ public function setXml2PhpComponent( CorujaXml2PhpInterface $objXml2PhpComponent ) { $this->objXml2PhpComponent = $objXml2PhpComponent; } /** * Get The Template Xml To Script Component * * @return CorujaXml2PhpInterface */ public function getXml2PhpComponent() { $this->loadXml2PhpComponent(); if( $this->objXml2PhpComponent == null ) { throw new CorujaException( "No Component Conversor of Template Xml to Script was defined. Without it you can not use Xml to Script resources." ); } return $this->objXml2PhpComponent; } /** * Has Template Xml To Script Component * * @return boolean */ public function hasXml2PhpComponent() { $this->loadXml2PhpComponent(); return ( $this->objXml2PhpComponent !== null ); } /** * Try, to load the Request component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadRequestComponent() { if( $this->objRequestComponent == null && $this->booRequestLoaded == false ) { $this->booRequestLoaded = true; $this->loadComponentByName( "Request" ); } } /** * Set the Request Component * * @param CorujaRequestInterface $objRequestComponent */ public function setRequestComponent( CorujaRequestInterface $objRequestComponent ) { $this->objRequestComponent = $objRequestComponent; } /** * Get The Request Component * * @return CorujaRequestInterface */ public function getRequestComponent() { $this->loadRequestComponent(); if( $this->objRequestComponent == null ) { throw new CorujaException( "No Request Component was defined. Without it you can not use Request resources." ); } return $this->objRequestComponent; } /** * Has Request Component * * @return boolean */ public function hasRequestComponent() { $this->loadRequestComponent(); return ( $this->objRequestComponent !== null ); } /** * Try, to load the Request component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadTemplateComponent() { if( $this->objTemplateComponent == null && $this->booTemplateLoaded == false ) { $this->booTemplateLoaded = true; $this->loadComponentByName( "Template" ); } } /** * Set the Template Component * * @param CorujaTemplateInterface $objTemplateComponent */ public function setTemplateComponent( $objTemplateComponent ) { $this->objTemplateComponent = $objTemplateComponent; } /** * Get The Template Component * * @return CorujaTemplateInterface */ public function getTemplateComponent() { $this->loadTemplateComponent(); if( $this->objTemplateComponent == null ) { throw new CorujaException( "No Template Component was defined. Without it you can not use Template resources." ); } return $this->objTemplateComponent; } /** * Has Template Component * * @return boolean */ public function hasTemplateComponent() { $this->loadTemplateComponent(); return ( $this->objTemplateComponent !== null ); } /** * Try, to load the Layers component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadLayersComponent() { if( $this->objLayersComponent == null && $this->booLayersLoaded == false ) { $this->booLayersLoaded = true; $this->loadComponentByName( "Layers" ); } } /** * Set the Layers Component * * @param CorujaLayersInterface $objLayersComponent */ public function setLayersComponent( $objLayersComponent ) { $this->objLayersComponent = $objLayersComponent; } /** * Get The Layers Component * * @return CorujaLayersInterface */ public function getLayersComponent() { $this->loadLayersComponent(); if( $this->objLayersComponent == null ) { throw new CorujaException( "No Layers Component was defined. Without it you can not use Layers resources." ); } return $this->objLayersComponent; } /** * Has Layers Component * * @return boolean */ public function hasLayersComponent() { $this->loadLayersComponent(); return ( $this->objLayersComponent !== null ); } /** * Try, to load the Authentication component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadAuthenticationComponent() { if( $this->objAuthenticationComponent == null && $this->booAuthenticationLoaded == false ) { $this->booAuthenticationLoaded = true; $this->loadComponentByName( "Authentication" ); } } /** * Set The Authentication Component * * @param CorujaAuthenticationInterface $objAuthenticationComponent */ public function setAuthenticationComponent( CorujaAuthenticationInterface $objAuthenticationComponent ) { $this->objAuthenticationComponent = $objAuthenticationComponent; } /** * Get the Authentication Component * * @return CorujaAuthenticationInterface */ public function getAuthenticationComponent() { $this->loadAuthenticationComponent(); if( $this->objAuthenticationComponent == null ) { throw new CorujaException( "No Authentication Component was defined. Without it you cannot use Authentication resources." ); } return $this->objAuthenticationComponent; } /** * Has Authentication Component * * @return boolean */ public function hasAuthenticationComponent() { $this->loadAuthenticationComponent(); return ( $this->objAuthenticationComponent !== null ); } /** * Try, to load the Permission component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadPermissionComponent() { if( $this->objPermissionComponent == null && $this->booPermissionLoaded == false ) { $this->booPermissionLoaded = true; $this->loadComponentByName( "Permission" ); } } /** * Set The Permission Component * * @param CorujaPermissionInterface $objPermissionComponent */ public function setPermissionComponent( CorujaPermissionInterface $objPermissionComponent ) { $this->objPermissionComponent = $objPermissionComponent; } /** * Get the Permission Component * * @return CorujaPermissionInterface */ public function getPermissionComponent() { $this->loadPermissionComponent(); if( $this->objPermissionComponent == null ) { throw new CorujaException( "No Permission Component was defined. Without it you cannot use Permission resources." ); } return $this->objPermissionComponent; } /** * Has Permission Component * * @return boolean */ public function hasPermissionComponent() { $this->loadPermissionComponent(); return ( $this->objPermissionComponent !== null ); } /** * Try, to load the Profile component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadProfileComponent() { if( $this->objProfileComponent == null && $this->booProfileLoaded == false ) { $this->booProfileLoaded = true; $this->loadComponentByName( "Profile" ); } } /** * Set The Profile Component * * @param CorujaProfileInterface $objProfileComponent */ public function setProfileComponent( CorujaProfileInterface $objProfileComponent ) { $this->objProfileComponent = $objProfileComponent; } /** * Get the Profile Component * * @return CorujaProfileInterface */ public function getProfileComponent() { $this->loadProfileComponent(); if( $this->objProfileComponent == null ) { throw new CorujaException( "No Profile Component was defined. Without it you cannot use Profile resources." ); } return $this->objProfileComponent; } /** * Has Profile Component * * @return boolean */ public function hasProfileComponent() { $this->loadProfileComponent(); return ( $this->objProfileComponent !== null ); } /** * Try, to load the Annotation component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadAnnotationComponent() { if( $this->objAnnotationComponent == null && $this->booAnnotationLoaded == false ) { $this->booAnnotationLoaded = true; $this->loadComponentByName( "Annotation" ); } } /** * Set The Annotation Component * * @param CorujaAnnotationInterface $objAnnotationComponent */ public function setAnnotationComponent( CorujaAnnotationInterface $objAnnotationComponent ) { $this->objAnnotationComponent = $objAnnotationComponent; } /** * Get the Annotation Component * * @return CorujaAnnotationInterface */ public function getAnnotationComponent() { $this->loadAnnotationComponent(); if( $this->objAnnotationComponent == null ) { throw new CorujaException( "No Annotation Component was defined. Without it you cannot use Annotation resources." ); } return $this->objAnnotationComponent; } /** * Has Annotation Component * * @return boolean */ public function hasAnnotationComponent() { $this->loadAnnotationComponent(); return ( $this->objAnnotationComponent !== null ); } /** * Try, to load the Exception Handler component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadExceptionHandlerComponent() { if( $this->objExceptionHandlerComponent == null && $this->booExceptionHandlerLoaded == false ) { $this->booExceptionHandlerLoaded = true; $this->loadComponentByName( "ExceptionHandler" ); } } /** * Set The Exception Handler Component * * @param CorujaExceptionHandlerInterface $objExceptionHandlerComponent */ public function setExceptionHandlerComponent( CorujaExceptionHandlerInterface $objExceptionHandlerComponent ) { $this->objExceptionHandlerComponent = $objExceptionHandlerComponent; $arrExceptionCaller = array( $this->objExceptionHandlerComponent, "handle" ); set_exception_handler( $arrExceptionCaller ); } /** * Get the Exception Handler Component * * @return CorujaExceptionHandlerInterface */ public function getExceptionHandlerComponent() { $this->loadExceptionHandlerComponent(); if( $this->objExceptionHandlerComponent == null ) { throw new CorujaException( "No Exception Handler Component was defined. Without it you cannot use Exception Handler resources." ); } return $this->objExceptionHandlerComponent; } /** * Has Exception Handler Component * * @return boolean */ public function hasExceptionHandlerComponent() { $this->loadExceptionHandlerComponent(); return ( $this->objExceptionHandlerComponent !== null ); } /** * Try, to load the Backtrace component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadBacktraceComponent() { if( $this->objBacktraceComponent == null && $this->booBacktraceLoaded == false ) { $this->booBacktraceLoaded = true; $this->loadComponentByName( "Backtrace" ); } } /** * Set The Backtrace Component * * @param CorujaBackTraceInterface $objBackTraceComponent */ public function setBacktraceComponent( CorujaBackTraceInterface $objBackTraceComponent ) { $this->objBacktraceComponent = $objBackTraceComponent; } /** * Get the Backtrace Component * * @return CorujaBackTraceInterface */ public function getBacktraceComponent() { $this->loadBacktraceComponent(); if( $this->objBacktraceComponent == null ) { throw new CorujaException( "No Backtrace Component was defined. Without it you cannot use Backtrace resources." ); } return $this->objBacktraceComponent; } /** * Has Backtrace Component * * @return boolean */ public function hasBacktraceComponent() { $this->loadBacktraceComponent(); return ( $this->objBacktraceComponent !== null ); } /** * Try, to load the Backtrace Explain component into the configurations in case of it * don't be auto started. This attempt will be execute just one time by * execution. */ public function loadBacktraceExplainComponent() { if( $this->objBacktraceExplainComponent == null && $this->booBacktraceExplainLoaded == false ) { $this->booBacktraceExplainLoaded = true; $this->loadComponentByName( "BacktraceExplain" ); } } /** * Set The Backtrace Component * * @param CorujaBackTraceExplainInterface $objBackTraceExplainComponent */ public function setBacktraceExplainComponent( CorujaBackTraceExplainInterface $objBackTraceExplainComponent ) { $this->objBackTraceExplainComponent = $objBackTraceExplainComponent; } /** * Get the Backtrace Explain Component * * @return CorujaBackTraceExplainInterface */ public function getBacktraceExplainComponent() { $this->loadBacktraceExplainComponent(); if( $this->objBackTraceExplainComponent == null ) { throw new CorujaException( "No Backtrace Explain Component was defined. Without it you cannot use Backtrace Explain resources." ); } return $this->objBackTraceExplainComponent; } /** * Has Backtrace Explain Component * * @return boolean */ public function hasBacktraceExplainComponent() { $this->loadBacktraceExplainComponent(); return ( $this->objBacktraceExplainComponent !== null ); } } ?>
Method:
getInstance
public static function getInstance() { if( self::$objInstance === null ) { self::$objInstance = new CorujaComponentsManager(); } return self::$objInstance; } public function loadConfiguration()
Method:
loadConfiguration
public function loadConfiguration() { return CorujaComponentsManagerConfig::load(); } public function __construct()
Method:
__construct
public function __construct() { $this->objConfiguration = $this->loadConfiguration(); $arrChildNodes = $this->objConfiguration->getChildNodes(); foreach( $arrChildNodes as $objChildNode ) { /** * @var $objChildNode CorujaTree */ if( !$objChildNode->isTextNode() && $objChildNode->autostart == "true") { $this->loadComponent( $objChildNode ); } } } /**
Method:
loadErrorComponent
public function loadErrorComponent() { if( $this->objErrorComponent == null && $this->booErrorLoaded == false ) { $this->booErrorLoaded = true; $this->loadComponentByName( "Error" ); } } /**
Method:
setErrorComponent
public function setErrorComponent( CorujaErrorInterface $objErrorComponent ) { $this->objErrorComponent = $objErrorComponent; } /**
Method:
hasErrorComponent
public function hasErrorComponent() { $this->loadErrorComponent(); return ( $this->objErrorComponent !== null ); } /**
Method:
loadCacheComponent
public function loadCacheComponent() { if( $this->objCacheComponent == null && $this->booCacheLoaded == false ) { $this->booCacheLoaded = true; $this->loadComponentByName( "Cache" ); } } /**
Method:
setCacheComponent
public function setCacheComponent( CorujaCacheInterface $objCacheComponent ) { $this->objCacheComponent = $objCacheComponent; } /**
Method:
getCacheComponent
public function getCacheComponent() { $this->loadCacheComponent(); if( $this->objCacheComponent == null ) { throw new CorujaException( "No Template Cache Component was defined. Without it you can not use Cache resources." ); } return $this->objCacheComponent; } /**
Method:
hasCacheComponent
public function hasCacheComponent() { $this->loadCacheComponent(); return ( $this->objCacheComponent !== null ); } /**
Method:
loadXml2PhpComponent
public function loadXml2PhpComponent() { if( $this->objXml2PhpComponent == null && $this->booXml2PhpLoaded == false ) { $this->booXml2PhpLoaded = true; $this->loadComponentByName( "Xml2Php" ); } } /**
Method:
setXml2PhpComponent
public function setXml2PhpComponent( CorujaXml2PhpInterface $objXml2PhpComponent ) { $this->objXml2PhpComponent = $objXml2PhpComponent; } /**
Method:
getXml2PhpComponent
public function getXml2PhpComponent() { $this->loadXml2PhpComponent(); if( $this->objXml2PhpComponent == null ) { throw new CorujaException( "No Component Conversor of Template Xml to Script was defined. Without it you can not use Xml to Script resources." ); } return $this->objXml2PhpComponent; } /**
Method:
hasXml2PhpComponent
public function hasXml2PhpComponent() { $this->loadXml2PhpComponent(); return ( $this->objXml2PhpComponent !== null ); } /**
Method:
loadRequestComponent
public function loadRequestComponent() { if( $this->objRequestComponent == null && $this->booRequestLoaded == false ) { $this->booRequestLoaded = true; $this->loadComponentByName( "Request" ); } } /**
Method:
setRequestComponent
public function setRequestComponent( CorujaRequestInterface $objRequestComponent ) { $this->objRequestComponent = $objRequestComponent; } /**
Method:
getRequestComponent
public function getRequestComponent() { $this->loadRequestComponent(); if( $this->objRequestComponent == null ) { throw new CorujaException( "No Request Component was defined. Without it you can not use Request resources." ); } return $this->objRequestComponent; } /**
Method:
hasRequestComponent
public function hasRequestComponent() { $this->loadRequestComponent(); return ( $this->objRequestComponent !== null ); } /**
Method:
loadTemplateComponent
public function loadTemplateComponent() { if( $this->objTemplateComponent == null && $this->booTemplateLoaded == false ) { $this->booTemplateLoaded = true; $this->loadComponentByName( "Template" ); } } /**
Method:
setTemplateComponent
public function setTemplateComponent( $objTemplateComponent ) { $this->objTemplateComponent = $objTemplateComponent; } /**
Method:
getTemplateComponent
public function getTemplateComponent() { $this->loadTemplateComponent(); if( $this->objTemplateComponent == null ) { throw new CorujaException( "No Template Component was defined. Without it you can not use Template resources." ); } return $this->objTemplateComponent; } /**
Method:
hasTemplateComponent
public function hasTemplateComponent() { $this->loadTemplateComponent(); return ( $this->objTemplateComponent !== null ); } /**
Method:
loadLayersComponent
public function loadLayersComponent() { if( $this->objLayersComponent == null && $this->booLayersLoaded == false ) { $this->booLayersLoaded = true; $this->loadComponentByName( "Layers" ); } } /**
Method:
setLayersComponent
public function setLayersComponent( $objLayersComponent ) { $this->objLayersComponent = $objLayersComponent; } /**
Method:
getLayersComponent
public function getLayersComponent() { $this->loadLayersComponent(); if( $this->objLayersComponent == null ) { throw new CorujaException( "No Layers Component was defined. Without it you can not use Layers resources." ); } return $this->objLayersComponent; } /**
Method:
hasLayersComponent
public function hasLayersComponent() { $this->loadLayersComponent(); return ( $this->objLayersComponent !== null ); } /**
Method:
loadAuthenticationComponent
public function loadAuthenticationComponent() { if( $this->objAuthenticationComponent == null && $this->booAuthenticationLoaded == false ) { $this->booAuthenticationLoaded = true; $this->loadComponentByName( "Authentication" ); } } /**
Method:
setAuthenticationComponent
public function setAuthenticationComponent( CorujaAuthenticationInterface $objAuthenticationComponent ) { $this->objAuthenticationComponent = $objAuthenticationComponent; } /**
Method:
getAuthenticationComponent
public function getAuthenticationComponent() { $this->loadAuthenticationComponent(); if( $this->objAuthenticationComponent == null ) { throw new CorujaException( "No Authentication Component was defined. Without it you cannot use Authentication resources." ); } return $this->objAuthenticationComponent; } /**
Method:
hasAuthenticationComponent
public function hasAuthenticationComponent() { $this->loadAuthenticationComponent(); return ( $this->objAuthenticationComponent !== null ); } /**
Method:
loadPermissionComponent
public function loadPermissionComponent() { if( $this->objPermissionComponent == null && $this->booPermissionLoaded == false ) { $this->booPermissionLoaded = true; $this->loadComponentByName( "Permission" ); } } /**
Method:
setPermissionComponent
public function setPermissionComponent( CorujaPermissionInterface $objPermissionComponent ) { $this->objPermissionComponent = $objPermissionComponent; } /**
Method:
getPermissionComponent
public function getPermissionComponent() { $this->loadPermissionComponent(); if( $this->objPermissionComponent == null ) { throw new CorujaException( "No Permission Component was defined. Without it you cannot use Permission resources." ); } return $this->objPermissionComponent; } /**
Method:
hasPermissionComponent
public function hasPermissionComponent() { $this->loadPermissionComponent(); return ( $this->objPermissionComponent !== null ); } /**
Method:
loadProfileComponent
public function loadProfileComponent() { if( $this->objProfileComponent == null && $this->booProfileLoaded == false ) { $this->booProfileLoaded = true; $this->loadComponentByName( "Profile" ); } } /**
Method:
setProfileComponent
public function setProfileComponent( CorujaProfileInterface $objProfileComponent ) { $this->objProfileComponent = $objProfileComponent; } /**
Method:
getProfileComponent
public function getProfileComponent() { $this->loadProfileComponent(); if( $this->objProfileComponent == null ) { throw new CorujaException( "No Profile Component was defined. Without it you cannot use Profile resources." ); } return $this->objProfileComponent; } /**
Method:
hasProfileComponent
public function hasProfileComponent() { $this->loadProfileComponent(); return ( $this->objProfileComponent !== null ); } /**
Method:
loadAnnotationComponent
public function loadAnnotationComponent() { if( $this->objAnnotationComponent == null && $this->booAnnotationLoaded == false ) { $this->booAnnotationLoaded = true; $this->loadComponentByName( "Annotation" ); } } /**
Method:
setAnnotationComponent
public function setAnnotationComponent( CorujaAnnotationInterface $objAnnotationComponent ) { $this->objAnnotationComponent = $objAnnotationComponent; } /**
Method:
getAnnotationComponent
public function getAnnotationComponent() { $this->loadAnnotationComponent(); if( $this->objAnnotationComponent == null ) { throw new CorujaException( "No Annotation Component was defined. Without it you cannot use Annotation resources." ); } return $this->objAnnotationComponent; } /**
Method:
hasAnnotationComponent
public function hasAnnotationComponent() { $this->loadAnnotationComponent(); return ( $this->objAnnotationComponent !== null ); } /**
Method:
loadExceptionHandlerComponent
public function loadExceptionHandlerComponent() { if( $this->objExceptionHandlerComponent == null && $this->booExceptionHandlerLoaded == false ) { $this->booExceptionHandlerLoaded = true; $this->loadComponentByName( "ExceptionHandler" ); } } /**
Method:
setExceptionHandlerComponent
public function setExceptionHandlerComponent( CorujaExceptionHandlerInterface $objExceptionHandlerComponent ) { $this->objExceptionHandlerComponent = $objExceptionHandlerComponent; $arrExceptionCaller = array( $this->objExceptionHandlerComponent, "handle" ); set_exception_handler( $arrExceptionCaller ); } /**
Method:
getExceptionHandlerComponent
public function getExceptionHandlerComponent() { $this->loadExceptionHandlerComponent(); if( $this->objExceptionHandlerComponent == null ) { throw new CorujaException( "No Exception Handler Component was defined. Without it you cannot use Exception Handler resources." ); } return $this->objExceptionHandlerComponent; } /**
Method:
hasExceptionHandlerComponent
public function hasExceptionHandlerComponent() { $this->loadExceptionHandlerComponent(); return ( $this->objExceptionHandlerComponent !== null ); } /**
Method:
loadBacktraceComponent
public function loadBacktraceComponent() { if( $this->objBacktraceComponent == null && $this->booBacktraceLoaded == false ) { $this->booBacktraceLoaded = true; $this->loadComponentByName( "Backtrace" ); } } /**
Method:
setBacktraceComponent
public function setBacktraceComponent( CorujaBackTraceInterface $objBackTraceComponent ) { $this->objBacktraceComponent = $objBackTraceComponent; } /**
Method:
getBacktraceComponent
public function getBacktraceComponent() { $this->loadBacktraceComponent(); if( $this->objBacktraceComponent == null ) { throw new CorujaException( "No Backtrace Component was defined. Without it you cannot use Backtrace resources." ); } return $this->objBacktraceComponent; } /**
Method:
hasBacktraceComponent
public function hasBacktraceComponent() { $this->loadBacktraceComponent(); return ( $this->objBacktraceComponent !== null ); } /**
Method:
loadBacktraceExplainComponent
public function loadBacktraceExplainComponent() { if( $this->objBacktraceExplainComponent == null && $this->booBacktraceExplainLoaded == false ) { $this->booBacktraceExplainLoaded = true; $this->loadComponentByName( "BacktraceExplain" ); } } /**
Method:
setBacktraceExplainComponent
public function setBacktraceExplainComponent( CorujaBackTraceExplainInterface $objBackTraceExplainComponent ) { $this->objBackTraceExplainComponent = $objBackTraceExplainComponent; } /**
Method:
getBacktraceExplainComponent
public function getBacktraceExplainComponent() { $this->loadBacktraceExplainComponent(); if( $this->objBackTraceExplainComponent == null ) { throw new CorujaException( "No Backtrace Explain Component was defined. Without it you cannot use Backtrace Explain resources." ); } return $this->objBackTraceExplainComponent; } /**
Method:
hasBacktraceExplainComponent
public function hasBacktraceExplainComponent() { $this->loadBacktraceExplainComponent(); return ( $this->objBacktraceExplainComponent !== null ); } } ?>
File:
/var/www/coruja/coruja/coruja/components/default/tree/CorujaTree.class.php
Class:
CorujaTree
/var/www/coruja/coruja/coruja/components/default/tree/CorujaTree.class.php
Method:
removeFromPosition
}
/**
* Remove element from it's parent node child list
*
* @assert()->getParentNode()->getPosition == -1
*/
Method:
removeElementChild
* $objCorujaTree = CorujaTree::loadString( "<parent><a/><b/><c/></parent>" ); * $objCorujaTree->removeElementChild(0); * $objCorujaTree == CorujaTree::loadString( "<parent><b/><c/></parent>" ); * </code> * @param integer $intPosition * @assert( 0 ) throws CorujaTreeException */ public function removeElementChild( $intPosition ) { if( $intPosition < sizeof( $this->arrChilds ) ) { array_splice( $this->arrChilds , $intPosition , 1 ); } else {
Method:
remove
return $this; } /** * Remove the element from it's tree */ public function remove() { $arrChilds = $this->getParentNode()->getChildNodes(); foreach( $arrChilds as $intPos => $objChild ) { if( $objChild === $this ) {
Method:
getBrothersNodes
* foreach( $objChild->getBrothersNodes() as $objBrother )
* {
* print $objBrother->c . " "; // 1 2 3 //
* }
* </code>
* @return CorujaTree[]
*/
public function getBrothersNodes()
{
$arrBrothers = $this->arrBrotherNodes;
$arrBrothers[] = $this;
$arrChilds = $this->getParentNode()->getChildNodes();
$arrReturn = array();
foreach( $arrChilds as $objChild )
{
foreach( $arrBrothers as $objBrother )
{
if( $objBrother === $objChild )
{
$arrReturn[] = $objChild;
Method:
asXml
/** * returns the xml of the coruja tree * * @param integer $intDepper * @return string * @assert() == "<node/>" */ public function asXml( $intDepper = 0 ) { if( $this->isTextNode() ) { //return str_repeat( "\t", $intDepper ) . $this->getTextContent(); return CorujaStringManipulation::XMLEntities( $this->getTextContent() ); } $arrLines = array(); $arrChilds = array(); if( $this->getNodeName() == "#comment" ) { $strOpenTag = str_repeat( "\t", $intDepper ) . "<!-- "; $strCloseTag = "-->"; } else { $strOpenTag = str_repeat( "\t", $intDepper ) . "<" . strtolower( $this->getNodeName() ); $strCloseTag = "</" . strtolower( $this->getNodeName() ) . ">"; } foreach( $this->arrNodeAttributes as $strAttribute => $strValue ) { $strPrintValue = CorujaStringManipulation::XMLEntities( $strValue ); $strOpenTag .= " {$strAttribute}=\"{$strPrintValue}\" "; } if( sizeof( $this->arrChilds ) > 0 ) { if( $this->getNodeName() != "#comment" ) { $strOpenTag .= ">"; } $arrLines[] = $strOpenTag;
Method:
__sleep
{
return $this->strTextContent;
}
else
{
$strTextNode = '';
foreach( $this->arrChilds as $objChild )
{
if( $booRecursive )
{
$strTextNode .= $objChild->getTextContent( $booRecursive );
}
else
{
if( $objChild->isTextNode() )
{
$strTextNode .= $objChild->getTextContent( $booRecursive );
File:
/var/www/coruja/coruja/coruja/components/default/error/CorujaError.class.php
Class:
CorujaError
/var/www/coruja/coruja/coruja/components/default/error/CorujaError.class.php
Method:
display
private function display( $strLevel, $strMessage, $strFile, $intNumber ) { print "/*<fieldset><legend><b>" . $strLevel . "</b></legend>"; print "\n<pre><b>File: </b>" . $strFile . " <b>Line: </b>" . $intNumber . " " . $strMessage . "</pre>"; print "\n</fieldset>\n\n*/"; } /**
Method:
handle
public function handle( $intNumber, $strError, $strFile, $intLine ) { switch ( $intNumber ) { case E_NOTICE: case E_USER_NOTICE: { self::notice( $strError, $strFile, $intNumber ); break; } case E_WARNING: case E_USER_WARNING: { self::warning( $strError, $strFile, $intNumber ); break; } case E_USER_ERROR: { self::fatal( $strError, $strFile, $intNumber ); break; } default: { self::unknown( $strError, $strFile, $intNumber ); break; } } } /**
public function handle( $intNumber, $strError, $strFile, $intLine ) { switch ( $intNumber ) { case E_NOTICE: case E_USER_NOTICE: { self::notice( $strError, $strFile, $intNumber ); break; } case E_WARNING: case E_USER_WARNING: { self::warning( $strError, $strFile, $intNumber ); break; } case E_USER_ERROR: { self::fatal( $strError, $strFile, $intNumber ); break; } default: { self::unknown( $strError, $strFile, $intNumber ); break; } } } /**
Method:
createLogMessage
private function createLogMessage( $strLevel, $strMessage, $strFile, $intNumber ) { $sMessage = ""; $sMessage .= "level: " . $strLevel . "; "; $sMessage .= "file: " . $strFile . "; "; $sMessage .= "line: " . $intNumber . "; "; $sMessage .= "message: " . $strMessage . "; "; } /**
Method:
report
private function report( $strLevel, $strMessage, $strFile, $intNumber ) { self::loadConfiguration(); if( isset( self::$arrConfiguration[$strLevel]["boolLog"] ) && ( self::$arrConfiguration[$strLevel]["boolLog"] ) ) { if( ComponentsResourceController::hasLogComponent() ) { $oLog = ComponentsResourceController::getLogComponent(); $oLog->event( "error" , self::createLogMessage( $strLevel, $strMessage, $strFile, $intNumber ) ); } } if( isset( self::$arrConfiguration[$strLevel]["boolDisplay"] ) && ( self::$arrConfiguration[$strLevel]["boolDisplay"] ) ) { self::display( $strLevel, $strMessage, $strFile, $intNumber ); } if( isset( self::$arrConfiguration[$strLevel]["boolExit"] ) && self::$arrConfiguration[$strLevel]["boolExit"] ) { $strExitMessage = htmlentities( $strMessage, ENT_QUOTES ); require_once( PATH_CORUJA_TEMPLATE . "error.php" ); exit(); } if( isset( self::$arrConfiguration[$strLevel]["boolThrow"] ) && self::$arrConfiguration[$strLevel]["boolThrow"] ) { switch( $strLevel ) { case self::NOTICE: { throw new NoticeException( $strMessage ); break; } case self::WARNING: { throw new WarningException( $strMessage ); break; } case self::FATAL: { throw new FatalException( $strMessage ); break; } case self::SQL: { throw new SqlException( $strMessage ); break; } default: { throw new CorujaException( $strMessage ); break; } } } return false; } /**
private function report( $strLevel, $strMessage, $strFile, $intNumber ) { self::loadConfiguration(); if( isset( self::$arrConfiguration[$strLevel]["boolLog"] ) && ( self::$arrConfiguration[$strLevel]["boolLog"] ) ) { if( ComponentsResourceController::hasLogComponent() ) { $oLog = ComponentsResourceController::getLogComponent(); $oLog->event( "error" , self::createLogMessage( $strLevel, $strMessage, $strFile, $intNumber ) ); } } if( isset( self::$arrConfiguration[$strLevel]["boolDisplay"] ) && ( self::$arrConfiguration[$strLevel]["boolDisplay"] ) ) { self::display( $strLevel, $strMessage, $strFile, $intNumber ); } if( isset( self::$arrConfiguration[$strLevel]["boolExit"] ) && self::$arrConfiguration[$strLevel]["boolExit"] ) { $strExitMessage = htmlentities( $strMessage, ENT_QUOTES ); require_once( PATH_CORUJA_TEMPLATE . "error.php" ); exit(); } if( isset( self::$arrConfiguration[$strLevel]["boolThrow"] ) && self::$arrConfiguration[$strLevel]["boolThrow"] ) { switch( $strLevel ) { case self::NOTICE: { throw new NoticeException( $strMessage ); break; } case self::WARNING: { throw new WarningException( $strMessage ); break; } case self::FATAL: { throw new FatalException( $strMessage ); break; } case self::SQL: { throw new SqlException( $strMessage ); break; } default: { throw new CorujaException( $strMessage ); break; } } } return false; } /**
Method:
notice
public function notice( $strMessage, $strFile, $intNumber ) { self::report( self::NOTICE, $strMessage, $strFile, $intNumber ); } /**
Method:
unknown
public function unknown( $strMessage, $strFile, $intNumber ) { if( self::report( self::UNKNOWN, $strMessage, $strFile, $intNumber ) ) { throw new Exception( $strMessage , $intNumber ); } } /**
Method:
warning
public function warning( $strMessage, $strFile, $intNumber ) { if( self::report( self::WARNING, $strMessage, $strFile, $intNumber ) ) { throw new WarningException( $strMessage , $intNumber ); } } /**
Method:
fatal
public function fatal( $strMessage, $strFile, $intNumber ) { if( self::report( self::FATAL, $strMessage, $strFile, $intNumber ) ) { throw new FatalException( $strMessage , $intNumber ); } } /**
Method:
sql
public function sql( $strMessage, $strFile, $intNumber ) { if( self::report( self::SQL, $strMessage, $strFile, $intNumber ) ) { throw new SqlException( $strMessage, $intNumber ); } }
File:
/var/www/coruja/coruja/coruja/components/default/log/CorujaLog.class.php
Class:
CorujaLog
/var/www/coruja/coruja/coruja/components/default/log/CorujaLog.class.php
Method:
config
public static function config() { $objConfiguration = simplexml_load_file( PATH_CORUJA_ADMIN_CONFIG . "log.xml" ); self::$strFileExtension = (string) $objConfiguration->strFileExtension; self::$strFilePath = (string) $objConfiguration->strFilePath; if( defined( self::$strFilePath ) ) { self::$strFilePath = constant( self::$strFilePath ); } self::$arrFileHandler = array(); self::$arrSection = array(); foreach ( $objConfiguration->sections->section as $objSection ) { $arrSectionElement = array(); $arrSectionElement[ "status" ] = (boolean) $objSection->boolStatus; $arrSectionElement[ "file" ] = (string) $objSection->strFile; self::$arrSection[(string) $objSection->strName] = $arrSectionElement; } if ( !is_dir( self::$strFilePath ) ) { // should not call the CorujaComponentsManager::getErrorComponent() // // because this element can call the log element creating a a infinite loop // throw new WarningException( 'Fail on write the file ' . self::$strFilePath , __FILE__ , __LINE__ ); if ( !mkdir( self::$strFilePath, 0777, TRUE ) ) { throw new FatalException( " The user of the system does not have permission to write to the log directory." ); } } } /**
public static function config() { $objConfiguration = simplexml_load_file( PATH_CORUJA_ADMIN_CONFIG . "log.xml" ); self::$strFileExtension = (string) $objConfiguration->strFileExtension; self::$strFilePath = (string) $objConfiguration->strFilePath; if( defined( self::$strFilePath ) ) { self::$strFilePath = constant( self::$strFilePath ); } self::$arrFileHandler = array(); self::$arrSection = array(); foreach ( $objConfiguration->sections->section as $objSection ) { $arrSectionElement = array(); $arrSectionElement[ "status" ] = (boolean) $objSection->boolStatus; $arrSectionElement[ "file" ] = (string) $objSection->strFile; self::$arrSection[(string) $objSection->strName] = $arrSectionElement; } if ( !is_dir( self::$strFilePath ) ) { // should not call the CorujaComponentsManager::getErrorComponent() // // because this element can call the log element creating a a infinite loop // throw new WarningException( 'Fail on write the file ' . self::$strFilePath , __FILE__ , __LINE__ ); if ( !mkdir( self::$strFilePath, 0777, TRUE ) ) { throw new FatalException( " The user of the system does not have permission to write to the log directory." ); } } } /**
Method:
convertTimeStamp
private function convertTimeStamp( $intTime, $realMicroTime ) { preg_match( "/0\.([0-9]{6})/", (string) $realMicroTime, $arrMicroTime ); $strNewTime = date( "Y-m-d H:i:s" , $intTime ) . "." . $arrMicroTime[1]; return( $strNewTime ); } /**
Method:
event
public static function event( $strSection, $strMessage ) { if ( !self::$arrSection[ $strSection ] ) { CorujaComponentsManager::getInstance()->getErrorComponent()->warning( "Unable to find the section " . $strSection . " into the Log file" , __FILE__ , __LINE__ ); } $arrSectionElement = self::$arrSection[ $strSection ]; if( $arrSectionElement[ "status" ] ) { $strSection = str_pad( $strSection, 15, " ", STR_PAD_RIGHT ); list( $realMicroTime, $intTime ) = explode( " ", microtime() ); $resFileHandler = self::logFile( $strSection , $intTime ); $strTime = self::convertTimeStamp( $intTime, $realMicroTime ); $strMessage = trim( str_replace( array("\n", "\r", "\t"), "", $strMessage ) ); $strUserIp = $_SERVER["REMOTE_ADDR"]; $strText = $strTime . "\t" . $strSection . "\t" . $strUserIp . "\t" . html_entity_decode( $strMessage ) . "\n"; fwrite( $resFileHandler, $strText ); } } /**
Method:
logFile
private function logFile( $strSection , $intTime ) { $strFileName = $strSection . date( "Y-m-d", $intTime ) . "." . self::$strFileExtension; if ( !array_key_exists( $strFileName, self::$arrFileHandler ) ) { self::$arrFileHandler[$strFileName] = fopen( self::$strFilePath . '/' . $strFileName, "a+" ); } $reference =& self::$arrFileHandler[$strFileName]; return( $reference ); }
Method:
__call
public function __call( $strMethod, $arrParameters ) { ErrorDealer::fatal( " The method " . $strMethod . " was not founded into the Log class " . get_class($this) . ". " , __FILE__ , __LINE__ ) ; } }
File:
/var/www/coruja/coruja/coruja/exceptions/CorujaException.class.php
Class:
CorujaException
/var/www/coruja/coruja/coruja/exceptions/CorujaException.class.php
Method:
getMessages
public function getMessages() { return $this->arrMessages; } public function throwIfHaveMessages()
Method:
throwIfHaveMessages
public function throwIfHaveMessages() { if( sizeof( $this->arrMessages ) > 0 ) { throw $this; } } } ?>
File:
/var/www/coruja/coruja/coruja/components/default/library/CorujaFileManipulation.class.php
Class:
CorujaFileManipulation
/var/www/coruja/coruja/coruja/components/default/library/CorujaFileManipulation.class.php
Method:
getRelativePath
public static function getRelativePath( $strFolderFrom, $strFolderTo, $booValidPath = true ) { // check for valid parameters $strFolderFrom = str_replace( "\\" , "/" , $strFolderFrom ); $strFolderTo = str_replace( "\\" , "/" , $strFolderTo ); if( $booValidPath && ( ! is_dir( $strFolderFrom ) || ! is_dir( $strFolderTo ) ) ) { throw new InvalidArgumentException("Invalid parameter: strFolderFrom: ".$strFolderFrom." strFolderTo: ".$strFolderTo); } // special case: equal paths if( $strFolderFrom == $strFolderTo ) { $strReturnPath = './'; } else { // explode parameters using '/' $arrFileFrom = explode( '/', $strFolderFrom ); $arrFileTo = explode( '/', $strFolderTo ); // remove similar base folders while( current( $arrFileFrom ) == current( $arrFileTo ) && count( $arrFileFrom ) > 0 ) { array_shift( $arrFileFrom ); array_shift( $arrFileTo ); } $arrReturnPath = array(); // make final address foreach( $arrFileFrom as $strFolder ) { if( $strFolder != "" ) { $arrReturnPath[] = ".."; } } foreach( $arrFileTo as $strFolder ) { $arrReturnPath[] = $strFolder; } $strReturnPath = implode( '/', $arrReturnPath ); } return $strReturnPath; } /**
public static function getRelativePath( $strFolderFrom, $strFolderTo, $booValidPath = true ) { // check for valid parameters $strFolderFrom = str_replace( "\\" , "/" , $strFolderFrom ); $strFolderTo = str_replace( "\\" , "/" , $strFolderTo ); if( $booValidPath && ( ! is_dir( $strFolderFrom ) || ! is_dir( $strFolderTo ) ) ) { throw new InvalidArgumentException("Invalid parameter: strFolderFrom: ".$strFolderFrom." strFolderTo: ".$strFolderTo); } // special case: equal paths if( $strFolderFrom == $strFolderTo ) { $strReturnPath = './'; } else { // explode parameters using '/' $arrFileFrom = explode( '/', $strFolderFrom ); $arrFileTo = explode( '/', $strFolderTo ); // remove similar base folders while( current( $arrFileFrom ) == current( $arrFileTo ) && count( $arrFileFrom ) > 0 ) { array_shift( $arrFileFrom ); array_shift( $arrFileTo ); } $arrReturnPath = array(); // make final address foreach( $arrFileFrom as $strFolder ) { if( $strFolder != "" ) { $arrReturnPath[] = ".."; } } foreach( $arrFileTo as $strFolder ) { $arrReturnPath[] = $strFolder; } $strReturnPath = implode( '/', $arrReturnPath ); } return $strReturnPath; } /**
Method:
isRelativePath
public static function isRelativePath( $strFile ) { $strFile = str_replace( "\\", "/", $strFile); if ( ( strpos( $strFile, "./") === 0 ) or ( strpos( $strFile, "../") === 0 ) or ( strpos( $strFile, "/../") !== false ) or ( strpos( $strFile, "/./") !== false ) ) { return true; } elseif( strpos( $strFile, "/") === false ) { return true; } else { return false; } } /**
public static function isRelativePath( $strFile ) { $strFile = str_replace( "\\", "/", $strFile); if ( ( strpos( $strFile, "./") === 0 ) or ( strpos( $strFile, "../") === 0 ) or ( strpos( $strFile, "/../") !== false ) or ( strpos( $strFile, "/./") !== false ) ) { return true; } elseif( strpos( $strFile, "/") === false ) { return true; } else { return false; } } /**
Method:
dir
public static function dir( $strFolder ) { $arrElements = array(); $objDir = dir( $strFolder ); while( false !== ( $strElement = $objDir->read() ) ) { $arrElements[] = $strElement; } sort( $arrElements ); return $arrElements; } public static function getFilePath( $strFileFrom , $strRelativePath )
Method:
getFilePath
public static function getFilePath( $strFileFrom , $strRelativePath ) { $strPath = CorujaFileManipulation::getPathOfFile( $strFileFrom ); $strRelativeFullPath = $strPath . $strRelativePath; return self::removeRelativeSlicesOfFile( $strRelativeFullPath ); } }
File:
/var/www/coruja/coruja/coruja/components/default/library/CorujaStringManipulation.class.php
Class:
CorujaStringManipulation
/var/www/coruja/coruja/coruja/components/default/library/CorujaStringManipulation.class.php
Method:
retab
public static function retab( $strText , $intDeeper ) { $arrText = explode( "\n" , $strText ); foreach( $arrText as $intKey => $strTextElement) { $arrText [ $intKey ] = trim( $strTextElement ); } $strTab = "\n" .str_repeat( "\t" , $intDeeper ); $strText = $strTab . implode( $strTab , $arrText ) . $strTab; return $strText; } public static function XMLEntities($string)
File:
/var/www/coruja/coruja/coruja/components/default/componentsManager/CorujaComponentsManagerConfig.class.php
Class:
CorujaComponentsManagerConfig
/var/www/coruja/coruja/coruja/components/default/componentsManager/CorujaComponentsManagerConfig.class.php
Method:
load
public static function load() { $objConfig = CorujaTree::loadFile( CorujaBegins::getCorujaFolderAdmin() . self::XML_COMPONENTS_CONFIG ); self::validate( $objConfig ); return $objConfig; } /**
Method:
validate
public static function validate( CorujaTree $objCorujaTree ) { if( $objCorujaTree->getNodeName() != "components" ) { throw new CorujaConfigurationException( "invalid root tag name" ); } } } ?>
File:
/var/www/coruja/coruja/extra/backTrace/BackTrace.class.php
Class:
BackTrace
/var/www/coruja/coruja/extra/backTrace/BackTrace.class.php
Method:
__construct
public function __construct( array $aStack = array() ) { $this->aStack = count( $aStack ) === 0 ? debug_backtrace() : $aStack; $this->levelTop(); } /**
Method:
explain
public function explain() { if( CorujaComponentsManager::hasBacktraceExplainComponent() ) { CorujaComponentsManager::getBacktraceExplainComponent()->perform( $this ); } } /**
Method:
getAll
public function getAll() { return $this->aStack; } /**
Method:
getArguments
public function getArguments() { if ( array_key_exists( "args", $this->aCurrent ) === false ) { return array(); } return (array) $this->aCurrent["args"]; } /**
Method:
getClass
public function getClass() { if ( array_key_exists( "class", $this->aCurrent ) === false ) { return ""; } return (string) $this->aCurrent["class"]; } /**
Method:
getCurrent
public function getCurrent() { return $this->aCurrent; } /**
Method:
getFile
public function getFile( $bOnlyName = false ) { if ( array_key_exists( "file", $this->aCurrent ) === false ) { return ""; } if ( $bOnlyName === true ) { return basename( (string) $this->aCurrent["file"] ); } return (string) $this->aCurrent["file"]; } /**
Method:
getFunction
public function getFunction() { if ( array_key_exists( "function", $this->aCurrent ) === false ) { return ""; } return (string) $this->aCurrent["function"]; } /**
Method:
getLevel
public function getLevel() { return $this->iLevel; } /**
Method:
getLine
public function getLine() { if ( array_key_exists( "line", $this->aCurrent ) === false ) { return 0; } return (integer) $this->aCurrent["line"]; } /**
Method:
getScope
public function getScope() { $sType = $this->getType(); if ( $sType === "" ) { $sType = $this->getFunction() === "" ? self::SCOPE_FILE : self::SCOPE_FUNCTION; } return $sType; } /**
Method:
getType
public function getType() { if ( array_key_exists( "type", $this->aCurrent ) === false ) { return ""; } return (string) $this->aCurrent["type"]; } /**
Method:
levelBottom
public function levelBottom() { $this->setLevel( count( $this->aStack ) - 1 ); } /**
Method:
levelDown
public function levelDown( $iDepth = 1, $bTry = false ) { $iDepth = (integer) $iDepth; $bReturn = $this->setLevel( $this->iLevel + $iDepth ); if ( $bReturn === false && $bTry === true ) { $iDepth > 0 ? $this->levelTop() : $this->levelBottom(); } return $bReturn; } /**
Method:
levelTop
public function levelTop() { $this->setLevel( 0 ); } /**
Method:
levelUp
public function levelUp( $iDepth = 1, $bTry = false ) { $iDepth = (integer) $iDepth; $bReturn = $this->setLevel( $this->iLevel - $iDepth ); if ( $bReturn === false && $bTry === true ) { $iDepth > 0 ? $this->levelBottom() : $this->levelTop(); } return $bReturn; } /**
Method:
setLevel
public function setLevel( $iLevel ) { $iLevel = (integer) $iLevel; if ( array_key_exists( $iLevel, $this->aStack ) === true ) { $this->iLevel = $iLevel; } $this->aCurrent = &$this->aStack[$this->iLevel]; return $this->iLevel === $iLevel; } }
File:
/var/www/coruja/coruja/extra/backTraceExplain/BackTraceExplain.class.php
Class:
BackTraceExplain
/var/www/coruja/coruja/extra/backTraceExplain/BackTraceExplain.class.php
Method:
fetchArguments
protected function fetchArguments() { $aArgument = $this->oBackTrace->getArguments(); if ( count( $aArgument ) === 0 ) { return array(); } $aReturn = array(); foreach ( $aArgument as $mArgument ) { switch( gettype( $mArgument ) ) { case "array": $sSummary = "array( " . count( $mArgument ) . " )"; break; case "boolean": $sSummary = $mArgument === true ? "true" : "false"; break; case "double": case "integer": $sSummary = (string) $mArgument; break; case "NULL": $sSummary = "null"; break; case "object": $sSummary = "object( " . htmlentities( get_class( $mArgument ) ) . " )"; break; case "resource": $sSummary = "resource( " . htmlentities( strstr( $mArgument, "#" ) . " " . get_resource_type( $mArgument ) ) . " )"; break; case "string": if ( strlen( $mArgument ) > 15 ) { $mArgument = substr( $mArgument, 0, 12 ) . "..."; } $sSummary = htmlentities( "\"" . $mArgument . "\"" ); break; default: $sSummary = "unknown type " . htmlentities( gettype( $mArgument ) ); break; } array_push( $aReturn, $sSummary ); } return $aReturn; } /**
protected function fetchArguments() { $aArgument = $this->oBackTrace->getArguments(); if ( count( $aArgument ) === 0 ) { return array(); } $aReturn = array(); foreach ( $aArgument as $mArgument ) { switch( gettype( $mArgument ) ) { case "array": $sSummary = "array( " . count( $mArgument ) . " )"; break; case "boolean": $sSummary = $mArgument === true ? "true" : "false"; break; case "double": case "integer": $sSummary = (string) $mArgument; break; case "NULL": $sSummary = "null"; break; case "object": $sSummary = "object( " . htmlentities( get_class( $mArgument ) ) . " )"; break; case "resource": $sSummary = "resource( " . htmlentities( strstr( $mArgument, "#" ) . " " . get_resource_type( $mArgument ) ) . " )"; break; case "string": if ( strlen( $mArgument ) > 15 ) { $mArgument = substr( $mArgument, 0, 12 ) . "..."; } $sSummary = htmlentities( "\"" . $mArgument . "\"" ); break; default: $sSummary = "unknown type " . htmlentities( gettype( $mArgument ) ); break; } array_push( $aReturn, $sSummary ); } return $aReturn; } /**
Method:
fetchCall
protected function fetchCall() { if ( $this->oBackTrace->getScope() === BackTrace::SCOPE_FILE ) { return ""; } $iLevel = self::$iExplainId + $this->oBackTrace->getLevel(); $sAnchor = ""; $sArgument = ""; foreach ( $this->fetchArguments() as $sSummary ) { $sArgument .= ", " . $sSummary; } if ( $sArgument !== "" ) { $sArgument = substr( $sArgument, 1 ) . " "; } $sClass = $this->oBackTrace->getClass(); $sType = $this->oBackTrace->getType(); $sFunction = $this->oBackTrace->getFunction(); return htmlentities( $sClass . $sType . $sFunction ) . "(" . $sArgument . ")"; } /**
Method:
fetchLevel
protected function fetchLevel() { $sLocation = htmlentities( $this->oBackTrace->getFile() ) . " on line " . $this->oBackTrace->getLine(); $sSource = $this->fetchSource(); $sSourceId = "BackTraceExplainSource" . ( self::$iExplainId + $this->oBackTrace->getLevel() ); if ( $sSource !== "" ) { $sLocation = "<a href=\"\" onclick=\"this.blur(); " . $this->sScriptFunctionName . "( '" . $sSourceId . "' ); return false;\">" . $sLocation . "</a>"; } return "<div class=\"traceCall\">" . $this->fetchCall() . "</div>" . "<div class=\"traceLocation\">" . $sLocation . "</div>" . "<div class=\"traceSource\" id=\"" . $sSourceId . "\">" . $sSource . "</div>"; } /**
Method:
fetchSource
protected function fetchSource() { $sFile = $this->oBackTrace->getFile(); if ( self::CONTEXT_LINES == 0 || file_exists( $sFile ) === false || is_readable( $sFile ) === false ) { return ""; } // verifica se existe cache if ( array_key_exists( $sFile, self::$aFileContent ) === false ) { self::$aFileContent[$sFile] = substr( highlight_string( file_get_contents( $sFile ), true ), 6, -7 ); } $sSource = ""; $aLine = explode( "<br />", self::$aFileContent[$sFile] ); $iLine = $this->oBackTrace->getLine(); // define linha inicial e final a ser exibida if ( self::CONTEXT_LINES < 0 ) { $iLineStart = 1; $iLineEnd = count( $aLine ); } else { $fEdge = ( self::CONTEXT_LINES - 1 ) / 3; $iLineStart = $iLine - ceil( $fEdge * 2 ); $iLineEnd = $iLine + floor( $fEdge ); if ( $iLineStart < 1 ) { $iLineEnd += abs( $iLineStart ) + 1; $iLineStart = 1; } $iSourceLength = count( $aLine ); if ( $iLineEnd > $iSourceLength ) { $iLineStart -= $iLineEnd - $iSourceLength; if ( $iLineStart < 1 ) { $iLineStart = 1; } $iLineEnd = $iSourceLength; } } // monta texto de dete��o da primeira linha, que precisa de tratamento especial $sFirstLineDetect = "<span style=\"color: #000000\">\n<span style=\"color: #0000BB\">"; $iFirstLineDetectLength = strlen( $sFirstLineDetect ); // percorre linhas de c�digo foreach ( $aLine as $iCurrentLine => $sLineContent ) { // trata linha corrente para contagem iniciar no n�mero 1 $iCurrentLine++; // verifica se linha deve estar vis�vel if ( $iCurrentLine < $iLineStart || $iCurrentLine > $iLineEnd ) { // remove todo conte�do que existir entre duas marca��es HTML $aMatch = array(); preg_match_all( "(<[^>]+>)", $sLineContent, $aMatch ); if ( count( $aMatch ) > 0 && is_array( $aMatch[0] ) === true ) { $sLineContent = str_replace( array( "<br/>", " ", "\n" ), "", implode( "", $aMatch[0] ) ); } } else { // verifica se � a primeira linha if ( substr( $sLineContent, 0, $iFirstLineDetectLength ) === $sFirstLineDetect ) { // retira o prefixo para evitar erros de tratamento do c�digo // o prefixo � adiciona de volta a linha ao final do tratamento da linha atual $sLineContent = substr( $sLineContent, $iFirstLineDetectLength ); $sLinePrefix = $sFirstLineDetect; } else { $sLinePrefix = ""; } // prepara linha para que ela receba a numera��o com uma classe de estilo // adiciona uma quebra de linha vis�vel ao final da linha $sLineContent = "</span>" . $sLineContent . "<br/>"; // verifica se linha deve ser destacada if ( $iCurrentLine !== $iLine ) { $sClass = "traceNumberLineOff"; } else { // destaca n�mero da linha // adiciona classe de estilo para destaque de todo conte�do da linha $sClass = "traceNumberLineOn"; $sLineContent = preg_replace( "/>([^<]*)</", "><span class=\"traceLineActive\">$1</span><", $sLineContent ); } $sLineContent = $sLinePrefix . "<span class=\"" . $sClass . "\">" . sprintf( "%0" . strlen( $iLineEnd ) . "d", $iCurrentLine ) . $sLineContent; } $sSource .= $sLineContent; } return $sSource; } /**
protected function fetchSource() { $sFile = $this->oBackTrace->getFile(); if ( self::CONTEXT_LINES == 0 || file_exists( $sFile ) === false || is_readable( $sFile ) === false ) { return ""; } // verifica se existe cache if ( array_key_exists( $sFile, self::$aFileContent ) === false ) { self::$aFileContent[$sFile] = substr( highlight_string( file_get_contents( $sFile ), true ), 6, -7 ); } $sSource = ""; $aLine = explode( "<br />", self::$aFileContent[$sFile] ); $iLine = $this->oBackTrace->getLine(); // define linha inicial e final a ser exibida if ( self::CONTEXT_LINES < 0 ) { $iLineStart = 1; $iLineEnd = count( $aLine ); } else { $fEdge = ( self::CONTEXT_LINES - 1 ) / 3; $iLineStart = $iLine - ceil( $fEdge * 2 ); $iLineEnd = $iLine + floor( $fEdge ); if ( $iLineStart < 1 ) { $iLineEnd += abs( $iLineStart ) + 1; $iLineStart = 1; } $iSourceLength = count( $aLine ); if ( $iLineEnd > $iSourceLength ) { $iLineStart -= $iLineEnd - $iSourceLength; if ( $iLineStart < 1 ) { $iLineStart = 1; } $iLineEnd = $iSourceLength; } } // monta texto de dete��o da primeira linha, que precisa de tratamento especial $sFirstLineDetect = "<span style=\"color: #000000\">\n<span style=\"color: #0000BB\">"; $iFirstLineDetectLength = strlen( $sFirstLineDetect ); // percorre linhas de c�digo foreach ( $aLine as $iCurrentLine => $sLineContent ) { // trata linha corrente para contagem iniciar no n�mero 1 $iCurrentLine++; // verifica se linha deve estar vis�vel if ( $iCurrentLine < $iLineStart || $iCurrentLine > $iLineEnd ) { // remove todo conte�do que existir entre duas marca��es HTML $aMatch = array(); preg_match_all( "(<[^>]+>)", $sLineContent, $aMatch ); if ( count( $aMatch ) > 0 && is_array( $aMatch[0] ) === true ) { $sLineContent = str_replace( array( "<br/>", " ", "\n" ), "", implode( "", $aMatch[0] ) ); } } else { // verifica se � a primeira linha if ( substr( $sLineContent, 0, $iFirstLineDetectLength ) === $sFirstLineDetect ) { // retira o prefixo para evitar erros de tratamento do c�digo // o prefixo � adiciona de volta a linha ao final do tratamento da linha atual $sLineContent = substr( $sLineContent, $iFirstLineDetectLength ); $sLinePrefix = $sFirstLineDetect; } else { $sLinePrefix = ""; } // prepara linha para que ela receba a numera��o com uma classe de estilo // adiciona uma quebra de linha vis�vel ao final da linha $sLineContent = "</span>" . $sLineContent . "<br/>"; // verifica se linha deve ser destacada if ( $iCurrentLine !== $iLine ) { $sClass = "traceNumberLineOff"; } else { // destaca n�mero da linha // adiciona classe de estilo para destaque de todo conte�do da linha $sClass = "traceNumberLineOn"; $sLineContent = preg_replace( "/>([^<]*)</", "><span class=\"traceLineActive\">$1</span><", $sLineContent ); } $sLineContent = $sLinePrefix . "<span class=\"" . $sClass . "\">" . sprintf( "%0" . strlen( $iLineEnd ) . "d", $iCurrentLine ) . $sLineContent; } $sSource .= $sLineContent; } return $sSource; } /**
Method:
perform
public static function perform( BackTrace $oBackTrace = null ) { if ( $oBackTrace === null ) { $oBackTrace = new BackTrace(); $oBackTrace->levelDown(); } $iOriginalLevel = $oBackTrace->getLevel(); $oExplain = new self(); $oExplain->oBackTrace = $oBackTrace; $oExplain->iStartLevel = $oBackTrace->getLevel(); $oExplain->sScriptFunctionName = "BackTraceExplainFunction" . self::$iExplainId; $sTrace = ""; do { $sTrace .= "<li class=\"traceLevel\">" . $oExplain->fetchLevel() . "</li>"; } while ( $oBackTrace->levelDown() === true ); self::$iExplainId += $oBackTrace->getLevel() - $iOriginalLevel + 1; $oBackTrace->setLevel( $iOriginalLevel ); $sDir = dirname( __FILE__ ) . "/resource/"; return "<style type=\"text/css\">" . file_get_contents( $sDir . "style.css" ) . "</style>" . "<script type=\"text/javascript\">" . str_replace( "_TRACE_FUNCTION_", $oExplain->sScriptFunctionName, file_get_contents( $sDir . "script.js" ) ) . "</script>" . "<ol class=\"trace\">" . $sTrace . "</ol>"; } }
File:
/var/www/coruja/coruja/coruja/components/default/annotation/CorujaAnnotation.class.php
Class:
CorujaAnnotation
/var/www/coruja/coruja/coruja/components/default/annotation/CorujaAnnotation.class.php
Method:
getInstance
public function getInstance( $objElement ) { $strClassName = get_class( $objElement ); if( isset( self::$arrInstances[ $strClassName ] ) ) { return self::$arrInstances[ $strClassName ]; } else { $objInstance = new CorujaAnnotation( $objElement ); self::$arrInstances[ $strClassName ] = $objInstance; return $objInstance; } } /**
Method:
getDocCommentTagValue
public static function getDocCommentTagValue($strDocComment, $strTag) { $strTag = str_replace( "@" , "" , $strTag ); $arrLines = explode( "@" , $strDocComment ); $arrIgnore = Array( "*/" , "*/" , "/**", "*" , " " ); foreach( $arrLines as $strLine ) { $strLine = trim( str_replace( $arrIgnore , " " , $strLine ) ); $intSpacePos = strpos( $strLine , " " ); if( $intSpacePos !== false ) { $strActualTag = substr( $strLine , 0 , $intSpacePos ); } else { $strActualTag = $strLine; } if( $strActualTag == $strTag ) { if( $intSpacePos == false ) { return ""; } $strValue = substr( $strLine , $intSpacePos + 1 ); return trim( $strValue ); } } return null; } /**
public static function getDocCommentTagValue($strDocComment, $strTag) { $strTag = str_replace( "@" , "" , $strTag ); $arrLines = explode( "@" , $strDocComment ); $arrIgnore = Array( "*/" , "*/" , "/**", "*" , " " ); foreach( $arrLines as $strLine ) { $strLine = trim( str_replace( $arrIgnore , " " , $strLine ) ); $intSpacePos = strpos( $strLine , " " ); if( $intSpacePos !== false ) { $strActualTag = substr( $strLine , 0 , $intSpacePos ); } else { $strActualTag = $strLine; } if( $strActualTag == $strTag ) { if( $intSpacePos == false ) { return ""; } $strValue = substr( $strLine , $intSpacePos + 1 ); return trim( $strValue ); } } return null; } /**
Method:
__construct
public function __construct( /*stdClass*/ $objElement = null ) { if( $objElement != null ) { $this->objElement = $objElement; $this->initAnnotations(); } } /**
Method:
initAnnotationResponsables
protected function initAnnotationResponsables() { /** * Get all the Class Parents of the Class of the Element */ $arrClass = class_parents( $this->objElement ) ; /** * Append the Class of the Element itself */ array_unshift( $arrClass , get_class( $this->objElement ) ); /** * Search in all of then ( newest to oldest ) * the annotation tags */ foreach( $arrClass as $strClass ) { /** * Get the Doc Comment of the Class */ $objReflection = new ReflectionClass( $strClass ); $objReflection->getDocComment(); /** * Search for the Annotation of the AnnotationClass */ $strNewValue = self::getDocCommentTagValue( $objReflection->getDocComment(), "@AnnotationClass" ); if( $strNewValue != "" and $this->strAnnotationClass == "" ) { $this->strAnnotationClass = $strNewValue; } /** * Search for the Annotation of the AnnotationMethod */ $strNewValue = self::getDocCommentTagValue( $objReflection->getDocComment(), "@AnnotationMethod" ); if( $strNewValue != "" and $this->strAnnotationMethod == "" ) { $this->strAnnotationMethod = $strNewValue; } /** * Search for the Annotation of the AnnotationAttribute */ $strNewValue = self::getDocCommentTagValue( $objReflection->getDocComment(), "@AnnotationAttribute" ); if( $strNewValue != "" and $this->strAnnotationAttribute == "" ) { $this->strAnnotationAttribute = $strNewValue; } /** * If All the Elements already are filled, into the most recent * version. The search already can be stopped. */ if( $this->strAnnotationAttribute != "" and $this->strAnnotationClass != "" and $this->strAnnotationMethod != "" ) { break; } } } /**
protected function initAnnotationResponsables() { /** * Get all the Class Parents of the Class of the Element */ $arrClass = class_parents( $this->objElement ) ; /** * Append the Class of the Element itself */ array_unshift( $arrClass , get_class( $this->objElement ) ); /** * Search in all of then ( newest to oldest ) * the annotation tags */ foreach( $arrClass as $strClass ) { /** * Get the Doc Comment of the Class */ $objReflection = new ReflectionClass( $strClass ); $objReflection->getDocComment(); /** * Search for the Annotation of the AnnotationClass */ $strNewValue = self::getDocCommentTagValue( $objReflection->getDocComment(), "@AnnotationClass" ); if( $strNewValue != "" and $this->strAnnotationClass == "" ) { $this->strAnnotationClass = $strNewValue; } /** * Search for the Annotation of the AnnotationMethod */ $strNewValue = self::getDocCommentTagValue( $objReflection->getDocComment(), "@AnnotationMethod" ); if( $strNewValue != "" and $this->strAnnotationMethod == "" ) { $this->strAnnotationMethod = $strNewValue; } /** * Search for the Annotation of the AnnotationAttribute */ $strNewValue = self::getDocCommentTagValue( $objReflection->getDocComment(), "@AnnotationAttribute" ); if( $strNewValue != "" and $this->strAnnotationAttribute == "" ) { $this->strAnnotationAttribute = $strNewValue; } /** * If All the Elements already are filled, into the most recent * version. The search already can be stopped. */ if( $this->strAnnotationAttribute != "" and $this->strAnnotationClass != "" and $this->strAnnotationMethod != "" ) { break; } } } /**
Method:
initAnnotations
protected function initAnnotations() { $this->initAnnotationResponsables(); $this->initAnnotationClass(); $this->initAnnotationMethods(); $this->initAnnotationAttributes(); } /**
Method:
initAnnotationClass
protected function initAnnotationClass() { /** * Check if the Annotation Class Is Set */ if( $this->strAnnotationClass == "" ) { return; } /** * Check if the Annotation Class exists */ if( !class_exists( $this->strAnnotationClass ) ) { throw new CorujaAnnotationException( "Reflection Annotation Class " . $this->strAnnotationClass . " don't exist " ); } /** * All the Annotations setter Methods should be filled by the * information inside the annotation tags, except a group of * methods what are of internal controll, what is defined * into this $arrInterfaceMethods array. */ $arrAnnotationsMethods = get_class_methods( $this->strAnnotationClass ); $arrInterfaceMethods = array( "setEntityName" ); /** * Create the Instance of the Annotation Class */ $this->objAnnotationClass = new $this->strAnnotationClass(); /** * @var $this->objAnnotationClass CorujaAnnotationClassInterface */ /** * If the Annotation Class not implement the Annotation Class Interface, * the Informed Annotation Class is a invalid class. */ if( ! $this->objAnnotationClass instanceof CorujaAnnotationClassInterface ) { throw new CorujaAnnotationException( $this->strAnnotationClass . " is not a Annotation Class Interface " ); } /** * Set into the Annotation Class the Container Name */ $this->objAnnotationClass->setClassContainerName( get_class( $this->objElement ) ); /** * Foreach Method of the Annotation Class */ foreach( $arrAnnotationsMethods as $strAnnotationMethod ) { if ( /** * is not a interface method */ ( !in_array( $strAnnotationMethod , $arrInterfaceMethods ) ) and /** * if is a set method */ ( substr( $strAnnotationMethod , 0 , 3 ) === "set" ) ) { $objMethod = new ReflectionClass( get_class( $this->objElement ) ); /** * removing the "set" of the method and lowercasing the first char */ $strAnnotationName = strtolower($strAnnotationMethod[3]) . substr( $strAnnotationMethod , 4 ); /** * get the value of the doc tag comment */ $mixValue = self::getDocCommentTagValue( $objMethod->getDocComment(), $strAnnotationName ); if( $mixValue != "" ) { /** * send it to the annotation class responsable */ $this->objAnnotationClass->{$strAnnotationMethod}( $mixValue ); } } } /** * Validate the Annotation Class */ $this->objAnnotationClass->validate(); } /**
protected function initAnnotationClass() { /** * Check if the Annotation Class Is Set */ if( $this->strAnnotationClass == "" ) { return; } /** * Check if the Annotation Class exists */ if( !class_exists( $this->strAnnotationClass ) ) { throw new CorujaAnnotationException( "Reflection Annotation Class " . $this->strAnnotationClass . " don't exist " ); } /** * All the Annotations setter Methods should be filled by the * information inside the annotation tags, except a group of * methods what are of internal controll, what is defined * into this $arrInterfaceMethods array. */ $arrAnnotationsMethods = get_class_methods( $this->strAnnotationClass ); $arrInterfaceMethods = array( "setEntityName" ); /** * Create the Instance of the Annotation Class */ $this->objAnnotationClass = new $this->strAnnotationClass(); /** * @var $this->objAnnotationClass CorujaAnnotationClassInterface */ /** * If the Annotation Class not implement the Annotation Class Interface, * the Informed Annotation Class is a invalid class. */ if( ! $this->objAnnotationClass instanceof CorujaAnnotationClassInterface ) { throw new CorujaAnnotationException( $this->strAnnotationClass . " is not a Annotation Class Interface " ); } /** * Set into the Annotation Class the Container Name */ $this->objAnnotationClass->setClassContainerName( get_class( $this->objElement ) ); /** * Foreach Method of the Annotation Class */ foreach( $arrAnnotationsMethods as $strAnnotationMethod ) { if ( /** * is not a interface method */ ( !in_array( $strAnnotationMethod , $arrInterfaceMethods ) ) and /** * if is a set method */ ( substr( $strAnnotationMethod , 0 , 3 ) === "set" ) ) { $objMethod = new ReflectionClass( get_class( $this->objElement ) ); /** * removing the "set" of the method and lowercasing the first char */ $strAnnotationName = strtolower($strAnnotationMethod[3]) . substr( $strAnnotationMethod , 4 ); /** * get the value of the doc tag comment */ $mixValue = self::getDocCommentTagValue( $objMethod->getDocComment(), $strAnnotationName ); if( $mixValue != "" ) { /** * send it to the annotation class responsable */ $this->objAnnotationClass->{$strAnnotationMethod}( $mixValue ); } } } /** * Validate the Annotation Class */ $this->objAnnotationClass->validate(); } /**
Method:
initAnnotationMethods
protected function initAnnotationMethods() { /** * Check if The Annotation Method is set */ if( $this->strAnnotationMethod == "" ) { return; } /** * Check if the Annotation Method Class Exists */ if( !class_exists( $this->strAnnotationMethod ) ) { throw new CorujaAnnotationException( "Reflection Annotation Class " . $this->strAnnotationMethod . " Don't exist " ); } /** * Get the Methods os the Reflected Class */ $oReflectionClass = new ReflectionClass( get_class( $this->objElement ) ); $arrMethods = $oReflectionClass->getMethods(); /** * Get the Methods of the Annotation Class */ $arrAnnotationsMethods = get_class_methods( $this->strAnnotationMethod ); /** * All the Annotations setter Methods should be filled by the * information inside the annotation tags, except a group of * methods what are of internal controll, what is defined * into this $arrInterfaceMethods array. */ $arrInterfaceMethods = array( "setAttributeName" , "setClassContainerName" ); /** * Foreach Method of the Reflected Class */ foreach( $arrMethods as $objReflectionProperty) { /*@var $objReflectionProperty ReflectionMethod*/ /** * Create an Instance of the Annotation Method */ $strAnnotationMethodClass = $this->strAnnotationMethod; $objAnnotationMethodElement = new $strAnnotationMethodClass( $objReflectionProperty->getDeclaringClass() , $objReflectionProperty->getName() ); /** * @var $objAnnotationMethodElement CorujaAnnotationMethodInterface */ /** * If the Annotation Method not implement the Annotation Method Interface, * the Informed Annotation Method is a invalid class. */ if( ! $objAnnotationMethodElement instanceof CorujaAnnotationMethodInterface ) { throw new CorujaAnnotationException( $this->strAnnotationMethod . " is not a Annotation Method Interface " ); } /** * Init the Annotation Method */ $objAnnotationMethodElement->setMethodName( $objReflectionProperty->getName() ); $objAnnotationMethodElement->setClassContainerName( $objReflectionProperty->getDeclaringClass() ); /** * Foreach Method into the Annotation Method Class */ foreach( $arrAnnotationsMethods as $strAnnotationMethod ) { if ( /** * is not a interface method */ ( !in_array( $strAnnotationMethod , $arrInterfaceMethods ) ) and /** * if is a set method */ ( substr( $strAnnotationMethod , 0 , 3 ) === "set" ) ) { /** * removing the "set" of the method and * lowercasing the first char */ $strAnnotationName = strtolower($strAnnotationMethod[3]) . substr( $strAnnotationMethod , 4 ); /** * get the value of the doc tag comment, if exists */ $mixValue = self::getDocCommentTagValue( $objReflectionProperty->getDocComment(), $strAnnotationName ); /** * send it to the annotation class responsable */ $objAnnotationMethodElement->{$strAnnotationMethod}( $mixValue ); } } /** * Validate the Annotation Method Element */ $objAnnotationMethodElement->validate(); /** * append this annotation method to the array */ $this->arrAnnotationMethods[ strtolower( $objReflectionProperty->getName() ) ] = $objAnnotationMethodElement; } } /**
protected function initAnnotationMethods() { /** * Check if The Annotation Method is set */ if( $this->strAnnotationMethod == "" ) { return; } /** * Check if the Annotation Method Class Exists */ if( !class_exists( $this->strAnnotationMethod ) ) { throw new CorujaAnnotationException( "Reflection Annotation Class " . $this->strAnnotationMethod . " Don't exist " ); } /** * Get the Methods os the Reflected Class */ $oReflectionClass = new ReflectionClass( get_class( $this->objElement ) ); $arrMethods = $oReflectionClass->getMethods(); /** * Get the Methods of the Annotation Class */ $arrAnnotationsMethods = get_class_methods( $this->strAnnotationMethod ); /** * All the Annotations setter Methods should be filled by the * information inside the annotation tags, except a group of * methods what are of internal controll, what is defined * into this $arrInterfaceMethods array. */ $arrInterfaceMethods = array( "setAttributeName" , "setClassContainerName" ); /** * Foreach Method of the Reflected Class */ foreach( $arrMethods as $objReflectionProperty) { /*@var $objReflectionProperty ReflectionMethod*/ /** * Create an Instance of the Annotation Method */ $strAnnotationMethodClass = $this->strAnnotationMethod; $objAnnotationMethodElement = new $strAnnotationMethodClass( $objReflectionProperty->getDeclaringClass() , $objReflectionProperty->getName() ); /** * @var $objAnnotationMethodElement CorujaAnnotationMethodInterface */ /** * If the Annotation Method not implement the Annotation Method Interface, * the Informed Annotation Method is a invalid class. */ if( ! $objAnnotationMethodElement instanceof CorujaAnnotationMethodInterface ) { throw new CorujaAnnotationException( $this->strAnnotationMethod . " is not a Annotation Method Interface " ); } /** * Init the Annotation Method */ $objAnnotationMethodElement->setMethodName( $objReflectionProperty->getName() ); $objAnnotationMethodElement->setClassContainerName( $objReflectionProperty->getDeclaringClass() ); /** * Foreach Method into the Annotation Method Class */ foreach( $arrAnnotationsMethods as $strAnnotationMethod ) { if ( /** * is not a interface method */ ( !in_array( $strAnnotationMethod , $arrInterfaceMethods ) ) and /** * if is a set method */ ( substr( $strAnnotationMethod , 0 , 3 ) === "set" ) ) { /** * removing the "set" of the method and * lowercasing the first char */ $strAnnotationName = strtolower($strAnnotationMethod[3]) . substr( $strAnnotationMethod , 4 ); /** * get the value of the doc tag comment, if exists */ $mixValue = self::getDocCommentTagValue( $objReflectionProperty->getDocComment(), $strAnnotationName ); /** * send it to the annotation class responsable */ $objAnnotationMethodElement->{$strAnnotationMethod}( $mixValue ); } } /** * Validate the Annotation Method Element */ $objAnnotationMethodElement->validate(); /** * append this annotation method to the array */ $this->arrAnnotationMethods[ strtolower( $objReflectionProperty->getName() ) ] = $objAnnotationMethodElement; } } /**
Method:
initAnnotationAttributes
protected function initAnnotationAttributes() { /** * Check if the Annotation Attribute is Set */ if( $this->strAnnotationAttribute == "" ) { return; } /** * Check if The Annotation Attribute Exists */ if( !class_exists( $this->strAnnotationAttribute ) ) { throw new CorujaAnnotationException( "Reflection Annotation Class " . $this->strAnnotationAttribute . " Don't exist " ); } /** * Get the Attributes of The Reflected Class */ $oReflectionClass = new ReflectionClass( get_class( $this->objElement ) ); $arrAttributes = $oReflectionClass->getProperties(); /** * Get the Methods of the Annotation Attribute Class */ $arrAnnotationsMethods = get_class_methods( $this->strAnnotationAttribute ); /** * All the Annotations setter Methods should be filled by the * information inside the annotation tags, except a group of * methods what are of internal controll, what is defined * into this $arrInterfaceMethods array. */ $arrInterfaceMethods = array( "setAttributeName" , "setClassContainerName" ); /** * For each Attribute of the Reflected Class */ foreach( $arrAttributes as $objReflectionProperty) { /** * @var $objReflectionProperty ReflectionProperty */ /** * Create the Annotation Attribute Class */ $strAnnotationAttributeClass = $this->strAnnotationAttribute; $objAnnotationAttributeElement = new $strAnnotationAttributeClass( $objReflectionProperty->getDeclaringClass() , $objReflectionProperty->getName() ); /** * If the Annotation Attribute Class not implement the Annotation Attribute Interface, * the Informed Annotation Attribute is a invalid class. */ if( ! $objAnnotationAttributeElement instanceof CorujaAnnotationAttributeInterface ) { throw new CorujaAnnotationException( $this->strAnnotationAttribute . " is not a Annotation Attribute Interface " ); } /** * @var $objAnnotationAttributeElement CorujaAnnotationAttributeInterface */ $objAnnotationAttributeElement->setAttributeName( $objReflectionProperty->getName() ); $objAnnotationAttributeElement->setClassContainerName( $objReflectionProperty->getDeclaringClass() ); foreach( $arrAnnotationsMethods as $strAnnotationMethod ) { if ( /** * is not a interface method */ ( !in_array( $strAnnotationMethod , $arrInterfaceMethods ) ) and /** * if is a set method */ ( substr( $strAnnotationMethod , 0 , 3 ) === "set" ) ) { /** * removing the "set" of the method and lowercasing the first char */ $strAnnotationName = strtolower($strAnnotationMethod[3]) . substr( $strAnnotationMethod , 4 ); /** * get the value of the doc tag comment, if exists */ $mixValue = self::getDocCommentTagValue( $objReflectionProperty->getDocComment(), $strAnnotationName ); /** * send it to the annotation class responsable */ $objAnnotationAttributeElement->{$strAnnotationMethod}( $mixValue ); } } /** * Validate the Annotation Attribute Element */ $objAnnotationAttributeElement->validate(); /** * append this annotation attribute to the array */ $this->arrAnnotationAttributes[ strtolower( $objReflectionProperty->getName() ) ] = $objAnnotationAttributeElement; } } /**
protected function initAnnotationAttributes() { /** * Check if the Annotation Attribute is Set */ if( $this->strAnnotationAttribute == "" ) { return; } /** * Check if The Annotation Attribute Exists */ if( !class_exists( $this->strAnnotationAttribute ) ) { throw new CorujaAnnotationException( "Reflection Annotation Class " . $this->strAnnotationAttribute . " Don't exist " ); } /** * Get the Attributes of The Reflected Class */ $oReflectionClass = new ReflectionClass( get_class( $this->objElement ) ); $arrAttributes = $oReflectionClass->getProperties(); /** * Get the Methods of the Annotation Attribute Class */ $arrAnnotationsMethods = get_class_methods( $this->strAnnotationAttribute ); /** * All the Annotations setter Methods should be filled by the * information inside the annotation tags, except a group of * methods what are of internal controll, what is defined * into this $arrInterfaceMethods array. */ $arrInterfaceMethods = array( "setAttributeName" , "setClassContainerName" ); /** * For each Attribute of the Reflected Class */ foreach( $arrAttributes as $objReflectionProperty) { /** * @var $objReflectionProperty ReflectionProperty */ /** * Create the Annotation Attribute Class */ $strAnnotationAttributeClass = $this->strAnnotationAttribute; $objAnnotationAttributeElement = new $strAnnotationAttributeClass( $objReflectionProperty->getDeclaringClass() , $objReflectionProperty->getName() ); /** * If the Annotation Attribute Class not implement the Annotation Attribute Interface, * the Informed Annotation Attribute is a invalid class. */ if( ! $objAnnotationAttributeElement instanceof CorujaAnnotationAttributeInterface ) { throw new CorujaAnnotationException( $this->strAnnotationAttribute . " is not a Annotation Attribute Interface " ); } /** * @var $objAnnotationAttributeElement CorujaAnnotationAttributeInterface */ $objAnnotationAttributeElement->setAttributeName( $objReflectionProperty->getName() ); $objAnnotationAttributeElement->setClassContainerName( $objReflectionProperty->getDeclaringClass() ); foreach( $arrAnnotationsMethods as $strAnnotationMethod ) { if ( /** * is not a interface method */ ( !in_array( $strAnnotationMethod , $arrInterfaceMethods ) ) and /** * if is a set method */ ( substr( $strAnnotationMethod , 0 , 3 ) === "set" ) ) { /** * removing the "set" of the method and lowercasing the first char */ $strAnnotationName = strtolower($strAnnotationMethod[3]) . substr( $strAnnotationMethod , 4 ); /** * get the value of the doc tag comment, if exists */ $mixValue = self::getDocCommentTagValue( $objReflectionProperty->getDocComment(), $strAnnotationName ); /** * send it to the annotation class responsable */ $objAnnotationAttributeElement->{$strAnnotationMethod}( $mixValue ); } } /** * Validate the Annotation Attribute Element */ $objAnnotationAttributeElement->validate(); /** * append this annotation attribute to the array */ $this->arrAnnotationAttributes[ strtolower( $objReflectionProperty->getName() ) ] = $objAnnotationAttributeElement; } } /**
Method:
getAnnotationClass
public function getAnnotationClass() { return $this->objAnnotationClass; } /**
Method:
getAnnotationAttribute
public function getAnnotationAttribute( $strAttributeName ) { $strAttributeName = strtolower( $strAttributeName ); if( array_key_exists( $strAttributeName , $this->arrAnnotationAttributes ) ) { return $this->arrAnnotationAttributes[ $strAttributeName ]; } else { throw new CorujaAnnotationException( "The annotation of the attribute " . $strAttributeName . " was not founded" ); } } /**
Method:
getAnnotationAttributes
public function getAnnotationAttributes() { return $this->arrAnnotationAttributes; } /**
Method:
getAnnotationMethod
public function getAnnotationMethod( $strMethodName ) { $strMethodName = strtolower( $strMethodName ); if( array_key_exists( $strMethodName , $this->arrAnnotationMethods ) ) { return $this->arrAnnotationMethods[ $strMethodName ]; } else { throw new CorujaAnnotationException( "The annotation of the method " . $strMethodName . " was not founded" ); } } /**
Method:
getAnnotationMethods
public function getAnnotationMethods() { return $this->arrAnnotationMethods; } } ?>
File:
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php
Class:
sfYamlInline
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php
Method:
load
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
Method:
dump
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
Method:
dumpArray
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
Method:
parseScalar
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
Method:
parseQuotedScalar
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
Method:
parseSequence
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
Method:
parseMapping
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
Method:
evaluateScalar
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
Method:
getTimestampRegex
/usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlInline.class.php /var/www/coruja
File:
/var/www/coruja/coruja/coruja/components/default/autoLoad/CorujaNotFoundedClass.class.php
Class:
CorujaNotFoundedClass
/var/www/coruja/coruja/coruja/components/default/autoLoad/CorujaNotFoundedClass.class.php
Method:
__call
public function __call( $strMethod, $arrParameter ) { self::error(); } /**
Method:
__get
public function __get( $strParameter ) { self::error(); } /**
Method:
__set
public function __set( $strParameter , $mixValue ) { self::error(); } /**
Method:
__construct
public function __construct() { self::error(); } /**
Method:
__callStatic
public static function __callStatic( $strMethod, $arrParams) { self::error(); } /**
Method:
__isset
public function __isset($strName) { self::error(); } /**
Method:
__set_state
public function __set_state($arrParam) { self::error(); } /**
Method:
__clone
public function __clone() { self::error(); } /**
Method:
error
public static function error() { throw new FatalException( " Unabled to find the file of this class " . self::$strClassName ); } }
File:
/var/www/coruja/coruja/coruja/components/autoloadGroup/ExtraComponentAutoloadGroup.class.php
Class:
ExtraComponentAutoloadGroup
/var/www/coruja/coruja/coruja/components/autoloadGroup/ExtraComponentAutoloadGroup.class.php
Method:
setExtraComponentFolder
public function setExtraComponentFolder( $strExtraComponentFolder ) { $this->strExtraComponentFolder = $strExtraComponentFolder; } /**
Method:
getExtraComponentFolder
public function getExtraComponentFolder() { return $this->strExtraComponentFolder; } /**
Method:
classBelongsToTheGroup
public function classBelongsToTheGroup( $strClassName ) { return true; } /**
Method:
checkIfClassBelongToGroup
private function checkIfClassBelongToGroup( $strClassName ) { if( !$this->classBelongsToTheGroup( $strClassName ) ) { throw new CorujaAutoLoadGroupException( "Class " . $strClassName . "don't belong to this group" ); } } /** * Get the possible file name of the possible extra component
Method:
getTheFileNameOfTheClass
public function getTheFileNameOfTheClass( $strClassName ) { $strFolder = $strClassName; if( $strClassName == "" ) { return ""; } $strFolder[0] = strtolower( $strFolder[0]); $strFile = $this->getExtraComponentFolder() . "/" . $strFolder . "/" . $strClassName . ".class.php"; return $strFile; } /**
Method:
getTheFolderName
private function getTheFolderName( $strClassName ) { $this->checkIfClassBelongToGroup( $strClassName ); $strFolderName = $strClassName; $strFolderName[0] = strtolower( $strFolderName[0] ); $strFolderName = $this->getExtraComponentFolder() . "/" . $strFolderName . "/" ; return $strFolderName; } /**
Method:
onLoadClass
public function onLoadClass( $strClassName ) { $strFolderName = $this->getTheFolderName( $strClassName ); $objDir = dir( $strFolderName ); while( false !== ( $strFileName = $objDir->read() ) ) { if( substr( $strFileName, -4) == ".php" ) { $strActualClassName = str_replace( Array( ".class.php" , ".interface.php") , Array( "" , "" ) , $strFileName ); if( $strClassName != $strActualClassName ) { CorujaAutoLoad::getInstance()->preLoadClassFile($strActualClassName, $strFolderName . "/" . $strFileName); } } } } } ?>
File:
/usr/share/php/PHPUnit/Util/YAML/sfYamlDumper.class.php
Class:
sfYamlDumper
/usr/share/php/PHPUnit/Util/YAML/sfYamlDumper.class.php
Method:
dump
Priority:
0
Rule:
NPathComplexity
/usr/share/php/PHPUnit/Util/YAML/sfYamlDumper.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlDumper.class.php /var/www/coruja
/usr/share/php/PHPUnit/Util/YAML/sfYamlDumper.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlDumper.class.php /var/www/coruja
/usr/share/php/PHPUnit/Util/YAML/sfYamlDumper.class.php /usr/share/php/PHPUnit/Util/YAML/sfYamlDumper.class.php /var/www/coruja
File:
/var/www/coruja/coruja/coruja/components/default/library/CorujaClassManipulation.class.php
Class:
CorujaClassManipulation
/var/www/coruja/coruja/coruja/components/default/library/CorujaClassManipulation.class.php
Method:
callMethodWithParametersIntoArray
public static function callMethodWithParametersIntoArray( $objElement , $strMethod , $arrParameters ) { $objReflectMethod = new ReflectionMethod( get_class( $objElement ) , $strMethod ); $arrReflectParameters = $objReflectMethod->getParameters(); $arrParams = array(); foreach( $arrReflectParameters as $objReflectParameter ) { /** * @var $objReflectParameter ReflectionParameter */ $strParameter = $objReflectParameter->getName(); if( $objReflectParameter->isDefaultValueAvailable() ) { $mixParameterValue = $objReflectParameter->getDefaultValue(); } else { $mixParameterValue = null; } $mixParameterFinalValue = CorujaArrayManipulation::getArrayField( $_REQUEST , $strParameter , $mixParameterValue ); $arrParams[ $strParameter ] = $mixParameterFinalValue; } call_user_method_array( $strMethod , $objElement , $arrParams ); } }
File:
/var/www/coruja/coruja/coruja/components/default/debug/CorujaDebug.class.php
Class:
CorujaDebug
/var/www/coruja/coruja/coruja/components/default/debug/CorujaDebug.class.php
Method:
privateXMLEntities
private function privateXMLEntities($intNum) { $chars = array( 128 => '€', 130 => '‚', 131 => 'ƒ', 132 => '„', 133 => '…', 134 => '†', 135 => '‡', 136 => 'ˆ', 137 => '‰', 138 => 'Š', 139 => '‹', 140 => 'Œ', 142 => 'Ž', 145 => '‘', 146 => '’', 147 => '“', 148 => '”', 149 => '•', 150 => '–', 151 => '—', 152 => '˜', 153 => '™', 154 => 'š', 155 => '›', 156 => 'œ', 158 => 'ž', 159 => 'Ÿ' ); $num = ord($intNum); return (($intNum > 127 && $intNum < 160) ? $chars[$intNum] : "&#".$intNum.";" ); } /**
Method:
highlightXml
public static function highlightXml( $strXmlContent ) { $strXmlContent = htmlentities( $strXmlContent , true ); // the css must be on style attribute to not be lose into the // // e-mail send or something like // $strStartTagStyle = "color:olive;"; $strNameTagStyle = "color:olive"; $strOutTagStyle = ""; $strInsideTagStyle = "color:black"; $strNextStyle = "color:navy"; $strValueTagStyle = "color:red"; $strXmlContent = str_replace( Array( "<" , // < start tag "/>" , // /> out tag ">" , // > content tag " ", // change of word "=", // attribute "span_style", "\n\t\n", // change of word "\t", // change of word "\n", // change of word ), Array( "</span></span><span_style'$strStartTagStyle'><<span_style'$strNameTagStyle'><span_style'display:none'>...</span><span>" , "</span>/></span><span_style'$strOutTagStyle'>", "</span>><span_style'$strInsideTagStyle'>", "</span> <span_style'$strNextStyle'>", "</span>=<span_style'$strValueTagStyle'>", "span style=", "<br/>", " ", "<br/>", ), $strXmlContent ); $strXmlContent = preg_replace('/<br\/>( )*<br\/>/', ' ', $strXmlContent ); $strXmlNewContent = null; while( $strXmlContent != $strXmlContent ) { $strXmlNewContent = $strXmlContent; $strXmlContent = preg_replace('/<span style="color:(black|navy|red);">(( )*(<br\/)*)*<\/span>/', ' ', $strXmlNewContent ); } $strXmlContent = "<div>" . $strXmlContent . "</div>"; return $strXmlContent; } /**
Method:
show
public static function show( $strExpression , $boolExit = FALSE ) { $arrBacktraceCaller = self::getBackTraceCaller(2); print $strExpression; print "\n<!--"; foreach( $arrBacktraceCaller as $strKey => $mixValue ) { print $strKey . " = " . serialize($mixValue) . "\n"; } print "--><br/>\n"; } /**
Method:
debugPhpCode
public static function debugPhpCode( $strPhpExpression, $boolExit = FALSE ) { if( substr( $strPhpExpression , 0 , 2 ) != "<?" ) { $strPhpExpression = "<?php \n" . $strPhpExpression; } $strPhpExpression = highlight_string( $strPhpExpression , true ); self::display( $strPhpExpression, $boolExit ); } /**
Method:
debugXmlCode
public static function debugXmlCode( $strXmlExpression, $boolExit = FALSE ) { $strXmlExpression = preg_replace('/[^\x09\x0A\x0D\x20-\x7F]/e', 'CorujaDebug::privateXMLEntities("$0")', $strXmlExpression); self::display( self::highlightXml( $strXmlExpression ) , $boolExit ); } /**
Method:
debugHtmlCode
public static function debugHtmlCode( $strHtmlExpression, $boolExit = FALSE ) { self::display( self::highlightXml( $strHtmlExpression ) , $boolExit ); } /**