idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
49,300
public function userHasRoles ( core_kernel_classes_Resource $ user , $ roles ) { $ returnValue = ( bool ) false ; if ( empty ( $ roles ) ) { throw new InvalidArgumentException ( 'The $roles parameter must not be empty.' ) ; } $ roles = ( is_array ( $ roles ) ) ? $ roles : array ( $ roles ) ; $ searchRoles = array ( ) ;...
Indicates if a user is granted with a set of Roles .
49,301
public function attachRole ( core_kernel_classes_Resource $ user , core_kernel_classes_Resource $ role ) { try { if ( false === $ this -> userHasRoles ( $ user , $ role ) ) { $ rolesProperty = new core_kernel_classes_Property ( GenerisRdf :: PROPERTY_USER_ROLES ) ; $ user -> setPropertyValue ( $ rolesProperty , $ role ...
Attach a Generis Role to a given Generis User . A UserException will be if an error occurs . If the User already has the role nothing happens .
49,302
public function unnatachRole ( core_kernel_classes_Resource $ user , core_kernel_classes_Resource $ role ) { try { if ( true === $ this -> userHasRoles ( $ user , $ role ) ) { $ rolesProperty = new core_kernel_classes_Property ( GenerisRdf :: PROPERTY_USER_ROLES ) ; $ options = array ( 'like' => false , 'pattern' => $ ...
Short description of method unnatachRole
49,303
public function addRole ( $ label , $ includedRoles = null , core_kernel_classes_Class $ class = null ) { $ returnValue = null ; $ includedRoles = is_array ( $ includedRoles ) ? $ includedRoles : array ( $ includedRoles ) ; $ includedRoles = empty ( $ includedRoles [ 0 ] ) ? array ( ) : $ includedRoles ; $ classRole = ...
Add a role in Generis .
49,304
public function removeRole ( core_kernel_classes_Resource $ role ) { $ returnValue = ( bool ) false ; if ( GENERIS_CACHE_USERS_ROLES == true && core_kernel_users_Cache :: areIncludedRolesInCache ( $ role ) ) { if ( $ role -> delete ( true ) == true ) { $ returnValue = core_kernel_users_Cache :: removeIncludedRoles ( $ ...
Remove a Generis Role from the persistent memory . Any reference to the Role will be removed .
49,305
public function getIncludedRoles ( core_kernel_classes_Resource $ role ) { $ returnValue = array ( ) ; if ( GENERIS_CACHE_USERS_ROLES === true && core_kernel_users_Cache :: areIncludedRolesInCache ( $ role ) === true ) { $ returnValue = core_kernel_users_Cache :: retrieveIncludedRoles ( $ role ) ; } else { $ includesRo...
Get an array of the Roles included by a Generis Role .
49,306
public function includeRole ( core_kernel_classes_Resource $ role , core_kernel_classes_Resource $ roleToInclude ) { $ includesRoleProperty = new core_kernel_classes_Property ( GenerisRdf :: PROPERTY_ROLE_INCLUDESROLE ) ; $ role -> removePropertyValues ( $ includesRoleProperty , array ( 'like' => false , 'pattern' => $...
Make a Role include another Role .
49,307
public function unincludeRole ( core_kernel_classes_Resource $ role , core_kernel_classes_Resource $ roleToUninclude ) { $ includesRoleProperty = new core_kernel_classes_Property ( GenerisRdf :: PROPERTY_ROLE_INCLUDESROLE ) ; $ role -> removePropertyValues ( $ includesRoleProperty , array ( 'like' => false , 'pattern' ...
Uninclude a Role from antother Role .
49,308
protected function getBaseDirectory ( ) { if ( ! $ this -> fileSystem ) { $ this -> fileSystem = $ this -> getServiceLocator ( ) -> get ( FileSystemService :: SERVICE_ID ) -> getDirectory ( $ this -> getFileSystemId ( ) ) ; } return $ this -> fileSystem ; }
Get current base directory
49,309
public function getFileSystem ( ) { if ( ! $ this -> fileSystem ) { $ this -> fileSystem = $ this -> getServiceLocator ( ) -> get ( FileSystemService :: SERVICE_ID ) -> getFileSystem ( $ this -> getFileSystemId ( ) ) ; } return $ this -> fileSystem ; }
Get current fileystem
49,310
static public function identifyFirstLanguage ( $ values ) { $ returnValue = '' ; if ( count ( $ values ) > 0 ) { $ previousLanguage = $ values [ 0 ] [ 'language' ] ; $ returnValue = $ previousLanguage ; foreach ( $ values as $ value ) { if ( $ value [ 'language' ] == $ previousLanguage ) { continue ; } else { $ returnV...
Short description of method identifyFirstLanguage
49,311
static public function buildSearchPattern ( common_persistence_SqlPersistence $ persistence , $ pattern , $ like = true ) { $ returnValue = '' ; if ( $ pattern instanceof core_kernel_classes_Literal ) { $ pattern = $ pattern -> __toString ( ) ; } switch ( gettype ( $ pattern ) ) { case 'object' : if ( $ pattern instanc...
Build a SQL search pattern on basis of a pattern and a comparison mode .
49,312
public function createIndex ( $ indexName , $ tableName , $ columns ) { $ sql = 'CREATE INDEX ' . $ indexName . ' ON ' . $ tableName . ' (' ; $ colsSql = array ( ) ; foreach ( $ columns as $ n => $ l ) { if ( ! empty ( $ l ) ) { $ colsSql [ ] = $ n . '(' . $ l . ')' ; } else { $ colsSql [ ] = $ n ; } } $ colsSql = impl...
Short description of method createIndex
49,313
public function getFilePath ( ) { $ returnValue = ( string ) '' ; if ( ! empty ( $ this -> filePath ) ) { $ returnValue = $ this -> filePath ; } return ( string ) $ returnValue ; }
Get the path to the manifest file .
49,314
public function getName ( ) { $ returnValue = ( string ) '' ; if ( ! empty ( $ this -> name ) ) { $ returnValue = $ this -> name ; } else { $ returnValue = null ; } return ( string ) $ returnValue ; }
Get the name of the Extension the manifest describes .
49,315
public function getDescription ( ) { $ returnValue = ( string ) '' ; if ( ! empty ( $ this -> description ) ) { $ returnValue = $ this -> description ; } return ( string ) $ returnValue ; }
Get the description of the Extension the manifest describes .
49,316
public function getVersion ( ) { $ returnValue = ( string ) '' ; if ( ! empty ( $ this -> version ) ) { $ returnValue = $ this -> version ; } return ( string ) $ returnValue ; }
Get the version of the Extension the manifest describes .
49,317
private function setInstallModelFiles ( $ installModelFiles ) { $ this -> installModelFiles = array ( ) ; $ installModelFiles = is_array ( $ installModelFiles ) ? $ installModelFiles : array ( $ installModelFiles ) ; foreach ( $ installModelFiles as $ row ) { if ( is_string ( $ row ) ) { $ rdfpath = $ row ; } elseif ( ...
Sets the the RDF files to be imported during install . The array must contain paths to the files to be imported .
49,318
private function setInstallChecks ( $ installChecks ) { if ( ! is_array ( $ installChecks ) ) { throw new common_ext_MalformedManifestException ( "The 'install->checks' component must be an array." ) ; } else { foreach ( $ installChecks as $ check ) { if ( empty ( $ check [ 'type' ] ) ) { throw new common_ext_Malformed...
Set the installation checks to be performed prior installation of the described Extension .
49,319
public function getLogger ( ) { if ( $ this -> logger instanceof LoggerInterface ) { return $ this -> logger ; } if ( $ this instanceof ServiceLocatorAwareInterface ) { $ logger = $ this -> getServiceLocator ( ) -> get ( LoggerService :: SERVICE_ID ) ; } else { $ logger = ServiceManager :: getServiceManager ( ) -> get ...
Get the logger based on service manager
49,320
public function getExpression ( ) { $ returnValue = null ; common_Logger :: i ( 'Evaluating rule ' . $ this -> getLabel ( ) . '(' . $ this -> getUri ( ) . ')' , array ( 'Generis Rule' ) ) ; if ( empty ( $ this -> expression ) ) { $ property = new core_kernel_classes_Property ( RulesRdf :: PROPERTY_RULE_IF ) ; $ this ->...
Short description of method getExpression
49,321
public static function singleton ( ) { $ returnValue = null ; if ( is_null ( self :: $ instance ) ) { $ class = __CLASS__ ; self :: $ instance = new $ class ( ) ; } $ returnValue = self :: $ instance ; return $ returnValue ; }
Main entry point to retrieve the unique NamespaceManager instance
49,322
public function getAllNamespaces ( ) { $ returnValue = array ( ) ; if ( count ( $ this -> namespaces ) == 0 ) { $ db = core_kernel_classes_DbWrapper :: singleton ( ) ; $ query = 'SELECT modelid, modeluri FROM models' ; $ result = $ db -> query ( $ query ) ; while ( $ row = $ result -> fetch ( ) ) { $ id = $ row [ 'mode...
Get the list of all module s namespaces
49,323
public function getNamespace ( $ modelid ) { $ returnValue = null ; if ( count ( $ this -> namespaces ) == 0 ) { $ this -> getAllNamespaces ( ) ; } if ( is_string ( $ modelid ) ) { $ modelid = array_search ( $ modelid , $ this -> namespaces ) ; } if ( is_int ( $ modelid ) ) { if ( isset ( $ this -> namespaces [ $ model...
Get a namesapce identified by the modelId or modelUri
49,324
public function indexOf ( common_Object $ object ) { $ returnValue = ( int ) 0 ; $ returnValue = - 1 ; foreach ( $ this -> sequence as $ index => $ _object ) { if ( $ object === $ _object ) { return $ index ; } } return ( int ) $ returnValue ; }
return the index of the node array at which the given node resides
49,325
public function get ( $ index ) { $ returnValue = null ; $ returnValue = isset ( $ this -> sequence [ $ index ] ) ? $ this -> sequence [ $ index ] : null ; if ( $ returnValue == null ) { throw new common_Exception ( 'index is out of range' ) ; } return $ returnValue ; }
Retrun the node at the given index
49,326
public function isEmpty ( ) { $ returnValue = ( bool ) false ; $ returnValue = ( count ( $ this -> sequence ) == 0 ) ; return ( bool ) $ returnValue ; }
Short description of method isEmpty
49,327
public function remove ( common_Object $ object ) { $ returnValue = ( bool ) false ; foreach ( $ this -> sequence as $ index => $ _node ) { if ( $ _node === $ object ) { unset ( $ this -> sequence [ $ index ] ) ; $ this -> sequence = array_values ( $ this -> sequence ) ; return true ; } } return false ; return ( bool )...
Remove the node from the collection
49,328
public function getSeverityDescriptionString ( ) { $ returnValue = ( string ) '' ; switch ( $ this -> severity ) { case common_Logger :: TRACE_LEVEL : $ returnValue = "TRACE" ; break ; case common_Logger :: DEBUG_LEVEL : $ returnValue = "DEBUG" ; break ; case common_Logger :: INFO_LEVEL : $ returnValue = "INFO" ; break...
Short description of method getSeverityDescriptionString
49,329
public static function currentRequest ( ) { if ( php_sapi_name ( ) == 'cli' ) { throw new common_exception_Error ( 'Cannot call ' . __FUNCTION__ . ' from command line' ) ; } $ https = self :: isHttps ( ) ; $ scheme = $ https ? 'https' : 'http' ; $ port = empty ( $ _SERVER [ 'HTTP_X_FORWARDED_PORT' ] ) ? $ _SERVER [ 'SE...
Creates an request from the current call
49,330
public static function isHttps ( ) { $ https = false ; if ( isset ( $ _SERVER [ 'HTTPS' ] ) && $ _SERVER [ 'HTTPS' ] == "on" ) { $ https = true ; } elseif ( ! empty ( $ _SERVER [ 'HTTP_X_FORWARDED_PROTO' ] ) && $ _SERVER [ 'HTTP_X_FORWARDED_PROTO' ] == 'https' || ! empty ( $ _SERVER [ 'HTTP_X_FORWARDED_SSL' ] ) && $ _S...
Detect whether we use https or http
49,331
public function getHeaderValue ( $ headerName ) { if ( is_string ( $ headerName ) && count ( $ this -> headers ) > 0 ) { $ lowCaseHeaders = array_change_key_case ( $ this -> headers , CASE_LOWER ) ; $ lowCaseHeaderName = strtolower ( $ headerName ) ; if ( isset ( $ lowCaseHeaders [ $ lowCaseHeaderName ] ) ) { return $ ...
Get the value of an HTTP header The lookup is case insensitive .
49,332
public function get ( $ serial ) { $ returnValue = $ this -> getPersistence ( ) -> get ( $ serial ) ; if ( $ returnValue === false && ! $ this -> has ( $ serial ) ) { $ msg = "No cache entry found for '" . $ serial . "'." ; throw new common_cache_NotFoundException ( $ msg ) ; } return $ returnValue ; }
gets the entry associted to the serial
49,333
public function search ( QueryBuilderInterface $ Builder ) { $ this -> serialyse ( $ Builder ) ; $ statement = $ this -> connector -> query ( $ this -> parsedQuery ) ; $ result = $ this -> statementToArray ( $ statement ) ; $ resultSetClass = $ this -> resultSetClassName ; $ resultSet = new $ resultSetClass ( $ result ...
execute Parsed Query
49,334
public function count ( QueryBuilderInterface $ Builder ) { $ this -> parsedQuery = $ this -> getSerialyser ( ) -> setCriteriaList ( $ Builder ) -> count ( true ) -> serialyse ( ) ; $ statement = $ this -> connector -> query ( $ this -> parsedQuery ) ; $ result = $ this -> statementToArray ( $ statement ) ; return ( in...
return total count result
49,335
public function install ( ) { $ this -> validateOptions ( ) ; $ this -> setupServiceManager ( $ this -> getConfigPath ( ) ) ; $ this -> installFilesystem ( ) ; return new Report ( Report :: TYPE_SUCCESS , 'Oatbox installed successfully' ) ; }
run the install
49,336
public function setupServiceManager ( $ configPath ) { try { $ this -> getServiceManager ( ) ; } catch ( InvalidServiceManagerException $ e ) { if ( ! \ helpers_File :: emptyDirectory ( $ configPath , true ) ) { throw new \ common_exception_Error ( 'Unable to empty ' . $ configPath . ' folder.' ) ; } $ driver = new Ser...
Setup the service manager with configuration driver associated to config path
49,337
protected function installFilesystem ( ) { try { if ( ! ( $ this -> getServiceManager ( ) -> get ( FileSystemService :: SERVICE_ID ) instanceof FileSystemService ) ) { throw new InvalidService ( 'Your service must be a oat\oatbox\filesystem\FileSystemService' ) ; } } catch ( ServiceNotFoundException $ e ) { $ fileSyste...
Install the filesystem service if not already installed
49,338
protected function validateOptions ( ) { if ( ! $ this -> hasOption ( 'root_path' ) || empty ( $ this -> getOption ( 'root_path' ) ) ) { throw new \ common_exception_MissingParameter ( 'root_path' , __CLASS__ ) ; } if ( ! $ this -> hasOption ( 'file_path' ) || empty ( $ this -> getOption ( 'file_path' ) ) ) { throw new...
Validate require option e . q . file_path & root_path
49,339
protected function getConfigPath ( ) { if ( $ this -> hasOption ( 'config_path' ) && ! empty ( $ this -> getOption ( 'config_path' ) ) ) { return $ this -> getOption ( 'config_path' ) ; } return rtrim ( $ this -> getOption ( 'root_path' ) , '/\\' ) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR ; }
Get the path where to install config
49,340
public static function rmWorkingCopy ( $ path , $ recursive = true ) { $ returnValue = ( bool ) false ; if ( is_file ( $ path ) ) { if ( preg_match ( '/^\//' , $ path ) ) { $ returnValue = @ unlink ( $ path ) ; } } else if ( $ recursive ) { if ( is_dir ( $ path ) ) { $ iterator = new DirectoryIterator ( $ path ) ; fore...
Short description of method rmWorkingCopy
49,341
public static function cpWorkingCopy ( $ source , $ destination , $ recursive = true , $ ignoreSystemFiles = true ) { $ returnValue = ( bool ) false ; if ( file_exists ( $ source ) ) { if ( is_dir ( $ source ) && $ recursive ) { foreach ( scandir ( $ source ) as $ file ) { if ( $ file != '.' && $ file != '..' && $ file...
Short description of method cpWorkingCopy
49,342
protected function saveFile ( $ path , $ name ) { $ filename = $ this -> getUniqueFilename ( $ name ) ; $ dir = $ this -> getServiceManager ( ) -> get ( FileSystemService :: SERVICE_ID ) -> getDirectory ( Queue :: FILE_SYSTEM_ID ) ; $ filesystem = $ dir -> getFileSystem ( ) ; $ stream = fopen ( $ path , 'r+' ) ; $ file...
Save and serialize file into task queue filesystem .
49,343
protected function getDSN ( ) { $ params = $ this -> getParams ( ) ; $ driver = str_replace ( 'pdo_' , '' , $ params [ 'driver' ] ) ; $ dbName = $ params [ 'dbname' ] ; $ dbUrl = $ params [ 'host' ] ; $ dbPort = isset ( $ params [ 'port' ] ) ? ';port=' . $ params [ 'port' ] : '' ; return $ driver . ':dbname=' . $ dbNam...
Short description of method getDSN
49,344
public function connect ( $ id , array $ params ) { $ returnValue = null ; $ this -> params = $ params ; $ driver = $ params [ 'driver' ] ; $ dbLogin = $ params [ 'user' ] ; $ dbpass = $ params [ 'password' ] ; $ connLimit = 3 ; $ counter = 0 ; while ( true ) { $ dsn = $ this -> getDSN ( ) ; $ options = array ( PDO :: ...
Connect the SQL driver
49,345
public function prepare ( $ statement ) { $ returnValue = null ; $ this -> preparedExec = false ; $ returnValue = $ this -> getStatement ( $ statement ) ; return $ returnValue ; }
Creates a prepared PDOStatement .
49,346
protected function getStatement ( $ statement ) { $ key = $ this -> getStatementKey ( $ statement ) ; $ sth = null ; if ( ! empty ( $ this -> statements [ $ key ] ) ) { $ sth = $ this -> statements [ $ key ] ; } else { $ sth = $ this -> dbConnector -> prepare ( $ statement ) ; $ this -> statements [ $ key ] = $ sth ; }...
Get a statement in the statement store regarding the provided statement . it could not be found NULL is returned .
49,347
public static function t ( $ message , $ tags = array ( ) ) { self :: singleton ( ) -> log ( self :: TRACE_LEVEL , $ message , $ tags ) ; }
trace logs finest - grained processes informations
49,348
public static function d ( $ message , $ tags = array ( ) ) { self :: singleton ( ) -> log ( self :: DEBUG_LEVEL , $ message , $ tags ) ; }
debug logs fine grained informations for debugging
49,349
public static function i ( $ message , $ tags = array ( ) ) { self :: singleton ( ) -> log ( self :: INFO_LEVEL , $ message , $ tags ) ; }
info logs high level system events
49,350
public static function w ( $ message , $ tags = array ( ) ) { self :: singleton ( ) -> log ( self :: WARNING_LEVEL , $ message , $ tags ) ; }
warning logs events that represent potential problems
49,351
public static function e ( $ message , $ tags = array ( ) ) { self :: singleton ( ) -> log ( self :: ERROR_LEVEL , $ message , self :: addTrace ( $ tags ) ) ; }
error logs events that allow the system to continue
49,352
public static function f ( $ message , $ tags = array ( ) ) { self :: singleton ( ) -> log ( self :: FATAL_LEVEL , $ message , self :: addTrace ( $ tags ) ) ; }
fatal logs very severe error events that prevent the system to continue
49,353
public function handleException ( Exception $ exception ) { $ severity = method_exists ( $ exception , 'getSeverity' ) ? $ exception -> getSeverity ( ) : self :: ERROR_LEVEL ; self :: singleton ( ) -> log ( $ severity , $ exception -> getMessage ( ) , [ self :: CONTEXT_EXCEPTION => get_class ( $ exception ) , self :: C...
Short description of method handleException
49,354
public function handlePHPErrors ( $ errorNumber , $ errorString , $ errorFile = null , $ errorLine = null , $ errorContext = array ( ) ) { if ( error_reporting ( ) !== 0 ) { if ( $ errorNumber === E_STRICT ) { foreach ( $ this -> ACCEPTABLE_WARNINGS as $ pattern ) { if ( preg_match ( $ pattern , $ errorString ) > 0 ) {...
A handler for php errors should never be called manually
49,355
public function handlePHPShutdown ( ) { $ error = error_get_last ( ) ; if ( ( $ error [ 'type' ] & ( E_COMPILE_ERROR | E_ERROR | E_PARSE | E_CORE_ERROR ) ) != 0 ) { $ msg = ( isset ( $ error [ 'file' ] ) && isset ( $ error [ 'line' ] ) ) ? 'php error(' . $ error [ 'type' ] . ') in ' . $ error [ 'file' ] . '@' . $ error...
a workaround to catch fatal errors by handling the php shutdown should never be called manually
49,356
protected function getContext ( ) { $ trace = debug_backtrace ( ) ; $ file = isset ( $ trace [ 2 ] [ 'file' ] ) ? $ trace [ 2 ] [ 'file' ] : '' ; $ line = isset ( $ trace [ 2 ] [ 'line' ] ) ? $ trace [ 2 ] [ 'line' ] : '' ; return [ 'file' => $ file , 'line' => $ line , ] ; }
Returns the calling context .
49,357
private function propertiesValuestoStdClasses ( $ propertiesValues = null ) { $ returnValue = array ( ) ; foreach ( $ propertiesValues as $ uri => $ values ) { $ propStdClass = new stdClass ; $ propStdClass -> predicateUri = $ uri ; foreach ( $ values as $ value ) { $ stdValue = new stdClass ; $ stdValue -> valueType =...
small helper provide more convenient data structure for propertiesValues for exchange
49,358
protected function load ( $ modelId , $ file ) { $ easyRdf = new EasyRdf_Graph ( ) ; $ easyRdf -> parseFile ( $ file ) ; foreach ( $ easyRdf -> toRdfPhp ( ) as $ subject => $ propertiesValues ) { foreach ( $ propertiesValues as $ predicate => $ values ) { foreach ( $ values as $ k => $ v ) { $ triple = new core_kernel_...
load triples from rdf file
49,359
public function install ( ) { if ( $ this -> extension -> getId ( ) != 'generis' ) { throw new common_ext_ExtensionException ( 'Tried to install "' . $ this -> extension -> getId ( ) . '" extension using the GenerisInstaller' ) ; } $ this -> installLoadDefaultConfig ( ) ; $ model = new \ core_kernel_persistence_smooths...
Setup the ontology configuration
49,360
public function getStatusAsString ( ) { $ returnValue = ( string ) '' ; switch ( $ this -> getStatus ( ) ) { case self :: INVALID : $ returnValue = 'invalid' ; break ; case self :: UNKNOWN : $ returnValue = 'unknown' ; break ; case self :: VALID : $ returnValue = 'valid' ; break ; } return ( string ) $ returnValue ; }
Short description of method getStatusAsString
49,361
public function connect ( $ id , array $ params ) { if ( isset ( $ params [ 'connection' ] ) ) { $ connectionParams = $ params [ 'connection' ] ; } else { $ connectionParams = $ params ; $ connectionParams [ 'driver' ] = str_replace ( 'dbal_' , '' , $ connectionParams [ 'driver' ] ) ; } $ this -> persistentConnect ( $ ...
Connect to Dbal
49,362
public static function create ( Traversable $ from , Traversable $ to ) { $ diff = new self ( ) ; foreach ( $ to as $ triple ) { $ diff -> add ( $ triple ) ; } foreach ( $ from as $ triple ) { $ diff -> remove ( $ triple ) ; } return $ diff ; }
Creates a diff from a set of triples to a set of troples
49,363
public static function getMissingExtensionIds ( $ extensions ) { $ inList = array ( ) ; foreach ( $ extensions as $ ext ) { $ inList [ ] = $ ext -> getId ( ) ; } $ missing = array ( ) ; foreach ( $ extensions as $ ext ) { foreach ( $ ext -> getDependencies ( ) as $ extId => $ version ) { if ( ! in_array ( $ extId , $ i...
Based on a list of extensions we generate an array of missing extensions
49,364
public static function sortByDependencies ( $ extensions ) { $ sorted = array ( ) ; $ unsorted = array ( ) ; foreach ( $ extensions as $ ext ) { $ unsorted [ $ ext -> getId ( ) ] = array_keys ( $ ext -> getDependencies ( ) ) ; } while ( ! empty ( $ unsorted ) ) { $ before = count ( $ unsorted ) ; foreach ( array_keys (...
Sorts a list of extensions by dependencies starting with independent extensions
49,365
public static function isRequired ( common_ext_Extension $ extension ) { foreach ( common_ext_ExtensionsManager :: singleton ( ) -> getInstalledExtensions ( ) as $ ext ) { foreach ( $ ext -> getDependencies ( ) as $ extId => $ version ) { if ( $ extId == $ extension -> getId ( ) ) { return true ; } } } return false ; }
Whenever or not the extension is required by other installed extensions
49,366
public static function mustBeEnabled ( common_ext_Extension $ extension ) { foreach ( common_ext_ExtensionsManager :: singleton ( ) -> getEnabledExtensions ( ) as $ ext ) { foreach ( $ ext -> getDependencies ( ) as $ extId => $ version ) { if ( $ extId == $ extension -> getId ( ) ) { return true ; } } } return false ; ...
Whenever or not the extension is required to be enabled by other enabled extensions
49,367
public static function checkRequiredExtensions ( common_ext_Extension $ extension ) { $ extensionManager = common_ext_ExtensionsManager :: singleton ( ) ; foreach ( $ extension -> getManifest ( ) -> getDependencies ( ) as $ requiredExt => $ requiredVersion ) { $ installedVersion = $ extensionManager -> getInstalledVers...
Check if extension requirements are met Always returns true but throws exception on error
49,368
public static function retrieveIncludedRoles ( core_kernel_classes_Resource $ role ) { $ returnValue = array ( ) ; try { $ serial = self :: buildIncludedRolesSerial ( $ role ) ; $ fromCache = ServiceManager :: getServiceManager ( ) -> get ( 'generis/cache' ) -> get ( $ serial ) ; foreach ( $ fromCache as $ uri ) { $ re...
Retrieve roles included in a given Generis Role from the Cache memory .
49,369
public static function cacheIncludedRoles ( core_kernel_classes_Resource $ role , $ includedRoles ) { $ toCache = array ( ) ; foreach ( $ includedRoles as $ resource ) { $ toCache [ ] = $ resource -> getUri ( ) ; } $ serial = self :: buildIncludedRolesSerial ( $ role ) ; $ cache = ServiceManager :: getServiceManager ( ...
Put roles included in a Generis Role in the Cache memory .
49,370
public static function removeIncludedRoles ( core_kernel_classes_Resource $ role ) { $ serial = self :: buildIncludedRolesSerial ( $ role ) ; ServiceManager :: getServiceManager ( ) -> get ( 'generis/cache' ) -> remove ( $ serial ) ; ; return true ; }
Remove roles included in a Generis Role from the Cache memory .
49,371
public static function areIncludedRolesInCache ( core_kernel_classes_Resource $ role ) { $ serial = self :: buildIncludedRolesSerial ( $ role ) ; return ServiceManager :: getServiceManager ( ) -> get ( 'generis/cache' ) -> has ( $ serial ) ; }
Returns true if the roles included in a given Generis Role are in the memory .
49,372
public static function login ( $ userLogin , $ userPassword ) { try { $ user = self :: authenticate ( $ userLogin , $ userPassword ) ; $ loggedIn = self :: startSession ( $ user ) ; } catch ( common_user_auth_AuthFailedException $ e ) { $ loggedIn = false ; } return $ loggedIn ; }
Login a user using login password
49,373
public static function startSession ( common_user_User $ user ) { $ session = new common_session_DefaultSession ( $ user ) ; common_session_SessionManager :: startSession ( $ session ) ; return true ; }
Start a session for a provided user
49,374
public function getLogicalOperator ( ) { $ returnValue = null ; if ( empty ( $ this -> logicalOperator ) ) { $ property = new core_kernel_classes_Property ( RulesRdf :: PROPERTY_HASLOGICALOPERATOR ) ; $ this -> logicalOperator = $ this -> getUniquePropertyValue ( $ property ) ; } $ returnValue = $ this -> logicalOperat...
Short description of method getLogicalOperator
49,375
public function getTerminalExpression ( ) { $ returnValue = null ; $ property = new core_kernel_classes_Property ( RulesRdf :: PROPERTY_TERMINAL_EXPRESSION ) ; $ propertyValue = $ this -> getUniquePropertyValue ( $ property ) ; if ( $ propertyValue instanceof core_kernel_classes_Resource ) { $ returnValue = new core_ke...
Short description of method getTerminalExpression
49,376
public function getFirstExpression ( ) { $ returnValue = null ; if ( empty ( $ this -> firstExpression ) ) { $ property = new core_kernel_classes_Property ( RulesRdf :: PROPERTY_FIRST_EXPRESSION ) ; $ this -> firstExpression = new core_kernel_rules_Expression ( $ this -> getUniquePropertyValue ( $ property ) -> getUri ...
Short description of method getFirstExpression
49,377
public function getSecondExpression ( ) { $ returnValue = null ; if ( empty ( $ this -> secondExpression ) ) { $ property = new core_kernel_classes_Property ( RulesRdf :: PROPERTY_SECOND_EXPRESSION ) ; $ this -> secondExpression = new core_kernel_rules_Expression ( $ this -> getUniquePropertyValue ( $ property ) -> get...
Short description of method getSecondExpression
49,378
public function evalEquals ( core_kernel_classes_Literal $ first , core_kernel_classes_Literal $ second ) { $ returnValue = ( bool ) false ; if ( $ first instanceof core_kernel_classes_Literal && $ second instanceof core_kernel_classes_Literal ) { $ returnValue = $ first -> literal == $ second -> literal ; } return ( b...
Short description of method evalEquals
49,379
public function evalDifferent ( core_kernel_classes_Literal $ first , core_kernel_classes_Literal $ second ) { $ returnValue = ( bool ) false ; if ( $ first instanceof core_kernel_classes_Literal && $ second instanceof core_kernel_classes_Literal ) { $ returnValue = $ first -> literal != $ second -> literal ; } return ...
Short description of method evalDifferent
49,380
public function evalInfEquals ( core_kernel_classes_Literal $ first , core_kernel_classes_Literal $ second ) { $ returnValue = ( bool ) false ; if ( $ first instanceof core_kernel_classes_Literal && $ second instanceof core_kernel_classes_Literal ) { $ returnValue = $ first -> literal <= $ second -> literal ; } return ...
Short description of method evalInfEquals
49,381
public function evalInf ( core_kernel_classes_Literal $ first , core_kernel_classes_Literal $ second ) { $ returnValue = ( bool ) false ; if ( $ first instanceof core_kernel_classes_Literal && $ second instanceof core_kernel_classes_Literal ) { $ returnValue = $ first -> literal < $ second -> literal ; } return ( bool ...
Short description of method evalInf
49,382
public function evalSup ( core_kernel_classes_Literal $ first , core_kernel_classes_Literal $ second ) { $ returnValue = ( bool ) false ; if ( $ first instanceof core_kernel_classes_Literal && $ second instanceof core_kernel_classes_Literal ) { $ returnValue = $ first -> literal > $ second -> literal ; } return ( bool ...
Short description of method evalSup
49,383
public function evalSupEquals ( core_kernel_classes_Literal $ first , core_kernel_classes_Literal $ second ) { $ returnValue = ( bool ) false ; if ( $ first instanceof core_kernel_classes_Literal && $ second instanceof core_kernel_classes_Literal ) { $ returnValue = $ first -> literal >= $ second -> literal ; } return ...
Short description of method evalSupEquals
49,384
public function operatorEval ( core_kernel_classes_Container $ firstPart , core_kernel_classes_Container $ secondPart ) { $ returnValue = ( bool ) false ; if ( $ firstPart instanceof core_kernel_classes_Resource ) { $ firstPart = new core_kernel_classes_Literal ( $ firstPart -> getUri ( ) ) ; } if ( $ secondPart instan...
Short description of method operatorEval
49,385
public function getFirstOperation ( ) { $ returnValue = null ; if ( empty ( $ this -> firstOperation ) ) { $ property = new core_kernel_classes_Property ( RulesRdf :: PROPERTY_OPERATION_FIRST_OP ) ; $ resource = $ this -> getUniquePropertyValue ( $ property ) ; $ this -> firstOperation = new core_kernel_rules_Term ( $ ...
Short description of method getFirstOperation
49,386
public function getSecondOperation ( ) { $ returnValue = null ; if ( empty ( $ this -> secondOperation ) ) { $ property = new core_kernel_classes_Property ( RulesRdf :: PROPERTY_OPERATION_SECOND_OP ) ; $ resource = $ this -> getUniquePropertyValue ( $ property ) ; $ this -> secondOperation = new core_kernel_rules_Term ...
Short description of method getSecondOperation
49,387
public function getOperator ( ) { $ returnValue = null ; if ( empty ( $ this -> arithmeticOperator ) ) { $ property = new core_kernel_classes_Property ( RulesRdf :: PROPERTY_OPERATION_OPERATOR ) ; $ this -> arithmeticOperator = $ this -> getUniquePropertyValue ( $ property ) ; } $ returnValue = $ this -> arithmeticOper...
Short description of method getOperator
49,388
public function evaluateRecursiveOperation ( core_kernel_classes_Literal $ first , core_kernel_classes_Literal $ second , core_kernel_classes_Resource $ operator ) { switch ( $ operator -> getUri ( ) ) { case RulesRdf :: INSTANCE_OPERATOR_ADD : { $ returnValue = new core_kernel_classes_Literal ( $ first -> literal + $ ...
Short description of method evaluateRecursiveOperation
49,389
public function uninstall ( ) { common_Logger :: i ( 'Uninstalling ' . $ this -> extension -> getId ( ) , 'UNINSTALL' ) ; if ( is_null ( $ this -> extension -> getManifest ( ) -> getUninstallData ( ) ) ) { throw new common_Exception ( 'Problem uninstalling extension ' . $ this -> extension -> getId ( ) . ' : Uninstall ...
uninstall an extension
49,390
protected function uninstallScripts ( ) { $ data = $ this -> extension -> getManifest ( ) -> getUninstallData ( ) ; if ( ! is_null ( $ data ) && isset ( $ data [ 'php' ] ) && is_array ( $ data [ 'php' ] ) ) { foreach ( $ data [ 'php' ] as $ script ) { $ this -> runExtensionScript ( $ script ) ; } } }
Executes uninstall scripts specified in the Manifest
49,391
public function addAppender ( common_log_Appender $ appender ) { $ this -> appenders [ ] = $ appender ; if ( is_null ( $ this -> minLevel ) || $ this -> minLevel > $ appender -> getLogThreshold ( ) ) { $ this -> minLevel = $ appender -> getLogThreshold ( ) ; } }
Short description of method addAppender
49,392
public function get ( $ serviceKey ) { $ serviceId = $ this -> getServiceId ( $ serviceKey ) ; if ( ! isset ( $ this -> services [ $ serviceId ] ) ) { $ this -> services [ $ serviceId ] = $ this -> load ( $ serviceId , $ serviceKey ) ; } return $ this -> services [ $ serviceId ] ; }
Returns the service configured for the serviceKey or throws a ServiceNotFoundException
49,393
private function getServiceId ( $ serviceKey ) { return ( ( interface_exists ( $ serviceKey ) || class_exists ( $ serviceKey ) ) && defined ( $ serviceKey . '::SERVICE_ID' ) ) ? $ serviceKey :: SERVICE_ID : ( string ) $ serviceKey ; }
Extract the service id from the provided parameter
49,394
private function load ( $ serviceId , $ serviceKey ) { $ service = $ this -> getConfig ( ) -> get ( $ serviceId ) ; if ( $ service === false ) { $ service = $ this -> tryAutowiring ( $ serviceId , $ serviceKey ) ; } if ( is_object ( $ service ) && ( $ service instanceof ServiceLocatorAwareInterface ) ) { $ service -> s...
Loads the service referenced by id
49,395
private function tryAutowiring ( $ serviceId , $ serviceKey ) { if ( ! class_exists ( $ serviceKey ) || ! is_subclass_of ( $ serviceKey , ConfigurableService :: class ) ) { throw new ServiceNotFoundException ( $ serviceId ) ; } return new $ serviceKey ( ) ; }
Try to initialize the class without parameters
49,396
public function register ( $ serviceKey , ConfigurableService $ service ) { $ parts = explode ( '/' , $ serviceKey , 2 ) ; if ( count ( $ parts ) < 2 ) { throw new \ common_Exception ( 'Invalid servicekey ' . $ serviceKey ) ; } $ this -> propagate ( $ service ) ; $ this -> services [ $ serviceKey ] = $ service ; $ succ...
Registers a service overwritting a potentially already existing service . 3
49,397
public function build ( $ className , array $ options = [ ] ) { if ( is_a ( $ className , Configurable :: class , true ) ) { $ service = new $ className ( $ options ) ; $ this -> propagate ( $ service ) ; return $ service ; } throw new ServiceNotFoundException ( $ className ) ; }
Service or sub - service factory
49,398
private static function secondsToDuration ( $ seconds ) { $ seconds = intval ( $ seconds ) ; $ hours = floor ( $ seconds / 3600 ) ; $ minutes = floor ( ( $ seconds / 60 ) % 60 ) ; $ seconds = $ seconds % 60 ; return "${hours}h ${minutes}m {$seconds}s" ; }
Seconds to Duration
49,399
public function isClass ( ) { $ returnValue = ( bool ) false ; if ( count ( $ this -> getPropertyValues ( $ this -> getProperty ( OntologyRdfs :: RDFS_SUBCLASSOF ) ) ) > 0 ) { $ returnValue = true ; } else { foreach ( $ this -> getTypes ( ) as $ type ) { if ( $ type -> getUri ( ) == OntologyRdfs :: RDFS_CLASS ) { $ ret...
returns true if the resource is a valid class ( using facts or entailment