idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
13,200
public function get ( $ className , array $ objectData ) { $ this -> runningProcesses ++ ; try { $ result = $ this -> convertToObject ( $ className , $ objectData ) ; $ this -> runningProcesses -- ; return $ result ; } catch ( \ Exception $ exception ) { $ this -> runningProcesses -- ; throw $ exception ; } }
Returns an instance of the given configuration object name . The object is recursively filled with the given array data .
13,201
protected function register ( $ className ) { if ( false === isset ( $ this -> configurationObjectServiceFactory [ $ className ] ) ) { if ( false === Core :: get ( ) -> classExists ( $ className ) ) { throw new ClassNotFoundException ( 'Trying to get a non-existing configuration object: "' . $ className . '".' , 144888...
Any configuration object needs to be registered before it can be used .
13,202
public function createAllDocumentTables ( ) { foreach ( $ this -> metadataFactory -> getAllMetadata ( ) as $ class ) { if ( $ class -> isMappedSuperclass || $ class -> isEmbeddedDocument || ( count ( $ class -> parentClassNames ) && $ class -> inheritanceType == ClassMetadata :: INHERITANCE_TYPE_SINGLE_TABLE ) ) { cont...
Create all the mapped document tables in the metadata factory .
13,203
public function createDocumentTableFor ( $ documentName ) { $ class = $ this -> dm -> getClassMetadata ( $ documentName ) ; if ( $ class -> isMappedSuperclass || $ class -> isEmbeddedDocument ) { throw ODMException :: cannotCreateMappedSuperclassTable ( $ documentName ) ; } $ this -> doCreateTable ( $ class -> getTable...
Checks if the DynamoDB table for a mapped class exists and if not creates it .
13,204
public function deleteAllDocumentTables ( ) { foreach ( $ this -> metadataFactory -> getAllMetadata ( ) as $ class ) { if ( $ class -> isMappedSuperclass || $ class -> isEmbeddedDocument || ( count ( $ class -> parentClassNames ) && $ class -> inheritanceType == ClassMetadata :: INHERITANCE_TYPE_SINGLE_TABLE ) ) { cont...
Delete all tables for document classes known to DynamoDM .
13,205
public function deleteDocumentTableFor ( $ documentName ) { $ class = $ this -> dm -> getClassMetadata ( $ documentName ) ; if ( $ class -> isMappedSuperclass || $ class -> isEmbeddedDocument ) { throw ODMException :: cannotDeleteMappedSuperclassTable ( $ documentName ) ; } $ this -> doDeleteTable ( $ class -> getTable...
Checks if the DynamoDB table for a mapped class exists and deletes it if it does .
13,206
public function rebuildDocumentTableFor ( $ documentName ) { $ class = $ this -> dm -> getClassMetadata ( $ documentName ) ; $ table = $ class -> getTableName ( ) ; $ defintiion = $ class -> getDefinitionTable ( ) ; $ this -> doDeleteTable ( $ table , $ defintiion ) ; $ this -> doCreateTable ( $ table , $ defintiion ) ...
Deletes and rebuilds the DynamoDB table for a mapped class .
13,207
private function LayoutCondition ( ) { $ sql = Access :: SqlBuilder ( ) ; $ tbl = Area :: Schema ( ) -> Table ( ) ; return $ sql -> Equals ( $ tbl -> Field ( 'Layout' ) , $ sql -> Value ( $ this -> layout -> GetID ( ) ) ) ; }
Gets the layout condition for the name validator
13,208
public function subscribe ( $ eventType , $ callback ) { $ callback = $ this -> makeEventCallback ( $ callback ) ; if ( ! isset ( $ this -> eventList [ $ eventType ] ) || ! is_array ( $ this -> eventList [ $ eventType ] ) ) { $ this -> eventList [ $ eventType ] = [ ] ; } array_push ( $ this -> eventList [ $ eventType ]...
Add a callback on a specific backend event .
13,209
public function unsubscribe ( $ eventType , $ callbackId ) { $ success = false ; if ( ! isset ( $ this -> eventList [ $ eventType ] ) || ! is_array ( $ this -> eventList [ $ eventType ] ) ) { $ this -> eventList [ $ eventType ] = array_filter ( $ this -> eventList [ $ eventType ] , function ( $ cb ) use ( $ callbackId ...
Remove callback by identifier .
13,210
public function permAssign ( $ permid , $ permvalue , $ permnegated = false , $ permskip = false ) { return $ this -> getParent ( ) -> serverGroupPermAssign ( $ this -> getId ( ) , $ permid , $ permvalue , $ permnegated , $ permskip ) ; }
Adds a set of specified permissions to the server group . Multiple permissions can be added by providing the four parameters of each permission in separate arrays .
13,211
private function getParentId ( $ item , $ key ) { if ( is_array ( $ item ) ) { $ result = $ item [ $ key ] ; } elseif ( $ item instanceof \ Praxigento \ Core \ Data ) { $ result = $ item -> get ( $ key ) ; } else { $ result = $ item ; } return $ result ; }
Get Parent ID from entry . Entry can be integer array or Data Object .
13,212
public function isLevelEnabled ( string $ level , int $ level_num = null ) { if ( $ level_num === null ) $ level_num = Logger :: getLevelNumeric ( $ level ) ; return $ level_num >= $ this -> min_level ; }
Return if a message of a specific level would be accepted
13,213
protected function getAllMetadata ( $ managerName = null ) { if ( ! $ this -> allMetadata ) { $ this -> allMetadata = $ this -> registry -> getManager ( $ managerName ) -> getMetadataFactory ( ) -> getAllMetadata ( ) ; } return $ this -> allMetadata ; }
Returns all management class metadata
13,214
private function isBaeEnv ( ) { if ( isset ( $ _SERVER [ 'HTTP_HOST' ] ) ) { $ host = $ _SERVER [ 'HTTP_HOST' ] ; $ pos = strpos ( $ host , '.' ) ; if ( $ pos !== false ) { $ substr = substr ( $ host , $ pos + 1 ) ; if ( $ substr == 'duapp.com' ) { return true ; } } } if ( isset ( $ _SERVER [ "HTTP_BAE_LOGID" ] ) ) { r...
is the environment BAE?
13,215
public function getEnvironment ( ) { $ environment_file = $ this -> resolvePath ( 'config/environment' ) ; if ( file_exists ( $ environment_file ) ) { $ environment = trim ( file_get_contents ( $ environment_file ) ) ; } else { $ environment = 'local' ; } return $ environment ; }
What environment are we running in? Local? Development? Production?
13,216
public function getBaseUrl ( $ include_script_name = false ) { $ this -> config -> load ( 'config' ) ; $ base_url = $ this -> config -> get ( 'base_url' ) ; if ( empty ( $ base_url ) ) { $ protocol = 'http://' ; if ( array_key_exists ( 'HTTPS' , $ _SERVER ) && strtolower ( $ _SERVER [ 'HTTPS' ] ) == 'on' ) { $ protocol...
Get the the base url of our app
13,217
private function determine ( ) { if ( false !== $ this -> filepath && true === is_readable ( $ this -> filepath . '/' . $ this -> filename ) ) { return strtolower ( trim ( file_get_contents ( $ this -> filepath . '/' . $ this -> filename ) ) ) ; } elseif ( null !== getenv ( $ this -> variable ) ) { return getenv ( $ th...
Dertermines the runtime environment by checking for a file or an environment variable containing the applications runtime environment name . If both checks fail it will return false .
13,218
public static function installLegacySymlinks ( Event $ event ) : void { $ options = static :: getOptions ( $ event ) ; $ consoleDir = static :: getConsoleDir ( $ event , 'install legacy symlinks' ) ; static :: executeCommand ( $ event , $ consoleDir , 'ngsite:symlink:legacy' , $ options [ 'process-timeout' ] ) ; }
Symlinks legacy siteaccesses and various other legacy files to their proper locations .
13,219
protected function createInstance ( \ ReflectionClass $ reflectedClass ) { $ constructor = $ reflectedClass -> getConstructor ( ) ; if ( $ constructor && $ constructor -> getNumberOfRequiredParameters ( ) > 0 ) { throw new \ RuntimeException ( 'Unable to hydrate an object requiring constructor param' ) ; } return $ ref...
Create an instance from a Reflected class
13,220
protected function normalize ( $ data ) { if ( null === $ data || is_scalar ( $ data ) ) { return $ data ; } if ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ val ) { $ data [ $ key ] = $ this -> normalize ( $ val ) ; } return $ data ; } throw new \ RuntimeException ( 'An unexpected value could not be normali...
Normalize php data for mongo
13,221
protected function serializeEmbeddedCollection ( MapperInterface $ mapper , array $ collection ) { $ data = array ( ) ; foreach ( $ collection as $ object ) { $ data [ ] = $ mapper -> serialize ( $ object ) ; } return $ data ; }
Serialize an embedded collection
13,222
protected function unserializeEmbeddedCollection ( MapperInterface $ mapper , array $ data ) { $ collection = array ( ) ; foreach ( $ data as $ document ) { $ collection [ ] = $ mapper -> unserialize ( $ document ) ; } return $ collection ; }
Unserialize an embedded collection
13,223
public function register ( ContainerInterface $ container ) { if ( ! isset ( $ container [ 'session' ] ) ) { $ container [ 'session' ] = function ( ContainerInterface $ container ) { return new Session ; } ; } if ( ! isset ( $ container [ 'router' ] ) ) { $ container [ 'router' ] = function ( ContainerInterface $ conta...
Register Mbh s default services .
13,224
private function AddModuleTypeOption ( Select $ select , $ type ) { if ( $ type != 'BuiltIn-Container' || ( ! Request :: GetData ( 'container' ) && Container :: Schema ( ) -> Count ( ) > 0 ) ) { $ select -> AddOption ( $ type , Trans ( $ type ) ) ; } }
Adds the module type option if allowed
13,225
public function warn ( $ msg ) { $ this -> mailMessage ( self :: LEVEL_WARN , $ msg ) ; if ( $ this -> checkLevel ( $ this -> loglevels , self :: LEVEL_WARN ) !== true ) return ; $ this -> writeMessage ( self :: LEVEL_WARN , $ msg ) ; }
Logs a warning
13,226
public function info ( $ msg ) { $ this -> mailMessage ( self :: LEVEL_INFO , $ msg ) ; if ( $ this -> checkLevel ( $ this -> loglevels , self :: LEVEL_INFO ) !== true ) return ; $ this -> writeMessage ( self :: LEVEL_INFO , $ msg ) ; }
Logs an information
13,227
public function createStringClassSnapshotHash ( ) { $ hash = null ; foreach ( $ this as $ property => $ value ) { $ hash = md5 ( $ hash . $ property . '=' . $ value ) ; } return $ hash ; }
Create hash string from current class properties and itself values . This method is good stuff for caching dynamic instances
13,228
public function getMethodRequiredArgCount ( $ class , string $ method ) : int { $ instance = new \ ReflectionMethod ( $ class , $ method ) ; $ count = 0 ; foreach ( $ instance -> getParameters ( ) as $ arg ) { if ( ! $ arg -> isOptional ( ) ) { $ count ++ ; } } return $ count ; }
Get method required arguments count
13,229
public function contains ( $ document ) { if ( ! is_object ( $ document ) ) { throw new \ InvalidArgumentException ( gettype ( $ document ) ) ; } return $ this -> unitOfWork -> isScheduledForInsert ( $ document ) || $ this -> unitOfWork -> isInIdentityMap ( $ document ) && ! $ this -> unitOfWork -> isScheduledForDelete...
Determines whether a document instance is managed in this DocumentManager .
13,230
public function getFilterCollection ( ) { if ( null === $ this -> filterCollection ) { $ this -> filterCollection = new Filter \ FilterCollection ( $ this ) ; } return $ this -> filterCollection ; }
Gets the filter collection .
13,231
public function persist ( $ document ) { if ( ! is_object ( $ document ) ) { throw new \ InvalidArgumentException ( gettype ( $ document ) ) ; } $ this -> errorIfClosed ( ) ; $ this -> unitOfWork -> persist ( $ document ) ; }
Tells the DocumentManager to make an instance managed and persistent .
13,232
public function refresh ( $ document ) { if ( ! is_object ( $ document ) ) { throw new \ InvalidArgumentException ( gettype ( $ document ) ) ; } $ this -> errorIfClosed ( ) ; $ this -> unitOfWork -> refresh ( $ document ) ; }
Refreshes the persistent state of a document from the database overriding any local changes that have not yet been persisted .
13,233
public function remove ( $ document ) { if ( ! is_object ( $ document ) ) { throw new \ InvalidArgumentException ( gettype ( $ document ) ) ; } $ this -> errorIfClosed ( ) ; $ this -> unitOfWork -> remove ( $ document ) ; }
Removes a document instance .
13,234
public function addBrick ( $ postValues ) { $ brickObject = BrickFactory :: createBrickFromPostValues ( $ postValues ) ; $ bricks = $ this -> repository -> bricks ; $ bricks [ ] = $ brickObject ; $ this -> repository -> bricks = $ bricks ; $ this -> save ( ) ; }
Add a brick
13,235
public function getBrickBySlug ( $ slug ) { $ bricks = $ this -> repository -> bricks ; foreach ( $ bricks as $ brick ) { if ( $ brick -> slug == $ slug ) { return $ brick ; } } return null ; }
Get a brick by its slug
13,236
public function saveBrick ( $ slug , $ postValues ) { $ brickObject = BrickFactory :: createBrickFromPostValues ( $ postValues ) ; $ bricks = $ this -> repository -> bricks ; foreach ( $ bricks as $ key => $ brick ) { if ( $ brick -> slug == $ slug ) { $ bricks [ $ key ] = $ brickObject ; } } $ this -> repository -> br...
Save changes to a brick
13,237
public function deleteBrickBySlug ( $ slug ) { $ bricks = $ this -> repository -> bricks ; foreach ( $ bricks as $ key => $ brickObject ) { if ( $ brickObject -> slug == $ slug ) { unset ( $ bricks [ $ key ] ) ; } } $ bricks = array_values ( $ bricks ) ; $ this -> repository -> bricks = $ bricks ; $ this -> save ( ) ; ...
Delete a brick by its slug
13,238
public static function toMap ( array $ array ) { $ map = new SimpleMap ( ) ; foreach ( $ array as $ k => $ v ) $ map -> put ( $ k , $ v ) ; return $ map ; }
Converts a PHP array into a Map .
13,239
public function skip ( int $ n ) : int { if ( $ n <= 0 ) { return 0 ; } $ skipped = 0 ; $ skipLimit = min ( self :: MAX_SKIP_BUFFER_SIZE , $ n ) ; while ( $ skipped < $ n ) { $ buf = $ this -> read ( min ( $ skipLimit , $ n - $ skipped ) ) ; if ( $ buf === null ) { break ; } $ skipped += strlen ( $ buf ) ; } return $ s...
Skips over and discards n bytes of data from this input stream .
13,240
public static function uuid ( $ version = self :: UUID_V4 ) { switch ( $ version ) { case self :: UUID_V4 : $ data = openssl_random_pseudo_bytes ( 16 ) ; $ data [ 6 ] = chr ( ord ( $ data [ 6 ] ) & 0x0f | 0x40 ) ; $ data [ 8 ] = chr ( ord ( $ data [ 8 ] ) & 0x3f | 0x80 ) ; return vsprintf ( '%s%s-%s-%s-%s-%s%s%s' , str...
Generate a uuid according to a specific UUID definition
13,241
public function toUser ( $ token = false ) { $ payload = $ this -> getPayload ( $ token ) ; if ( ! $ user = $ this -> user -> getBy ( $ this -> identifier , $ payload [ 'sub' ] ) ) { return false ; } return $ user ; }
Find a user using the user identifier in the subject claim .
13,242
public function fromUser ( $ user , array $ customClaims = [ ] ) { $ payload = $ this -> makePayload ( $ user -> { $ this -> identifier } , $ customClaims ) ; return $ this -> manager -> encode ( $ payload ) -> get ( ) ; }
Generate a token using the user identifier as the subject claim .
13,243
public function authenticate ( $ token = false ) { $ id = $ this -> getPayload ( $ token ) -> get ( 'sub' ) ; if ( ! $ this -> auth -> byId ( $ id ) ) { return false ; } return $ this -> auth -> user ( ) ; }
Authenticate a user via a token .
13,244
public function getPayload ( $ token = false ) { $ this -> requireToken ( $ token ) ; return $ this -> manager -> decode ( $ this -> token ) ; }
Get the raw Payload instance .
13,245
public function parseToken ( $ method = 'bearer' , $ header = 'authorization' , $ query = 'token' ) { if ( ! $ token = $ this -> parseAuthHeader ( $ header , $ method ) ) { if ( ! $ token = $ this -> request -> { $ query } ) { if ( ! $ token = $ this -> request -> header ( 'Token' ) ) { throw new JWTException ( 'The to...
Parse the token from the request .
13,246
protected function parseAuthHeader ( $ header = 'authorization' , $ method = 'bearer' ) { $ header = $ this -> request -> headers -> get ( $ header ) ; if ( ! starts_with ( strtolower ( $ header ) , $ method ) ) { return false ; } return trim ( str_ireplace ( $ method , '' , $ header ) ) ; }
Parse token from the authorization header .
13,247
protected function requireToken ( $ token ) { if ( $ token ) { return $ this -> setToken ( $ token ) ; } elseif ( $ this -> token ) { return $ this ; } else { throw new JWTException ( 'A token is required' , 400 ) ; } }
Ensure that a token is available .
13,248
public function add ( ProviderInterface $ provider ) { $ container = $ this -> container ; $ this -> container = $ provider -> register ( $ container ) ; $ this -> providers [ ] = ( string ) get_class ( $ provider ) ; return $ this ; }
Adds a new provider to be registered .
13,249
public function config ( $ data ) { $ items = is_array ( $ data ) ? $ data : array ( ) ; $ config = new Provider \ Configuration ( $ items ) ; if ( is_string ( $ data ) ) { $ config -> load ( $ data ) ; } $ interface = ProviderInterface :: CONFIG ; return $ this -> set ( $ interface , $ config ) ; }
Creates a new configuration based on given data .
13,250
public function emit ( ResponseInterface $ response ) { $ code = $ response -> code ( ) . ' ' . $ response -> reason ( ) ; $ headers = $ response -> headers ( ) ; $ version = $ response -> version ( ) ; foreach ( $ headers as $ name => $ values ) { header ( $ name . ': ' . implode ( ',' , $ values ) ) ; } header ( spri...
Emits the headers from the response instance .
13,251
public function handle ( RequestInterface $ request ) { $ handler = new RoutingHandler ( $ this -> container ) ; if ( ! $ this -> has ( Application :: MIDDLEWARE ) ) { return $ handler -> handle ( $ request ) ; } $ dispatcher = $ this -> get ( Application :: MIDDLEWARE ) ; return $ dispatcher -> process ( $ request , $...
Dispatches the request and returns into a response .
13,252
protected function cacheResults ( $ name , Closure $ callback ) { return Cache :: remember ( 'cache::' . $ name , $ this -> minutes , $ callback ) ; }
Cache the results .
13,253
public function getTransaction ( $ transaction = self :: TRANSACTION_LAST_USED , $ throwExceptionIfNotFound = true ) { if ( $ transaction === self :: TRANSACTIONS_ALL ) { return array_keys ( $ this -> queue ) ; } if ( $ transaction === self :: TRANSACTION_LAST_CREATED ) { if ( ! $ this -> queue ) { $ this -> newTransac...
Get a transaction name
13,254
public function removeTransaction ( $ transaction = self :: TRANSACTION_LAST_USED , $ throwExceptionIfNotFound = true ) { if ( $ transaction === self :: TRANSACTIONS_ALL ) { $ numTransactions = count ( $ this -> queue ) ; $ this -> queue = array ( ) ; $ this -> lastTransaction = null ; return $ numTransactions ; } if (...
Remove a transaction
13,255
public function send ( $ closure = null ) { if ( gettype ( $ closure ) == 'object' ) { call_user_func ( $ closure , $ this ) ; } foreach ( $ this -> viewmodels as $ type => $ view ) { if ( null !== $ view ) { $ viewmodel = new ViewModel ( $ view , false ) ; $ viewmodel -> assign ( $ this -> variables ) ; $ this -> mess...
Try to send the mail with optional callback .
13,256
public function addHeader ( $ key , $ value ) { if ( false === is_string ( $ key ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ key ) ) , E_USER_ERROR ) ; } if ( false === is_string ( $ value ) ) { return trigger_error ( sprintf ( 'Ar...
Adds a custom header to the mail
13,257
public function removeHeader ( $ key ) { if ( false === is_string ( $ key ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ key ) ) , E_USER_ERROR ) ; } if ( true === isset ( $ this -> headers [ 'custom' ] [ $ key ] ) ) { unset ( $ this ...
Removes a custom header by key
13,258
public function render ( $ htmlview = null , $ textview = null ) { if ( null !== $ htmlview && false === is_string ( $ htmlview ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ htmlview ) ) , E_USER_ERROR ) ; } if ( null !== $ textview ...
Parses the message by given an optional HTML view and an optional plain text view
13,259
public function priority ( $ level = 1 ) { if ( false === ( '-' . intval ( $ level ) == '-' . $ level ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type integer, "%s" given' , __METHOD__ , gettype ( $ level ) ) , E_USER_ERROR ) ; } if ( $ level < 1 || $ level > 5 ) { return trigger_er...
Sets the priority Level between 1 and 5
13,260
public function to ( $ email , $ name = null ) { if ( false === $ this -> validateEmail ( $ email ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be a valid email' , __METHOD__ ) , E_USER_ERROR ) ; } if ( null !== $ name && false === is_string ( $ name ) ) { return trigger_error ( sprintf ( 'Argu...
Adds to email
13,261
private function validateEmail ( $ email ) { if ( true === is_string ( $ email ) ) { return false !== filter_var ( trim ( $ email ) , \ FILTER_VALIDATE_EMAIL ) ; } return false ; }
Returns if a email is valid or not
13,262
private function emailsToString ( $ emails ) { $ format = [ ] ; foreach ( $ emails as $ email ) { if ( true === isset ( $ email -> name ) && trim ( $ email -> name ) !== '' ) { $ format [ ] = sprintf ( '"%s" <%s>' , $ email -> name , filter_var ( $ email -> email , FILTER_SANITIZE_EMAIL ) ) ; } else { $ format [ ] = fi...
Formats an array with emails to string
13,263
private function formatTo ( ) { $ to = null ; if ( true === isset ( $ this -> headers [ 'to' ] ) ) { $ to = $ this -> emailsToString ( $ this -> headers [ 'to' ] ) ; } return $ to ; }
Formats the to email and returns it
13,264
private function formatHeaders ( ) { $ headers = [ ] ; $ files = true === isset ( $ this -> headers [ 'files' ] ) ? $ this -> headers [ 'files' ] : [ ] ; foreach ( [ 'BCC' , 'CC' , 'Reply-To' , 'From' ] as $ type ) { if ( true === isset ( $ this -> headers [ strtolower ( $ type ) ] ) ) { $ headers [ ] = sprintf ( "%s: ...
Formats the headers and returns it as a string
13,265
private function formatMessage ( ) { $ message = [ ] ; $ files = true === isset ( $ this -> headers [ 'files' ] ) ? $ this -> headers [ 'files' ] : [ ] ; if ( count ( $ files ) > 0 ) { $ message [ ] = sprintf ( "--Boundary-mixed-%s\r\n" , $ this -> getBoundary ( ) ) ; $ message [ ] = sprintf ( "Content-Type: multipart/...
Formats the messages and returns it as a string
13,266
private function formatNotify ( ) { $ notify = null ; if ( true === isset ( $ this -> headers [ 'notify' ] ) ) { $ notify = $ this -> emailsToString ( $ this -> headers [ 'notify' ] ) ; if ( null === $ notify ) { if ( true === isset ( $ this -> headers [ 'from' ] ) ) { $ notify = $ this -> emailsToString ( $ this -> he...
Formats the notify email and returns it
13,267
private function getBoundary ( ) { if ( null === $ this -> boundary ) { $ this -> boundary = md5 ( date ( 'r' , time ( ) ) ) ; } return $ this -> boundary ; }
Generates if needed and returns the boundary
13,268
public function format ( ) { $ string = '' ; if ( ! empty ( $ this -> segments ) ) { $ string = implode ( $ this -> separator , $ this -> segments ) ; } return $ string ; }
Returns the path as a string
13,269
public function parse ( $ path ) { if ( is_string ( $ path ) ) { if ( substr ( $ path , 0 , 1 ) === $ this -> separator ) { $ path = substr ( $ path , 1 ) ; } $ this -> segments = explode ( $ this -> separator , $ path ) ; } else { throw new \ InvalidArgumentException ( __METHOD__ . "() expects parameter one, path, to ...
Parses the string path into this Path object
13,270
public function slice ( $ offset , $ length = null ) { if ( is_numeric ( $ offset ) && is_int ( + $ offset ) ) { if ( $ length === null || ( is_numeric ( $ length ) && is_int ( + $ length ) ) ) { $ this -> segments = array_slice ( $ this -> segments , $ offset , $ length ) ; } else { throw new \ InvalidArgumentExceptio...
Slices the path
13,271
public function array_out ( $ key = null ) { if ( count ( $ this -> output ) < 2 || ( $ key && ! isset ( $ this -> output [ $ key ] ) ) ) { return array ( ) ; } if ( $ key ) { return $ this -> output [ $ key ] ; } array_shift ( $ this -> output ) ; return $ this -> output ; }
Return output dump as array
13,272
public function out ( $ key = null ) { if ( $ this -> options [ 'mode' ] == 'Html' ) { \ alkemann \ hl \ debug \ util \ adapters \ Html :: top ( $ this -> output , $ key ) ; return ; } $ this -> __out ( $ key ) ; }
Echo out stored debugging
13,273
public function defines ( ) { $ defines = get_defined_constants ( ) ; $ ret = array ( ) ; $ offset = - 1 ; while ( $ def = array_slice ( $ defines , $ offset -- , 1 ) ) { $ key = key ( $ def ) ; $ value = current ( $ def ) ; if ( $ key == 'FIRST_APP_CONSTANT' ) break ; $ ret [ $ key ] = $ value ; } return $ ret ; }
Grab global defines will start at FIRST_APP_CONSTANT if defined
13,274
public function dump_it ( $ var ) { $ adapter = '\alkemann\hl\debug\util\adapters\\' . $ this -> options [ 'mode' ] ; if ( is_array ( $ var ) ) return $ adapter :: dump_array ( $ var , $ this ) ; elseif ( is_object ( $ var ) ) return $ adapter :: dump_object ( $ var , $ this ) ; else return $ adapter :: dump_other ( $ ...
Send a variable to the adapter and return it s formated output
13,275
public function location ( $ trace ) { $ root = substr ( $ _SERVER [ 'DOCUMENT_ROOT' ] , 0 , strlen ( static :: $ defaults [ 'docroot' ] ) * - 1 ) ; $ file = implode ( '/' , array_diff ( explode ( '/' , $ trace [ 0 ] [ 'file' ] ) , explode ( '/' , $ root ) ) ) ; $ ret = array ( 'file' => $ file , 'line' => $ trace [ 0 ...
Create an array that describes the location of the debug call
13,276
public function hasRole ( $ name ) { if ( $ this -> RoleID ) { $ role = new Role ( $ this -> RoleID ) ; if ( $ role -> RoleName == $ name ) { return true ; } } foreach ( $ this -> Roles as $ role ) { if ( $ role -> RoleName == $ name ) { return true ; } } return false ; }
Checks if user has a specific role
13,277
public function getAttributeValue ( $ document , $ attribute ) { if ( $ document instanceof Proxy && ! in_array ( $ attribute , $ this -> getIdentifierAttributeNames ( ) ) && ! $ document -> __isInitialized ( ) ) { $ document -> __load ( ) ; } return $ this -> getPropertyMetadata ( $ attribute ) -> getValue ( $ documen...
Gets the specified attribute s value off the given document .
13,278
public function getDefinitionTable ( ) { $ definition = array_merge ( $ this -> getIndex ( ) -> getDefinition ( ) , $ this -> getDefinitionSecondaryIndexes ( ) ) ; $ definition [ 'TableName' ] = $ this -> getTableName ( ) ; $ definition [ 'AttributeDefinitions' ] = $ this -> getDefinitionIndexAttributes ( ) ; return $ ...
Return the table definition for this class formatted for AWS SDK .
13,279
public function getPropertyMetadata ( $ propertyName ) { if ( ! isset ( $ this -> propertyMetadata [ $ propertyName ] ) ) { throw MappingException :: mappingNotFound ( $ this -> name , $ propertyName ) ; } return $ this -> propertyMetadata [ $ propertyName ] ; }
Gets the mapping metadata of a property .
13,280
public function getTypeOfAttribute ( $ attributeName ) { return isset ( $ this -> propertyMetadata [ $ attributeName ] ) ? $ this -> propertyMetadata [ $ attributeName ] -> type : null ; }
Returns a type name of this attribute .
13,281
public function registerAlsoLoadMethod ( $ method , $ attributes ) { $ this -> alsoLoadMethods [ $ method ] = is_array ( $ attributes ) ? $ attributes : [ $ attributes ] ; }
Registers a method for loading document data before attribute hydration .
13,282
public function setDiscriminatorAttribute ( $ discriminatorAttribute ) { if ( $ discriminatorAttribute === null ) { $ this -> discriminatorAttribute = null ; return ; } foreach ( $ this -> propertyMetadata as $ attributeMapping ) { if ( $ discriminatorAttribute === $ attributeMapping -> attributeName ) { throw MappingE...
Sets the discriminator attribute .
13,283
public function setDiscriminatorDefaultValue ( $ discriminatorDefaultValue ) { if ( $ discriminatorDefaultValue !== null && ! array_key_exists ( $ discriminatorDefaultValue , $ this -> discriminatorMap ) ) { throw MappingException :: invalidDiscriminatorValue ( $ discriminatorDefaultValue , $ this -> name ) ; } $ this ...
Sets the default discriminator value to be used for this class Used for JOINED and SINGLE_TABLE inheritance mapping strategies if the document has no discriminator value
13,284
public function setTable ( $ table ) { if ( is_array ( $ table ) ) { if ( ! isset ( $ table [ 'name' ] ) ) { throw new \ InvalidArgumentException ( 'A name key is required when passing an array to setTable()' ) ; } $ this -> table = $ table [ 'name' ] ; } else { $ this -> table = $ table ; } }
Sets the table this document is mapped to .
13,285
public function run ( ) { foreach ( $ this -> getSteps ( ) as $ step ) { $ this -> logger -> info ( 'Starting "' . $ step -> getTitle ( ) . '"' ) ; foreach ( $ this -> getServersForStep ( $ step ) as $ server ) { if ( $ step -> isMandatory ( ) ) { $ server -> runCommands ( ) ; $ this -> logger -> info ( 'Finished "' . ...
Run commands on every server of every step with steps commands .
13,286
protected function parseSegments ( $ expression , $ requiredSegmentCount ) { $ segments = explode ( ',' , preg_replace ( "/[ \(\)\\\"\']/" , '' , $ expression ) ) ; if ( $ requiredSegmentCount > count ( $ segments ) ) throw new FrameworkException ( "Blade directive is short the required number of segments of " . $ requ...
Parses out a blade directive arguments
13,287
private function getFieldIndex ( $ prevTag , $ tag , $ fieldIndex ) { if ( $ prevTag == $ tag or '' == $ prevTag ) { return $ fieldIndex ; } $ specTag = $ this -> currentSpec [ 'field' ] -> getTag ( ) ; if ( preg_match ( '/' . $ specTag . '/' , $ tag ) ) { return $ fieldIndex ; } return $ this -> spec [ 'field' ] -> ge...
Get the current field index .
13,288
private function iterateSubSpec ( $ subSpecs , $ fieldIndex , $ subfieldIndex = null ) { $ valid = true ; foreach ( $ subSpecs as $ _subSpec ) { if ( is_array ( $ _subSpec ) ) { foreach ( $ _subSpec as $ this -> currentSubSpec ) { $ this -> setIndexStartEnd ( $ fieldIndex , $ subfieldIndex ) ; if ( $ valid = $ this -> ...
Iterate on subspecs .
13,289
private function setIndexStartEnd ( $ fieldIndex , $ subfieldIndex = null ) { foreach ( [ 'leftSubTerm' , 'rightSubTerm' ] as $ side ) { if ( ! ( $ this -> currentSubSpec [ $ side ] instanceof CK \ MARCspec \ ComparisonStringInterface ) ) { if ( $ this -> spec [ 'field' ] [ 'tag' ] == $ this -> currentSubSpec [ $ side ...
Sets the start and end index of the current spec if it s an instance of CK \ MARCspec \ PositionOrRangeInterface .
13,290
private function checkSubSpec ( ) { $ validation = $ this -> cache -> validation ( $ this -> currentSubSpec ) ; if ( ! is_null ( $ validation ) ) { return $ validation ; } return $ this -> validateSubSpec ( ) ; }
Checks cache for subspec validation result . Validates SubSpec if it s not in cache .
13,291
private function validateSubSpec ( ) { if ( '!' != $ this -> currentSubSpec [ 'operator' ] && '?' != $ this -> currentSubSpec [ 'operator' ] ) { if ( false === ( $ this -> currentSubSpec [ 'leftSubTerm' ] instanceof CK \ MARCspec \ ComparisonStringInterface ) ) { $ leftSubTermReference = new self ( $ this -> currentSub...
Validates a subSpec .
13,292
private function referenceFieldsByTag ( ) { $ tag = $ this -> spec [ 'field' ] [ 'tag' ] ; if ( $ this -> cache -> offsetExists ( $ tag ) ) { return $ this -> cache [ $ tag ] ; } if ( 'LDR' !== $ tag ) { $ _fieldRef = $ this -> record -> getFields ( $ tag , true ) ; } else { $ _fieldRef [ ] = $ this -> record -> getLea...
Reference fields by field tag .
13,293
private function referenceFields ( ) { if ( $ this -> fields = $ this -> cache -> getData ( $ this -> spec [ 'field' ] ) ) { return $ this -> fields ; } if ( ! $ this -> fields = $ this -> referenceFieldsByTag ( ) ) { return ; } if ( $ _indexRange = $ this -> getIndexRange ( $ this -> spec [ 'field' ] , count ( $ this ...
Reference fields . Filter by index and indicator .
13,294
private function referenceSubfields ( $ currentSubfieldSpec ) { $ baseSubfieldSpec = $ this -> baseSpec . $ currentSubfieldSpec -> getBaseSpec ( ) ; if ( $ subfields = $ this -> cache -> getData ( $ this -> currentSpec [ 'field' ] , $ currentSubfieldSpec ) ) { return $ subfields ; } $ _subfields = $ this -> field -> ge...
Reference subfield contents and filter by index .
13,295
private function getIndexRange ( $ spec , $ total ) { $ lastIndex = $ total - 1 ; $ indexStart = $ spec [ 'indexStart' ] ; $ indexEnd = $ spec [ 'indexEnd' ] ; if ( '#' === $ indexStart ) { if ( '#' === $ indexEnd or 0 === $ indexEnd ) { return [ $ lastIndex ] ; } $ indexStart = $ lastIndex ; $ indexEnd = $ lastIndex -...
Calculates a range from indexStart and indexEnd .
13,296
public function ref ( $ spec , $ value ) { array_push ( $ this -> data , $ value ) ; $ value = $ this -> cache -> getContents ( $ spec , [ $ value ] ) ; $ this -> content = array_merge ( $ this -> content , $ value ) ; }
Reference data and set content .
13,297
public function cannot ( $ permissionName , $ params = [ ] , $ allowCaching = TRUE ) { return ! $ this -> can ( $ permissionName , $ params , $ allowCaching ) ; }
Checks if the user cannot perform the operation as specified by the given permission .
13,298
public function can ( $ permissionName , $ params = [ ] , $ allowCaching = TRUE ) { if ( is_array ( $ permissionName ) ) { foreach ( array_unique ( $ permissionName ) as $ permissionNameItem ) { if ( parent :: can ( $ permissionNameItem , $ params , $ allowCaching ) ) { return TRUE ; } } return FALSE ; } return parent ...
Checks if the user can perform the operation as specified by the given permission .
13,299
public function load ( string $ configPath , $ overwrite = false ) : void { if ( ! file_exists ( $ configPath ) ) { return ; } $ config = include $ configPath ; if ( ! is_array ( $ config ) && ! is_object ( $ config ) ) { return ; } if ( is_object ( $ config ) ) { $ config = get_object_vars ( $ config ) ; } $ this -> l...
Loads configuration from configuration file .