idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
49,200 | public function getDomain ( ) { $ returnValue = null ; if ( is_null ( $ this -> domain ) ) { $ this -> domain = new core_kernel_classes_ContainerCollection ( new common_Object ( __METHOD__ ) ) ; $ domainValues = $ this -> getPropertyValues ( $ this -> getProperty ( OntologyRdfs :: RDFS_DOMAIN ) ) ; foreach ( $ domainVa... | return classes that are described by this property |
49,201 | public function setDomain ( core_kernel_classes_Class $ class ) { $ returnValue = ( bool ) false ; if ( ! is_null ( $ class ) ) { foreach ( $ this -> getDomain ( ) -> getIterator ( ) as $ domainClass ) { if ( $ class -> equals ( $ domainClass ) ) { $ returnValue = true ; break ; } } if ( ! $ returnValue ) { $ this -> s... | Short description of method setDomain |
49,202 | public function getRange ( ) { $ returnValue = null ; if ( is_null ( $ this -> range ) ) { $ rangeProperty = $ this -> getProperty ( OntologyRdfs :: RDFS_RANGE ) ; $ rangeValues = $ this -> getPropertyValues ( $ rangeProperty ) ; if ( sizeOf ( $ rangeValues ) > 0 ) { $ returnValue = $ this -> getClass ( $ rangeValues [... | Short description of method getRange |
49,203 | public function getWidget ( ) { if ( $ this -> widget === false ) { $ this -> widget = $ this -> getOnePropertyValue ( $ this -> getProperty ( WidgetRdf :: PROPERTY_WIDGET ) ) ; } return $ this -> widget ; } | Get the Property object corresponding to the widget of this Property . |
49,204 | public function isLgDependent ( ) { if ( is_null ( $ this -> lgDependent ) ) { $ this -> lgDependent = $ this -> getImplementation ( ) -> isLgDependent ( $ this ) ; } return ( bool ) $ this -> lgDependent ; } | Is the property translatable? |
49,205 | public function setLgDependent ( $ isLgDependent ) { $ this -> getImplementation ( ) -> setLgDependent ( $ this , $ isLgDependent ) ; $ this -> lgDependent = $ isLgDependent ; } | Set mannually if a property can be translated |
49,206 | public function isMultiple ( ) { $ returnValue = ( bool ) false ; if ( is_null ( $ this -> multiple ) ) { $ multipleProperty = $ this -> getProperty ( GenerisRdf :: PROPERTY_MULTIPLE ) ; $ multiple = $ this -> getOnePropertyValue ( $ multipleProperty ) ; if ( is_null ( $ multiple ) ) { $ returnValue = false ; } else { ... | Check if a property can have multiple values . |
49,207 | public function setMultiple ( $ isMultiple ) { $ this -> getImplementation ( ) -> setMultiple ( $ this , $ isMultiple ) ; $ this -> multiple = $ isMultiple ; } | Define mannualy if a property is multiple or not . Usefull on just created property . |
49,208 | protected function deleteMappedKey ( $ key , $ value = null , $ level = 0 ) { if ( is_null ( $ value ) ) { $ value = $ this -> getDriver ( ) -> get ( $ key ) ; } if ( $ level > 0 ) { $ key = $ key . self :: LEVEL_SEPARATOR . $ level ; } $ success = true ; if ( $ this -> isSplit ( $ value ) ) { $ valueParts = [ ] ; fore... | Delete a key and if the value is a map delete all mapped key recursively |
49,209 | protected function join ( $ key , $ value , $ level = 0 ) { if ( $ level > 0 ) { $ key = $ key . self :: LEVEL_SEPARATOR . $ level ; } $ valueParts = [ ] ; foreach ( $ this -> unSerializeMap ( $ value ) as $ mappedKey ) { $ mappedKey = $ this -> transformReferenceToMappedKey ( $ mappedKey ) ; $ valueParts [ $ this -> g... | Join different values referenced into a map recursively |
49,210 | protected function createMap ( $ key , $ value ) { $ splitValue = $ this -> split ( $ value ) ; $ map = [ ] ; foreach ( $ splitValue as $ index => $ part ) { $ map [ $ key . self :: MAPPED_KEY_SEPARATOR . $ index ] = $ part ; } return $ map ; } | Split a large value to an array with value size lesser than required max size Construct the array with index of value |
49,211 | protected function getMappedKeyIndex ( $ mappedKey , $ key ) { $ startSize = strlen ( $ this -> getStartMapDelimiter ( ) ) - 1 ; $ key = substr ( $ key , $ startSize , strrpos ( $ key , $ this -> getEndMapDelimiter ( ) ) - $ startSize ) ; return substr ( $ mappedKey , strlen ( $ key . self :: MAPPED_KEY_SEPARATOR ) ) ;... | Get the mapped key index of a mappedKey |
49,212 | protected function getSize ( ) { if ( ! $ this -> size ) { $ size = $ this -> getParam ( self :: MAX_VALUE_SIZE ) ; if ( $ size !== false ) { if ( ! is_int ( $ size ) ) { throw new common_Exception ( 'Persistence max value size has to be an integer' ) ; } $ this -> size = $ size - strlen ( $ this -> getMapIdentifier ( ... | Get the current maximum allowed size for a value |
49,213 | protected function getParam ( $ param ) { $ params = $ this -> getParams ( ) ; if ( ! isset ( $ params [ $ param ] ) ) { return false ; } return $ params [ $ param ] ; } | Get the requested param from current parameters otherwise throws exception |
49,214 | public function supportsFeature ( $ feature ) { switch ( $ feature ) { case self :: FEATURE_NX : return ( $ this -> getDriver ( ) instanceof common_persistence_KeyValue_Nx ) ; default : throw new common_exception_Error ( 'Unknown feature ' . $ feature ) ; } return false ; } | Test wheever or not a feature is supported |
49,215 | public function setConfig ( $ key , $ value ) { if ( ! is_object ( $ value ) || ! $ value instanceof ConfigurableService ) { $ value = new ConfigurationService ( array ( ConfigurationService :: OPTION_CONFIG => $ value ) ) ; } $ value -> setHeader ( $ this -> getConfigHeader ( $ key ) ) ; $ this -> registerService ( $ ... | sets a configuration value |
49,216 | public function getConfig ( $ key ) { if ( ! $ this -> getServiceLocator ( ) -> has ( $ this -> getId ( ) . '/' . $ key ) ) { return false ; } try { $ config = $ this -> getServiceLocator ( ) -> get ( $ this -> getId ( ) . '/' . $ key ) ; if ( $ config instanceof ConfigurationService ) { $ config = $ config -> getConfi... | retrieves a configuration value returns false if not found |
49,217 | public function getConstant ( $ key ) { $ returnValue = null ; $ constants = $ this -> getConstants ( ) ; if ( isset ( $ constants [ $ key ] ) ) { $ returnValue = $ constants [ $ key ] ; } elseif ( defined ( $ key ) ) { common_logger :: w ( 'constant outside of extension called: ' . $ key ) ; $ returnValue = constant (... | Retrieves a constant from the manifest . php file of the extension . |
49,218 | public function getAllModules ( ) { $ returnValue = array ( ) ; $ namespaces = array ( ) ; foreach ( $ this -> getManifest ( ) -> getRoutes ( ) as $ mapedPath => $ ns ) { $ namespaces [ ] = trim ( $ ns , '\\' ) ; } if ( ! empty ( $ namespaces ) ) { common_Logger :: d ( 'Namespace not empty for extension ' . $ this -> g... | get all modules of the extension by searching the actions directory not the ontology |
49,219 | public function getModule ( $ id ) { $ returnValue = null ; $ className = $ this -> getId ( ) . '_actions_' . $ id ; if ( class_exists ( $ className ) ) { $ returnValue = new $ className ; } else { common_Logger :: e ( 'could not load ' . $ className ) ; } return $ returnValue ; } | returns a module by ID |
49,220 | public function getDependencies ( ) { if ( empty ( $ this -> dependencies ) ) { foreach ( $ this -> getManifest ( ) -> getDependencies ( ) as $ id => $ version ) { $ this -> dependencies [ $ id ] = $ version ; $ dependence = $ this -> getExtensionManager ( ) -> getExtensionById ( $ id ) ; $ this -> dependencies = array... | Returns the extension the current extension depends on recursively |
49,221 | public function getManifest ( ) { if ( ! $ this -> manifest ) { $ manifestFile = $ this -> getDir ( ) . self :: MANIFEST_NAME ; if ( is_file ( $ manifestFile ) && is_readable ( $ manifestFile ) ) { $ this -> manifest = new common_ext_Manifest ( $ manifestFile ) ; } else { throw new common_ext_ManifestNotFoundException ... | Returns the manifest of the extension |
49,222 | protected function getExtensionManager ( ) { if ( $ this -> getServiceLocator ( ) -> has ( common_ext_ExtensionsManager :: SERVICE_ID ) ) { $ service = $ this -> getServiceLocator ( ) -> get ( common_ext_ExtensionsManager :: SERVICE_ID ) ; } else { $ service = new common_ext_ExtensionsManager ( ) ; $ this -> getService... | Get the ExtensionManager service |
49,223 | public function getConfigHeader ( $ key ) { $ path = $ this -> getDir ( ) . 'config/header/' . $ key . '.conf.php' ; if ( is_readable ( $ path ) && is_file ( $ path ) ) { return file_get_contents ( $ path ) ; } return null ; } | Get the documentation header for extension config located at key path |
49,224 | protected function getOutputRecord ( array $ record ) { $ output = [ static :: DATETIME_OFFSET => $ record [ 'datetime' ] -> format ( static :: DATETIME_FORMAT ) , static :: SEVERITY_OFFSET => $ record [ 'level_name' ] , static :: CONTENT_OFFSET => $ record [ 'message' ] , ] ; if ( isset ( $ record [ 'context' ] [ 'fil... | Returns the customized record . |
49,225 | public function logIn ( $ login , $ password , $ module , $ role ) { $ returnValue = ( bool ) false ; if ( $ role === true ) { $ role = new core_kernel_classes_Resource ( TaoOntology :: PROPERTY_INSTANCE_ROLE_GLOBALMANAGER ) ; } core_kernel_users_Service :: singleton ( ) -> login ( $ login , $ password , $ role ) ; ret... | Short description of method logIn |
49,226 | public function addLogger ( LoggerInterface $ logger ) { if ( $ this -> isLoggerLoaded ( ) && ! ( $ this -> logger instanceof NullLogger ) ) { $ logger = new LoggerAggregator ( [ $ logger , $ this -> logger ] ) ; } $ this -> logger = $ logger ; return $ logger ; } | Add a Psr3 logger to LoggerService instance Previous and new logger are encapsulated into a LoggerAggregator |
49,227 | protected function loadLogger ( ) { $ logger = null ; if ( $ this -> hasOption ( self :: LOGGER_OPTION ) ) { $ loggerOptions = $ this -> getOption ( self :: LOGGER_OPTION ) ; if ( is_object ( $ loggerOptions ) ) { if ( is_a ( $ loggerOptions , LoggerInterface :: class ) ) { $ logger = $ loggerOptions ; } } elseif ( is_... | Load the logger from configuration |
49,228 | public function remove ( ) { $ returnValue = ( bool ) false ; $ db = core_kernel_classes_DbWrapper :: singleton ( ) ; if ( false === $ db -> exec ( "DELETE FROM statements WHERE modelid = ?" , array ( $ this -> getModelId ( ) ) ) ) { $ returnValue = false ; } else { if ( false === $ db -> exec ( "DELETE FROM models WHE... | Remove a namespace from the ontology . All triples bound to the model will be removed . |
49,229 | public static function getFileUploadLimit ( ) { $ max_upload = self :: toBytes ( ini_get ( 'upload_max_filesize' ) ) ; $ max_post = self :: toBytes ( ini_get ( 'post_max_size' ) ) ; $ memory_limit = self :: toBytes ( ini_get ( 'memory_limit' ) ) ; $ returnValue = min ( $ max_upload , $ max_post , $ memory_limit ) ; ret... | Returns the maximum size for fileuploads in bytes . |
49,230 | private static function toBytes ( $ phpSyntax ) { $ val = trim ( $ phpSyntax ) ; $ last = strtolower ( $ val [ strlen ( $ val ) - 1 ] ) ; if ( ! is_numeric ( $ last ) ) { $ val = substr ( $ val , 0 , - 1 ) ; switch ( $ last ) { case 'g' : $ val *= 1024 ; case 'm' : $ val *= 1024 ; case 'k' : $ val *= 1024 ; } } return ... | Get the size in bytes of a PHP variable given as a string . |
49,231 | public static function getCached ( $ function ) { $ returnValue = null ; $ args = func_get_args ( ) ; array_shift ( $ args ) ; if ( ! is_string ( $ function ) ) { $ r = new ReflectionFunction ( $ function ) ; $ serial = md5 ( $ r -> getFileName ( ) . $ r -> getStartLine ( ) . serialize ( $ args ) ) ; } else { $ serial ... | Short description of method getCached |
49,232 | private function getDispatcher ( ) { if ( is_null ( $ this -> dispatcher ) ) { $ this -> dispatcher = new \ common_log_Dispatcher ( $ this -> getOption ( self :: OPTION_APPENDERS ) ) ; } return $ this -> dispatcher ; } | Returns the dispatcher |
49,233 | static public function getClassInfo ( $ file ) { $ buffer = file_get_contents ( $ file ) ; $ tokens = @ token_get_all ( $ buffer ) ; $ class = $ namespace = $ buffer = '' ; for ( $ i = 0 ; $ i < count ( $ tokens ) ; $ i ++ ) { if ( $ tokens [ $ i ] [ 0 ] === T_NAMESPACE ) { for ( $ j = $ i + 1 ; $ j < count ( $ tokens ... | Returns an array that contains namespace and name of the class defined in the file |
49,234 | public function load ( ) { if ( $ this -> extension -> getId ( ) != "generis" ) { foreach ( $ this -> extension -> getConstants ( ) as $ key => $ value ) { if ( ! defined ( $ key ) && ! is_array ( $ value ) ) { define ( $ key , $ value ) ; } } } } | Load the extension . |
49,235 | public static function restore ( array $ data ) { if ( ! isset ( $ data [ 'invocable' ] , $ data [ 'params' ] ) ) { return null ; } $ class = self :: class ; $ task = new $ class ( ) ; if ( isset ( $ data [ 'report' ] ) ) { $ task -> setReport ( $ data [ 'report' ] ) ; } if ( isset ( $ data [ 'status' ] ) ) { $ task ->... | Restore a task |
49,236 | private function writeFile ( $ id , $ value , $ preWriteValueProcessor = null ) { $ filePath = $ this -> getPath ( $ id ) ; $ dirname = dirname ( $ filePath ) ; if ( ! file_exists ( $ dirname ) ) { mkdir ( $ dirname , self :: DEFAULT_MASK , true ) ; } if ( false !== ( $ fp = @ fopen ( $ filePath , 'c' ) ) && true === f... | Writes the file . |
49,237 | private function getIncreasedValueEntry ( $ id ) { $ value = intval ( $ this -> get ( $ id ) ) ; $ value ++ ; if ( $ this -> isTtlMode ( ) ) { $ value = [ static :: ENTRY_VALUE => $ value , static :: ENTRY_EXPIRATION => null , ] ; } return $ value ; } | Returns the increased value entry . |
49,238 | public function purge ( ) { if ( file_exists ( $ this -> directory ) ) { $ files = $ this -> getCachedFiles ( ) ; $ successDeleted = true ; foreach ( $ files as $ file ) { $ successDeleted &= $ this -> removeCacheFile ( $ file ) ; } return ( bool ) $ successDeleted ; } return false ; } | purge the persistence directory |
49,239 | protected function getPath ( $ key ) { if ( $ this -> humanReadable ) { $ path = $ this -> sanitizeReadableFileName ( $ key ) ; } else { $ encoded = hash ( 'md5' , $ key ) ; $ path = implode ( DIRECTORY_SEPARATOR , str_split ( substr ( $ encoded , 0 , $ this -> levels ) ) ) . DIRECTORY_SEPARATOR . $ encoded ; } return ... | Map the provided key to a relativ path |
49,240 | protected function getContent ( $ key , $ value ) { return $ this -> humanReadable ? "<?php return " . common_Utils :: toHumanReadablePhpString ( $ value ) . ";" . PHP_EOL : "<?php return " . common_Utils :: toPHPVariableString ( $ value ) . ";" ; } | Generate the php code that returns the provided value |
49,241 | public static function getPsrLevelFromCommon ( $ level ) { if ( empty ( self :: $ reverseMap [ $ level ] ) ) { throw new Exception ( 'Invalid error level in PSR to Common level conversion: ' . $ level ) ; } return self :: $ reverseMap [ $ level ] ; } | Returns the PSR log level based on the common log level . |
49,242 | private function getDefaultHeader ( $ key ) { return '<?php' . PHP_EOL . '/**' . PHP_EOL . ' * Default config header' . PHP_EOL . ' *' . PHP_EOL . ' * To replace this add a file ' . $ this -> getHeaderPath ( $ key ) . PHP_EOL . ' */' . PHP_EOL ; } | Generates a default header |
49,243 | private function getHeaderPath ( $ key ) { $ parts = explode ( '/' , $ key , 2 ) ; if ( count ( $ parts ) >= 2 ) { list ( $ extId , $ configId ) = $ parts ; $ ext = common_ext_ExtensionsManager :: singleton ( ) -> getExtensionById ( $ extId ) ; return $ ext -> getDir ( ) . 'config/header/' . $ configId . '.conf.php' ; ... | Returns the path to the expected header file |
49,244 | public function isLgDependent ( core_kernel_classes_Resource $ resource ) { if ( $ this -> getModel ( ) -> getCache ( ) -> has ( $ resource -> getUri ( ) ) ) { $ lgDependent = $ this -> getModel ( ) -> getCache ( ) -> get ( $ resource -> getUri ( ) ) ; } else { $ lgDependentProperty = new \ core_kernel_classes_Property... | Short description of method isLgDependent |
49,245 | public function isMultiple ( core_kernel_classes_Resource $ resource ) { $ returnValue = ( bool ) false ; throw new core_kernel_persistence_ProhibitedFunctionException ( "not implemented => The function (" . __METHOD__ . ") is not available in this persistence implementation (" . __CLASS__ . ")" ) ; return ( bool ) $ r... | Short description of method isMultiple |
49,246 | public function setMultiple ( core_kernel_classes_Resource $ resource , $ isMultiple ) { $ multipleProperty = new core_kernel_classes_Property ( GenerisRdf :: PROPERTY_MULTIPLE ) ; $ value = ( ( bool ) $ isMultiple ) ? GenerisRdf :: GENERIS_TRUE : GenerisRdf :: GENERIS_FALSE ; $ this -> removePropertyValues ( $ resourc... | Short description of method setMultiple |
49,247 | public function setLgDependent ( core_kernel_classes_Resource $ resource , $ isLgDependent ) { $ lgDependentProperty = new core_kernel_classes_Property ( GenerisRdf :: PROPERTY_IS_LG_DEPENDENT , __METHOD__ ) ; $ value = ( ( bool ) $ isLgDependent ) ? GenerisRdf :: GENERIS_TRUE : GenerisRdf :: GENERIS_FALSE ; $ this -> ... | Short description of method setLgDependent |
49,248 | public function updateTaskStatus ( $ taskId , $ status ) { if ( $ this -> getPersistence ( ) -> has ( $ taskId ) ) { $ this -> getPersistence ( ) -> update ( $ taskId , $ status ) ; } return $ this ; } | change task status using task persistence |
49,249 | public function updateTaskReport ( $ taskId , $ report ) { if ( $ this -> getPersistence ( ) -> has ( $ taskId ) ) { $ this -> getPersistence ( ) -> setReport ( $ taskId , $ report ) ; } return $ this ; } | set task report using task persistence |
49,250 | public function getPayload ( $ currentUserId = null ) { $ class = $ this -> getOption ( 'payload' ) ; if ( ! is_a ( $ class , TaskPayLoad :: class , true ) ) { throw new BadTaskQueueOption ( 'task payload must implement ' . TaskPayLoad :: class ) ; } $ payload = new $ class ( $ this -> getPersistence ( ) , $ currentUse... | return a new instance of payload |
49,251 | public function union ( common_Collection $ collection ) { $ returnValue = null ; $ returnValue = new core_kernel_classes_ContainerCollection ( $ this ) ; $ returnValue -> sequence = array_merge ( $ this -> sequence , $ collection -> sequence ) ; return $ returnValue ; } | Short description of method union |
49,252 | public function intersect ( common_Collection $ collection ) { $ returnValue = null ; $ returnValue = new core_kernel_classes_ContainerCollection ( new common_Object ( __METHOD__ ) ) ; $ returnValue -> sequence = array_uintersect ( $ this -> sequence , $ collection -> sequence , 'core_kernel_classes_ContainerComparator... | Short description of method intersect |
49,253 | public function indexOf ( common_Object $ resource ) { $ returnValue = null ; $ returnValue = - 1 ; foreach ( $ this -> sequence as $ index => $ _resource ) { if ( $ _resource instanceof core_kernel_classes_Resource ) { if ( $ resource -> equals ( $ _resource ) ) { return $ index ; } } } return $ returnValue ; } | Short description of method indexOf |
49,254 | public static function getSession ( ) { if ( is_null ( self :: $ session ) ) { if ( PHPSession :: singleton ( ) -> hasAttribute ( self :: PHPSESSION_SESSION_KEY ) ) { $ session = PHPSession :: singleton ( ) -> getAttribute ( self :: PHPSESSION_SESSION_KEY ) ; if ( ! $ session instanceof common_session_Session ) { throw... | Retrurns the current session |
49,255 | public static function startSession ( common_session_Session $ session ) { self :: $ session = $ session ; if ( PHP_SAPI != 'cli' ) { if ( $ session instanceof common_session_StatefulSession ) { if ( session_id ( ) === '' ) { session_name ( GENERIS_SESSION_NAME ) ; session_start ( ) ; } else { session_regenerate_id ( )... | Starts a new session and stores it in the session if stateful |
49,256 | public function createTask ( $ action , $ parameters , $ recall = false , $ label = null , $ type = null ) { if ( $ recall ) { \ common_Logger :: w ( "Repeated call of action'; Execution canceled." ) ; return false ; } $ task = new SyncTask ( $ action , $ parameters ) ; $ task -> setLabel ( $ label ) ; $ task -> setTyp... | Create and run task |
49,257 | public function getServiceManager ( ) { $ serviceManager = $ this -> getServiceLocator ( ) ; if ( $ serviceManager instanceof ServiceManager ) { return $ serviceManager ; } $ msg = is_null ( $ serviceManager ) ? 'ServiceLocator not initialized for ' . get_class ( $ this ) : 'Alternate service locator not compatible wit... | Get the oat service manager . |
49,258 | public function registerService ( $ serviceKey , ConfigurableService $ service , $ allowOverride = true ) { if ( $ allowOverride || ! $ this -> getServiceLocator ( ) -> has ( $ serviceKey ) ) { $ this -> getServiceManager ( ) -> register ( $ serviceKey , $ service ) ; } } | Register a service through ServiceManager |
49,259 | public function trigger ( $ event , $ params = array ( ) ) { $ eventObject = is_object ( $ event ) ? $ event : new GenericEvent ( $ event , $ params ) ; foreach ( $ this -> getListeners ( $ eventObject ) as $ callback ) { if ( is_array ( $ callback ) && count ( $ callback ) == 2 ) { list ( $ key , $ function ) = $ call... | Dispatch an event and trigger its listeners |
49,260 | public function attach ( $ event , $ callback ) { $ events = is_array ( $ event ) ? $ event : array ( $ event ) ; $ listeners = $ this -> getOption ( self :: OPTION_LISTENERS ) ; foreach ( $ events as $ event ) { $ eventObject = is_object ( $ event ) ? $ event : new GenericEvent ( $ event ) ; if ( ! isset ( $ listeners... | Attach a Listener to one or multiple events |
49,261 | protected function removeListener ( array $ listeners , $ eventObject , $ callback ) { if ( isset ( $ listeners [ $ eventObject -> getName ( ) ] ) ) { if ( ( $ index = array_search ( $ callback , $ listeners [ $ eventObject -> getName ( ) ] ) ) !== false ) { unset ( $ listeners [ $ eventObject -> getName ( ) ] [ $ inde... | remove listener from an event and delete event if it dosn t have any listeners |
49,262 | public function detach ( $ event , $ callback ) { $ events = is_array ( $ event ) ? $ event : array ( $ event ) ; $ listeners = $ this -> getOption ( self :: OPTION_LISTENERS ) ; foreach ( $ events as $ event ) { $ eventObject = is_object ( $ event ) ? $ event : new GenericEvent ( $ event ) ; $ listeners = $ this -> re... | Detach a Listener from one or multiple events |
49,263 | protected function getListeners ( Event $ eventObject ) { $ listeners = $ this -> getOption ( self :: OPTION_LISTENERS ) ; return isset ( $ listeners [ $ eventObject -> getName ( ) ] ) ? $ listeners [ $ eventObject -> getName ( ) ] : array ( ) ; } | Get all Listeners listening to this kind of event |
49,264 | public function setExpectedRights ( $ expectedRights ) { if ( ! empty ( $ expectedRights ) && preg_match ( '/^r*w*x*$/' , $ expectedRights ) !== 0 ) { $ this -> expectedRights = $ expectedRights ; } else { throw new common_configuration_MalformedRightsException ( "Malformed rights. Expected format is r|rw|rwx." ) ; } } | Short description of method setExpectedRights |
49,265 | public function isEmptyDirectory ( $ location = null ) { $ returnValue = false ; if ( $ location === null ) { $ location = $ this -> getLocation ( ) ; } if ( is_readable ( $ location ) && is_dir ( $ location ) ) { $ iterator = new RecursiveDirectoryIterator ( $ location , RecursiveDirectoryIterator :: SKIP_DOTS ) ; $ r... | If directory is empty . |
49,266 | protected function runExtensionScript ( $ script , array $ arguments = [ ] ) { $ this -> log ( 'd' , 'Running custom extension script ' . $ script . ' for extension ' . $ this -> getExtension ( ) -> getId ( ) ) ; if ( file_exists ( $ script ) ) { require_once $ script ; } elseif ( class_exists ( $ script ) && is_subcla... | Run Extension Script |
49,267 | public function importXmlRdf ( $ targetNameSpace , $ fileLocation ) { $ returnValue = ( bool ) false ; if ( ! file_exists ( $ fileLocation ) || ! is_readable ( $ fileLocation ) ) { throw new common_Exception ( "Unable to load ontology : $fileLocation" ) ; } if ( ! preg_match ( "/#$/" , $ targetNameSpace ) ) { $ targetN... | import xml rdf files into the knowledge base |
49,268 | public function getMetaClasses ( ) { $ returnValue = null ; $ returnValue = new core_kernel_classes_ContainerCollection ( new core_kernel_classes_Container ( __METHOD__ ) , __METHOD__ ) ; $ classClass = new core_kernel_classes_Class ( OntologyRdfs :: RDFS_CLASS ) ; foreach ( $ classClass -> getSubClasses ( true ) as $ ... | returns metaclasses tat are not subclasses of other metaclasses |
49,269 | public function setStatement ( $ subject , $ predicate , $ object , $ language ) { $ returnValue = ( bool ) false ; $ dbWrapper = core_kernel_classes_DbWrapper :: singleton ( ) ; $ platform = $ dbWrapper -> getPlatForm ( ) ; $ localNs = common_ext_NamespaceManager :: singleton ( ) -> getLocalNamespace ( ) ; $ mask = 'y... | add a new statment to the knowledge base |
49,270 | public function getAllClasses ( ) { $ returnValue = null ; $ returnValue = new core_kernel_classes_ContainerCollection ( new core_kernel_classes_Container ( __METHOD__ ) , __METHOD__ ) ; $ dbWrapper = core_kernel_classes_DbWrapper :: singleton ( ) ; $ query = "SELECT DISTINCT subject FROM statements WHERE (predicate = ... | Short description of method getAllClasses |
49,271 | public function getSubject ( $ predicate , $ object ) { $ returnValue = null ; $ sqlQuery = "SELECT subject FROM statements WHERE predicate = ? AND object= ? " ; $ dbWrapper = core_kernel_classes_DbWrapper :: singleton ( ) ; $ sqlResult = $ dbWrapper -> query ( $ sqlQuery , array ( $ predicate , $ object ) ) ; $ return... | Short description of method getSubject |
49,272 | public function removeStatement ( $ subject , $ predicate , $ object , $ language ) { $ returnValue = ( bool ) false ; $ dbWrapper = core_kernel_classes_DbWrapper :: singleton ( ) ; $ query = "DELETE FROM statements WHERE subject = ?
AND predicate = ? AND object = ?
AND (l_language = ? OR l_langua... | Short description of method removeStatement |
49,273 | public function getObject ( $ subject , $ predicate ) { $ returnValue = null ; $ sqlQuery = "SELECT object FROM statements WHERE subject = ? AND predicate = ?" ; $ dbWrapper = core_kernel_classes_DbWrapper :: singleton ( ) ; $ sqlResult = $ dbWrapper -> query ( $ sqlQuery , array ( $ subject , $ predicate ) ) ; $ retur... | Short description of method getObject |
49,274 | public function validate ( $ password ) { $ result = true ; foreach ( $ this -> validators as $ validator ) { $ result &= $ validator -> evaluate ( $ password ) ; } return ( boolean ) $ result ; } | Test if password pass all constraints rules |
49,275 | protected function register ( $ config ) { $ this -> validators = array ( ) ; if ( array_key_exists ( 'length' , $ config ) && ( int ) $ config [ 'length' ] ) { $ this -> validators [ ] = new \ tao_helpers_form_validators_Length ( array ( 'min' => ( int ) $ config [ 'length' ] ) ) ; } if ( ( array_key_exists ( 'upper' ... | Set up all validator according configuration file |
49,276 | public function getErrors ( ) { $ errors = array ( ) ; foreach ( $ this -> validators as $ validator ) { $ errors [ ] = $ validator -> getMessage ( ) ; } return $ errors ; } | Any errors that was found during validation process |
49,277 | public function log ( common_log_Item $ item ) { if ( ( 1 << $ item -> getSeverity ( ) & $ this -> mask ) > 0 && ( empty ( $ this -> tags ) || count ( array_intersect ( $ item -> getTags ( ) , $ this -> tags ) ) ) > 0 ) { $ this -> doLog ( $ item ) ; } } | decides whenever the Item should be logged by doLog |
49,278 | public function getLogThreshold ( ) { $ returnValue = ( int ) 0 ; $ threshold = 0 ; while ( ( $ this -> mask & 1 << $ threshold ) == 0 ) { $ threshold ++ ; } $ returnValue = $ threshold ; return ( int ) $ returnValue ; } | Short description of method getLogThreshold |
49,279 | public static function createFailure ( $ message , $ errors = array ( ) ) { $ report = new static ( self :: TYPE_ERROR , $ message ) ; foreach ( $ errors as $ error ) { $ report -> add ( $ error ) ; } return $ report ; } | convenience method to create a simple failure report |
49,280 | public function getSuccesses ( $ asFlat = false ) { $ iterator = true === $ asFlat ? $ this -> getRecursiveIterator ( ) : $ this ; $ successes = array ( ) ; foreach ( $ iterator as $ element ) { if ( $ element -> getType ( ) == self :: TYPE_SUCCESS ) { $ successes [ ] = $ element ; } } return $ successes ; } | returns all success elements |
49,281 | public function getInfos ( $ asFlat = false ) { $ iterator = true === $ asFlat ? $ this -> getRecursiveIterator ( ) : $ this ; $ infos = array ( ) ; foreach ( $ iterator as $ element ) { if ( $ element -> getType ( ) == self :: TYPE_INFO ) { $ infos [ ] = $ element ; } } return $ infos ; } | returns all info elements |
49,282 | public function getErrors ( $ asFlat = false ) { $ iterator = true === $ asFlat ? $ this -> getRecursiveIterator ( ) : $ this ; $ errors = array ( ) ; foreach ( $ iterator as $ element ) { if ( $ element -> getType ( ) == self :: TYPE_ERROR ) { $ errors [ ] = $ element ; } } return $ errors ; } | returns all error elements |
49,283 | public function contains ( $ type ) { foreach ( $ this as $ child ) { if ( $ child -> getType ( ) == $ type || $ child -> contains ( $ type ) ) { return true ; } } return false ; } | Whenever or not the type can be found in the report |
49,284 | public function add ( $ mixed ) { $ mixedArray = is_array ( $ mixed ) ? $ mixed : array ( $ mixed ) ; foreach ( $ mixedArray as $ element ) { if ( $ element instanceof common_report_Report ) { $ this -> elements [ ] = $ element ; } elseif ( $ element instanceof common_exception_UserReadableException ) { $ this -> eleme... | Add something to the report |
49,285 | protected function load ( ) { if ( $ this -> resources !== null ) { return $ this -> count ( ) > 0 ; } $ this -> resources = null ; $ this -> index = 0 ; $ this -> loadResources ( ) ; return $ this -> count ( ) > 0 ; } | Load a collection of resources |
49,286 | public function addFilter ( $ column , $ operator , $ value ) { $ this -> filter -> addFilter ( $ column , $ operator , $ value ) ; return $ this ; } | Add a filter to filter the resources we should iterate over . |
49,287 | public function addTypeFilter ( $ type ) { $ this -> filter -> eq ( 'predicate' , OntologyRdf :: RDF_TYPE ) -> eq ( 'object' , $ type ) ; return $ this ; } | Add a type resource filter . |
49,288 | public static function createOperation ( core_kernel_rules_Term $ term1 , core_kernel_rules_Term $ term2 , core_kernel_classes_Resource $ operator ) { $ returnValue = null ; $ operationClass = new core_kernel_classes_Class ( RulesRdf :: CLASS_OPERATION , __METHOD__ ) ; $ label = 'Def Operation Label ' . $ term1 -> getL... | Short description of method createOperation |
49,289 | public function registerEvent ( $ event , $ callback ) { $ eventManager = $ this -> getServiceLocator ( ) -> get ( EventManager :: CONFIG_ID ) ; $ eventManager -> attach ( $ event , $ callback ) ; $ this -> getServiceManager ( ) -> register ( EventManager :: CONFIG_ID , $ eventManager ) ; } | Add a new event Listener |
49,290 | private function addStatement ( $ modelId , $ subject , $ predicate , $ object , $ lang = null ) { $ result = core_kernel_classes_DbWrapper :: singleton ( ) -> query ( 'SELECT count(*) FROM statements WHERE modelid = ? AND subject = ? AND predicate = ? AND object = ? AND l_language = ?' , array ( $ modelId , $ subject ... | Adds a statement to the ontology if it does not exist yet |
49,291 | public function isBetween ( $ minVersion , $ maxVersion ) { $ current = common_ext_ExtensionsManager :: singleton ( ) -> getInstalledVersion ( $ this -> getExtension ( ) -> getId ( ) ) ; return version_compare ( $ minVersion , $ current , '<=' ) && version_compare ( $ current , $ maxVersion , '<=' ) ; } | Please use skip instead of inBetween . |
49,292 | public function skip ( $ from , $ to ) { $ current = common_ext_ExtensionsManager :: singleton ( ) -> getInstalledVersion ( $ this -> getExtension ( ) -> getId ( ) ) ; if ( version_compare ( $ from , $ current , '<=' ) && version_compare ( $ current , $ to , '<' ) ) { $ this -> setVersion ( $ to ) ; } } | Skip from version FROM to version TO without additional required actions |
49,293 | public function safeLoadService ( $ configId ) { $ missingClasses = array ( ) ; $ fallbackAutoload = function ( $ class_name ) use ( & $ missingClasses ) { $ missingClasses [ ] = $ class_name ; $ split = strrpos ( $ class_name , '\\' ) ; if ( $ split == false ) { $ result = eval ( 'class ' . $ class_name . ' extends oa... | Loads a service in a safe way trying to convert unknown classes to abstract services |
49,294 | public static function getPasswordHash ( ) { return new helpers_PasswordHash ( defined ( 'PASSWORD_HASH_ALGORITHM' ) ? PASSWORD_HASH_ALGORITHM : self :: LEGACY_ALGORITHM , defined ( 'PASSWORD_HASH_SALT_LENGTH' ) ? PASSWORD_HASH_SALT_LENGTH : self :: LEGACY_SALT_LENGTH ) ; } | Returns the hashing algorithm defined in generis configuration |
49,295 | public function removeUser ( core_kernel_classes_Resource $ user ) { $ returnValue = ( bool ) false ; $ returnValue = $ user -> delete ( ) ; return ( bool ) $ returnValue ; } | Remove a Generis User from persistent memory . Bound roles will remain |
49,296 | public function getOneUser ( $ login , core_kernel_classes_Class $ class = null ) { $ returnValue = null ; if ( empty ( $ class ) ) { $ class = new core_kernel_classes_Class ( GenerisRdf :: CLASS_GENERIS_USER ) ; } $ users = $ class -> searchInstances ( array ( GenerisRdf :: PROPERTY_USER_LOGIN => $ login ) , array ( '... | Get a specific Generis User from the persistent memory of Generis that a specific login . If multiple users have the same login a UserException be thrown . |
49,297 | public function isPasswordValid ( $ password , core_kernel_classes_Resource $ user ) { $ returnValue = ( bool ) false ; if ( ! is_string ( $ password ) ) { throw new core_kernel_users_Exception ( 'The password must be of "string" type, got ' . gettype ( $ password ) ) ; } $ hash = $ user -> getUniquePropertyValue ( new... | used in conjunction with the callback validator to test the pasword entered |
49,298 | public function setPassword ( core_kernel_classes_Resource $ user , $ password ) { if ( ! is_string ( $ password ) ) { throw new core_kernel_users_Exception ( 'The password must be of "string" type, got ' . gettype ( $ password ) ) ; } $ user -> editPropertyValues ( new core_kernel_classes_Property ( GenerisRdf :: PROP... | Set the password of a specifc user . |
49,299 | public function getUserRoles ( core_kernel_classes_Resource $ user ) { $ returnValue = array ( ) ; $ rolesProperty = new core_kernel_classes_Property ( GenerisRdf :: PROPERTY_USER_ROLES ) ; $ rootRoles = $ user -> getPropertyValuesCollection ( $ rolesProperty ) ; foreach ( $ rootRoles -> getIterator ( ) as $ r ) { $ re... | Get the roles that a given user has . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.