idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
9,300
public function delete ( $ key ) { $ filename = $ this -> getKeyCode ( $ key ) ; $ this -> memcacheObj -> delete ( $ filename ) ; }
Remove a key from cache
9,301
public function create ( $ alias , $ source , $ dependencies = [ ] , $ options = [ ] ) { $ assetType = isset ( $ options [ 'type' ] ) ? $ options [ 'type' ] : '' ; if ( isset ( $ this -> _customTypes [ $ assetType ] ) ) { $ assetType = $ this -> _customTypes [ $ assetType ] ; } elseif ( is_callable ( $ source ) ) { $ a...
Create asset instance .
9,302
public function getStatusOfTaskWithId ( $ taskId ) { $ task = $ this -> taskRepo -> find ( $ taskId ) ; if ( ! ( $ task instanceof Task ) ) { return Task :: STATUS_GONE ; } return $ task -> getStatus ( ) ; }
Returns the current status of a task
9,303
public function cleanUpTasks ( $ timePeriod ) { $ query = $ this -> entityManager -> createQuery ( 'DELETE FROM WebdevviePheanstalkTaskQueueBundle:Task t WHERE t.status = :status and t.created <= :older' ) ; $ query -> setParameter ( 'status' , array ( Task :: STATUS_DONE ) )...
Cleans up tasks that are marked as done
9,304
public function reserveTask ( $ tube = null ) { if ( is_null ( $ tube ) ) { $ tube = $ this -> defaultTube ; } $ inTask = $ this -> beanstalk -> watch ( $ tube ) -> ignore ( 'default' ) -> reserve ( 2 ) ; if ( $ inTask === false ) { return null ; } $ data = $ inTask -> getData ( ) ; $ parts = explode ( "::" , $ data , ...
Returns a task to work on .
9,305
public function markDone ( WorkPackage $ task , $ log ) { if ( $ this -> logWorkerOutputOnSuccess ) { $ this -> updateTaskLog ( $ task , $ log ) ; } $ this -> updateTaskStatus ( $ task , Task :: STATUS_DONE ) ; $ this -> beanstalk -> delete ( $ task -> getPheanstalkJob ( ) ) ; }
Deletes a task from the queue
9,306
public function markFailed ( WorkPackage $ task , $ log ) { if ( $ this -> logWorkerOutputOnFailure ) { $ this -> updateTaskLog ( $ task , $ log ) ; } $ this -> updateTaskStatus ( $ task , Task :: STATUS_FAILED ) ; $ this -> beanstalk -> delete ( $ task -> getPheanstalkJob ( ) ) ; }
Marks a job as failed and deletes it from the beanstalk tube
9,307
private function updateTaskLog ( WorkPackage $ task , $ log ) { if ( $ this -> databaseDisabled ) { return ; } $ taskEntity = $ task -> getTaskEntity ( ) ; if ( $ taskEntity instanceof Task ) { $ taskEntity -> setLog ( $ log ) ; $ this -> entityManager -> flush ( $ taskEntity ) ; } else { throw new TaskQueueServiceExce...
Writes the log to the Task entity
9,308
private function updateTaskStatus ( WorkPackage $ task , $ status ) { if ( $ this -> databaseDisabled ) { return ; } $ taskEntity = $ task -> getTaskEntity ( ) ; if ( $ taskEntity instanceof Task ) { $ taskEntity -> setStatus ( $ status ) ; $ this -> entityManager -> flush ( $ taskEntity ) ; } else { throw new TaskQueu...
Updates the task status
9,309
public function readData ( $ pathFilename ) { $ pathFilename = ucfirst ( $ pathFilename ) ; $ pathFilename = realpath ( __DIR__ ) . "/../Template/{$pathFilename}.template" ; $ file = fopen ( $ pathFilename , 'r' ) ; if ( $ data = fread ( $ file , filesize ( $ pathFilename ) ) ) { return str_replace ( '<\?php' , '<?php'...
Read data form template folder
9,310
public function variables ( ) { if ( ! $ this -> hasKeyword ( 'STUB' ) ) { return $ this -> keyword ( 'HEADING' ) -> values ; } elseif ( ! $ this -> hasKeyword ( 'HEADING' ) ) { return $ this -> keyword ( 'STUB' ) -> values ; } else { return array_merge ( $ this -> keyword ( 'STUB' ) -> values , $ this -> keyword ( 'HE...
Returns a list of all variables .
9,311
public function values ( $ variable ) { foreach ( $ this -> keywordList ( 'VALUES' ) as $ keyword ) { if ( $ keyword -> subKeys [ 0 ] == $ variable ) { return $ keyword -> values ; } } throw new RuntimeException ( sprintf ( 'Could not determine values of "%s".' , $ variable ) ) ; }
Returns a list of all possible values of a variable .
9,312
public function codes ( $ variable ) { foreach ( $ this -> keywordList ( 'CODES' ) as $ keyword ) { if ( $ keyword -> subKeys [ 0 ] == $ variable ) { return $ keyword -> values ; } } return null ; }
Returns a list of all possible codes of a variable .
9,313
public function index ( $ indices ) { $ this -> assertIndexMultipliers ( ) ; $ index = 0 ; for ( $ i = 0 , $ length = count ( $ this -> indexMultipliers ) ; $ i < $ length ; ++ $ i ) { $ index += $ indices [ $ i ] * $ this -> indexMultipliers [ $ i ] ; } return $ index ; }
Computes the index within the data matrix .
9,314
public function datum ( $ indices ) { $ this -> assertData ( ) ; $ index = $ this -> index ( $ indices ) ; if ( isset ( $ this -> data [ $ index ] ) ) { return $ this -> data [ $ index ] ; } else { return null ; } }
Gets a single data point .
9,315
public function keywordList ( $ keyword ) { $ this -> assertKeywords ( ) ; if ( isset ( $ this -> keywords [ $ keyword ] ) ) { return $ this -> keywords [ $ keyword ] ; } else { return [ ] ; } }
Returns all keywords with a given name .
9,316
public function keyword ( $ keyword ) { $ list = $ this -> keywordList ( $ keyword ) ; if ( empty ( $ list ) ) { throw new RuntimeException ( sprintf ( 'Keyword "%s" does not exist.' , $ keyword ) ) ; } return $ list [ 0 ] ; }
Returns the first keyword with a given name .
9,317
public function getFiles ( ) { $ iterator = new RecursiveDirectoryIterator ( $ this -> directory , FilesystemIterator :: SKIP_DOTS ) ; $ iterator = new RecursiveIteratorIterator ( $ iterator ) ; $ iterator -> rewind ( ) ; return $ iterator ; }
Give back a list of all files in a given directory recursively This returns the filename relative to the given directory .
9,318
public function render ( ) { $ responseData = array ( "status" => $ this -> _statusCode , "body" => $ this -> _content , "errors" => $ this -> _errors ) ; return json_encode ( $ responseData ) ; }
Ajax render function
9,319
public function findFile ( $ class ) { if ( xcache_isset ( $ this -> prefix . $ class ) ) { $ file = xcache_get ( $ this -> prefix . $ class ) ; } else { xcache_set ( $ this -> prefix . $ class , $ file = $ this -> classFinder -> findFile ( $ class ) ) ; } return $ file ; }
Finds a file by class name while caching lookups to Xcache .
9,320
public function addHttpHeader ( $ http_header , $ value ) { $ field = EnumRequestOption :: HTTP_HEADERS ; $ http_headers = isset ( $ this -> options [ $ field ] ) ? $ this -> options [ $ field ] : [ ] ; foreach ( $ http_headers as $ key => $ header ) { if ( strpos ( $ header , $ http_header ) === 0 ) { $ http_headers [...
Add HTTP Header
9,321
public function getHttpHeaders ( ) { $ field = EnumRequestOption :: HTTP_HEADERS ; $ http_deaders = isset ( $ this -> options [ $ field ] ) ? $ this -> options [ $ field ] : [ ] ; $ http_deaders = array_merge ( $ this -> getDefaultHttpHeaders ( ) , $ http_deaders ) ; return $ http_deaders ; }
Get HTTP headers
9,322
public function getExtraOptions ( ) { $ field = EnumRequestOption :: EXTRA_OPTIONS ; return isset ( $ this -> options [ $ field ] ) ? $ this -> options [ $ field ] : [ ] ; }
Get extra options
9,323
public function getVerbose ( ) { $ field = EnumRequestOption :: VERBOSE ; return isset ( $ this -> options [ $ field ] ) ? $ this -> options [ $ field ] : false ; }
Get verbose options
9,324
public function transform ( $ content ) { $ content = $ this -> entityToArray ( Content :: class , $ content ) ; return [ 'id' => $ this -> setNullableValue ( $ content [ 'id' ] ) , 'parentId' => $ this -> setNullableValue ( $ content [ 'parent_id' ] ) , 'type' => $ content [ 'type' ] , 'theme' => $ content [ 'theme' ]...
Transforms content entity
9,325
public function transform ( $ file ) { $ thumb = null ; if ( $ file -> type === 'image' ) { $ width = config ( 'gzero.image.thumb.width' ) ; $ height = config ( 'gzero.image.thumb.height' ) ; $ thumb = croppaUrl ( $ file -> getFullPath ( ) , $ width , $ height ) ; } $ file = $ this -> entityToArray ( File :: class , $ ...
Transforms file entity
9,326
private function setPivotNullableValue ( $ file , $ key ) { if ( array_key_exists ( 'pivot' , $ file ) ) { return $ this -> setNullableValue ( $ file [ 'pivot' ] [ $ key ] ) ; } return null ; }
Returns pivot integer value or null
9,327
public function execute ( UrlChain $ urlChain , RendererInterface $ renderer , OutputInterface $ output ) { $ result = 0 ; foreach ( $ urlChain -> getUrls ( ) as $ url ) { $ result = $ result | $ this -> executeUrl ( $ this -> client , $ url , $ renderer , $ output ) ; } return $ result ; }
Renders the output of the result of executing some urls given a client instance
9,328
protected function executeUrl ( ClientInterface $ client , Url $ url , RendererInterface $ renderer , OutputInterface $ output ) { $ resultHTTPCode = $ client -> getResponseHTTPCode ( $ url ) ; $ resultExecution = in_array ( $ resultHTTPCode , $ url -> getAcceptableHttpCodes ( ) ) ? 0 : 1 ; $ renderer -> render ( $ out...
Executes an URL and render the result given a renderer .
9,329
public function createStream ( $ serverconfig = null ) { if ( $ serverconfig == null ) { $ serverconfig = $ this -> default_streamserver_config ; } $ stream = new $ this -> stream_class ; $ stream -> setRtmpServer ( $ this -> streamserver_config [ $ serverconfig ] [ 'rtmp_url' ] ) ; $ stream -> setRtmpApp ( $ this -> s...
returns a new stream object preset with default streamserver config
9,330
public function startRecording ( $ stream ) { $ parts = explode ( '/' , $ this -> streamserver_config [ $ stream -> getRtmpServer ( ) ] [ 'rtmp_url' ] ) ; $ rtmp_app = end ( $ parts ) ; $ success = $ this -> record ( $ this -> streamserver_config [ $ stream -> getRtmpServer ( ) ] [ 'rtmp_control' ] , $ rtmp_app , $ str...
start recording a stream .
9,331
public function endRecording ( $ stream ) { $ parts = explode ( '/' , $ this -> streamserver_config [ $ stream -> getRtmpServer ( ) ] [ 'rtmp_url' ] ) ; $ rtmp_app = end ( $ parts ) ; $ success = $ this -> record ( $ this -> streamserver_config [ $ stream -> getRtmpServer ( ) ] [ 'rtmp_control' ] , $ rtmp_app , $ strea...
end recording a stream
9,332
public function addPublishToAdress ( $ stream , $ rtmp_adress , $ clientid , $ new_name , $ type = 'publisher' , $ srv = null ) { return $ this -> redirect ( $ stream -> getRtmpApp ( ) , $ stream -> getUniqID ( ) , $ rtmp_adress , $ clientid , $ new_name , $ type , $ srv ) ; }
adds a push to another rtmp server . can be used to send a stream to facebook youtube etc .
9,333
public function drop ( $ control_url , $ app , $ name , $ type = 'publisher' , $ addr = null , $ clientid = null , $ srv = null ) { $ query = [ ] ; $ query [ 'app' ] = $ app ; $ query [ 'name' ] = $ name ; if ( $ addr ) { $ query [ 'addr' ] = $ addr ; } if ( $ clientid ) { $ query [ 'clientid' ] = $ clientid ; } if ( $...
send a drop command to the rtmp server
9,334
public function redirect ( $ control_url , $ app , $ name , $ new_adress , $ new_clientid , $ new_name , $ type = 'publisher' , $ srv = null ) { $ query = [ ] ; $ query [ 'app' ] = $ app ; $ query [ 'name' ] = $ name ; $ query [ 'addr' ] = $ new_adress ; $ query [ 'clientid' ] = $ new_clientid ; $ query [ 'newname' ] =...
sends a redirect command to the rtmp server
9,335
public function getFile ( $ name ) { if ( ! isset ( $ this -> files ) ) { $ files = $ this -> getUploadedFiles ( ) ; foreach ( $ files as $ file ) { $ key = $ file -> getKey ( ) ; if ( isset ( $ key ) ) { $ this -> files [ $ key ] = $ file ; } else { $ this -> files [ ] = $ file ; } } } if ( isset ( $ this -> files [ $...
Gets upload file object by name
9,336
public function getBody ( ) { if ( ! isset ( $ this -> body ) ) { if ( function_exists ( 'http_get_request_body' ) ) { $ this -> body = http_get_request_body ( ) ; } else { $ this -> body = @ file_get_contents ( 'php://input' ) ; } } return $ this -> body ; }
Gets post body content
9,337
public static function get ( $ template ) { if ( self :: $ twig === null ) self :: initialize ( ) ; return self :: $ twig -> loadTemplate ( $ template . '.twig' ) ; }
Retreive a twig template object
9,338
public static function display ( $ template , $ target_id ) { if ( self :: $ twig === null ) self :: initialize ( ) ; self :: $ render_actions [ ] = array ( "type" => "display_tpl" , "template" => $ template , "target_id" => $ target_id ) ; }
Append a template render action to the render queue
9,339
public static function render ( ) { $ apiMode = Request :: isAPI ( ) ; if ( self :: $ twig === null ) self :: initialize ( ) ; $ data = Request :: getAllData ( ) ; if ( ! $ apiMode ) { $ data [ "siteName" ] = Configuration :: get ( "dachi.siteName" , "Unnamed Dachi Installation" ) ; $ data [ "timezone" ] = Configuratio...
Render the render queue to the browser
9,340
public static function redirect ( $ location , $ soft = false ) { if ( substr ( $ location , 0 , 4 ) !== "http" ) $ location = Configuration :: get ( "dachi.baseURL" ) . $ location ; self :: $ render_actions [ ] = array ( "type" => "redirect" , "location" => $ location , "soft" => $ soft ) ; }
Append a redirect action to the render queue .
9,341
public function access ( $ user ) { $ user = User :: findOrFail ( $ user -> id ) ; return $ user -> hasPermission ( 'laralum::users.access' ) || $ user -> superAdmin ( ) ; }
Determine if the current user can view users module .
9,342
public function view ( $ user ) { $ user = User :: findOrFail ( $ user -> id ) ; return $ user -> hasPermission ( 'laralum::users.view' ) || $ user -> superAdmin ( ) ; }
Determine if the current user can view users .
9,343
public function create ( $ user ) { $ user = User :: findOrFail ( $ user -> id ) ; return $ user -> hasPermission ( 'laralum::users.create' ) || $ user -> superAdmin ( ) ; }
Determine if the current user can create users .
9,344
public function update ( $ user , User $ userToManage ) { if ( $ userToManage -> id == $ user -> id || $ userToManage -> superAdmin ( ) ) { return false ; } $ user = User :: findOrFail ( $ user -> id ) ; return $ user -> hasPermission ( 'laralum::users.update' ) || $ user -> superAdmin ( ) ; }
Determine if the current user can update users .
9,345
public function isQueryAllowed ( ezcDbHandler $ db , $ query ) { if ( strstr ( $ query , 'AUTO_INCREMENT' ) ) { return false ; } if ( substr ( $ query , 0 , 10 ) == 'DROP TABLE' ) { $ tableName = substr ( $ query , strlen ( 'DROP TABLE "' ) , - 1 ) ; $ result = $ db -> query ( "SELECT count( table_name ) AS count FROM ...
Checks if query allowed .
9,346
protected function generateAdditionalDropSequenceStatements ( ezcDbSchemaDiff $ dbSchemaDiff , ezcDbHandler $ db ) { $ reader = new ezcDbSchemaOracleReader ( ) ; $ schema = $ reader -> loadFromDb ( $ db ) -> getSchema ( ) ; foreach ( $ dbSchemaDiff -> removedTables as $ table => $ true ) { foreach ( $ schema [ $ table ...
Generate additional drop sequence statements
9,347
public function build ( ) { $ annotationReader = $ this -> annotationReader ; if ( null === $ annotationReader ) { $ annotationReader = new AnnotationReader ( ) ; if ( null !== $ this -> cacheDirectory ) { $ cacheDirectory = sprintf ( '%s/annotations' , $ this -> cacheDirectory ) ; $ this -> createDirectory ( $ cacheDi...
Create open graph object
9,348
public function setCacheDirectory ( $ directory ) { if ( ! is_dir ( $ directory ) ) { $ this -> createDirectory ( $ directory ) ; } if ( ! is_writable ( $ directory ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The cache directory "%s" is not writable.' , $ dir ) ) ; } $ this -> cacheDirectory = $ directory ;...
Set cache directory
9,349
public function useSession ( ) { $ this -> session = $ this -> getRequest ( ) -> getAttribute ( 'session' ) ; if ( ! isset ( $ this -> session ) ) { $ this -> session = & $ _SESSION ; } }
Link the session to the session property in the controller
9,350
public static function factoryReference ( $ reference ) { $ className = $ reference [ 2 ] ; if ( ! class_exists ( $ className ) ) { throw new Exceptions \ EntityClassNotFoundException ( "factoryReference called for a class that can't be found, $className." ) ; } $ entity = call_user_func ( [ $ className , 'factory' ] )...
Create a new sleeping reference instance .
9,351
public function & __get ( $ name ) { if ( $ name === 'guid' ) { return $ this -> $ name ; } if ( $ this -> isASleepingReference ) { $ this -> referenceWake ( ) ; } if ( $ name === 'cdate' || $ name === 'mdate' || $ name === 'tags' ) { return $ this -> $ name ; } if ( isset ( $ this -> sdata [ $ name ] ) ) { $ this -> d...
Retrieve a variable .
9,352
public function __isset ( $ name ) { if ( $ this -> isASleepingReference ) { $ this -> referenceWake ( ) ; } if ( $ name === 'guid' || $ name === 'cdate' || $ name === 'mdate' || $ name === 'tags' ) { return isset ( $ this -> $ name ) ; } if ( isset ( $ this -> sdata [ $ name ] ) ) { $ this -> data [ $ name ] = unseria...
Checks whether a variable is set .
9,353
private function entityToReference ( & $ item , $ key ) { if ( $ this -> isASleepingReference ) { $ this -> referenceWake ( ) ; } if ( ( is_a ( $ item , '\Nymph\Entity' ) || is_a ( $ item , '\SciActive\HookOverride' ) ) && isset ( $ item -> guid ) && is_callable ( [ $ item , 'toReference' ] ) ) { if ( ! isset ( $ this ...
Check if an item is an entity and if it is convert it to a reference .
9,354
private function getDataReference ( $ item ) { if ( $ this -> isASleepingReference ) { $ this -> referenceWake ( ) ; } if ( ( is_a ( $ item , '\Nymph\Entity' ) || is_a ( $ item , '\SciActive\HookOverride' ) ) && is_callable ( [ $ item , 'toReference' ] ) ) { return $ item -> toReference ( ) ; } elseif ( is_array ( $ it...
Convert entities to references and return the result .
9,355
public function referenceSleep ( $ reference ) { if ( count ( $ reference ) !== 3 || $ reference [ 0 ] !== 'nymph_entity_reference' || ! is_int ( $ reference [ 1 ] ) || ! is_string ( $ reference [ 2 ] ) ) { throw new Exceptions \ InvalidParametersException ( 'referenceSleep expects parameter 1 to be a valid Nymph entit...
Set up a sleeping reference .
9,356
private function referenceWake ( ) { if ( ! $ this -> isASleepingReference ) { return true ; } if ( ! class_exists ( $ this -> sleepingReference [ 2 ] ) ) { throw new Exceptions \ EntityClassNotFoundException ( "Tried to wake sleeping reference entity that refers to a class " . "that can't be found, {$this->sleepingRef...
Wake from a sleeping reference .
9,357
private function appendStreamFilters ( $ line ) { switch ( strtolower ( $ this -> headers [ 'Content-Transfer-Encoding' ] ) ) { case 'base64' : stream_filter_append ( $ this -> fp , 'convert.base64-decode' ) ; break ; case 'quoted-printable' : preg_match ( "/(\r\n|\r|\n)$/" , $ line , $ matches ) ; $ lb = count ( $ mat...
Sets the correct stream filters for the attachment .
9,358
public function parseBody ( $ line ) { if ( $ line !== '' ) { if ( $ this -> dataWritten === false ) { $ this -> appendStreamFilters ( $ line ) ; $ this -> dataWritten = true ; } fwrite ( $ this -> fp , $ line ) ; } }
Parse the body of a message line by line .
9,359
public function finish ( ) { fclose ( $ this -> fp ) ; $ this -> fp = null ; if ( $ this -> mainType == "application" && ( $ this -> subType == 'pgp-signature' || $ this -> subType == 'pgp-keys' || $ this -> subType == 'pgp-encrypted' ) ) { return null ; } $ filePart = new self :: $ fileClass ( $ this -> fileName ) ; $...
Return the result of the parsed file part .
9,360
public function map ( $ method , $ route , $ handler ) { $ this [ 'router' ] -> map ( $ method , $ route , $ handler ) ; return $ this ; }
Adds a handler to the routing table for a given route .
9,361
public function handleRequest ( Request $ req ) { $ config = $ this [ 'config' ] ; if ( ! $ config -> get ( 'app.hostname' ) ) { $ config -> set ( 'app.hostname' , $ req -> host ( ) ) ; } $ res = new Response ( ) ; try { $ routeInfo = $ this [ 'router' ] -> dispatch ( $ req -> method ( ) , $ req -> path ( ) ) ; $ this ...
Builds a response to an incoming request by routing it through the application .
9,362
public function runMiddleware ( Request $ req , Response $ res ) { $ this -> initMiddleware ( ) -> rewind ( ) ; return $ this -> nextMiddleware ( $ req , $ res ) ; }
Runs the middleware chain .
9,363
public function nextMiddleware ( Request $ req , Response $ res ) { $ middleware = $ this -> middleware -> current ( ) ; if ( ! $ middleware ) { return $ res ; } $ this -> middleware -> next ( ) ; return $ middleware ( $ req , $ res , [ $ this , 'nextMiddleware' ] ) ; }
Calls the next middleware in the chain . DO NOT call directly .
9,364
public static function filter ( $ value , bool $ allowNull = false ) { if ( self :: valueIsNullAndValid ( $ allowNull , $ value ) ) { return null ; } if ( $ value instanceof \ DateTimeZone ) { return $ value ; } if ( ! is_string ( $ value ) || trim ( $ value ) == '' ) { throw new FilterException ( '$value not a non-emp...
Filters the given value into a \ DateTimeZone object .
9,365
public static function logEntry ( $ entry ) { $ parts = explode ( "|" , $ entry , 5 ) ; $ array = array ( ) ; if ( count ( $ parts ) != 5 ) { $ array [ "timestamp" ] = 0 ; $ array [ "level" ] = TeamSpeak3 :: LOGLEVEL_ERROR ; $ array [ "channel" ] = "ParamParser" ; $ array [ "server_id" ] = "" ; $ array [ "msg" ] = Str ...
Converts a specified log entry string into an array containing the data .
9,366
public static function startWithNode ( string $ variable = null , array $ labels = [ ] ) : self { $ path = new self ; $ path -> elements = $ path -> elements -> add ( new Node ( $ variable , $ labels ) ) ; $ path -> lastOperation = Node :: class ; return $ path ; }
Start the path with the given node
9,367
public function linkedTo ( string $ variable = null , array $ labels = [ ] ) : self { $ path = new self ; $ path -> elements = $ this -> elements -> add ( Relationship :: both ( ) ) -> add ( new Node ( $ variable , $ labels ) ) ; $ path -> lastOperation = Node :: class ; return $ path ; }
Create a relationship to the given node
9,368
public function through ( string $ variable = null , string $ type = null , string $ direction = 'BOTH' ) : self { if ( $ this -> elements -> size ( ) < 3 ) { throw new LogicException ; } $ direction = \ strtolower ( $ direction ) ; $ path = new self ; $ path -> elements = $ this -> elements -> dropEnd ( 2 ) -> add ( R...
Type the last declared relationship in the path
9,369
public function withADistanceOfAtLeast ( int $ distance ) : self { if ( $ this -> elements -> size ( ) < 3 ) { throw new LogicException ; } $ path = clone $ this ; $ path -> elements = $ this -> elements -> dropEnd ( 2 ) -> add ( $ this -> elements -> dropEnd ( 1 ) -> last ( ) -> withADistanceOfAtLeast ( $ distance ) )...
Define the minimum deepness of the relationship
9,370
public function withParameter ( string $ key , $ value ) : self { if ( $ this -> lastOperation === Node :: class ) { $ element = $ this -> elements -> last ( ) ; } else { $ element = $ this -> elements -> dropEnd ( 1 ) -> last ( ) ; } $ element = $ element -> withParameter ( $ key , $ value ) ; $ path = new self ; $ pa...
Add the given parameter to the last operation
9,371
public function withProperty ( string $ property , string $ cypher ) : self { if ( $ this -> lastOperation === Node :: class ) { $ element = $ this -> elements -> last ( ) ; } else { $ element = $ this -> elements -> dropEnd ( 1 ) -> last ( ) ; } $ element = $ element -> withProperty ( $ property , $ cypher ) ; $ path ...
Add the given property to the last operation
9,372
public function parameters ( ) : MapInterface { if ( $ this -> parameters ) { return $ this -> parameters ; } return $ this -> parameters = $ this -> elements -> reduce ( new Map ( 'string' , Parameter :: class ) , function ( Map $ carry , $ element ) : Map { return $ carry -> merge ( $ element -> parameters ( ) ) ; } ...
Return all the parameters of the path
9,373
private function executeFFmpegForMedia ( $ cmd , $ format , $ resolution , $ media ) { $ ffmpeg_start = microtime ( true ) ; $ this -> getContainer ( ) -> get ( 'oktolab_media_ffmpeg' ) -> executeFFmpegForMedia ( $ resolution [ 'encoder' ] , $ cmd , $ media ) ; $ ffmpeg_stop = microtime ( true ) ; $ media -> setStatus ...
creates a media object and runs the ffmpeg command for the given resolution . the command will be tracked to update the progress from 0 - 100 in realtime . will move the asset from the cache adapter to the adapter in the resolution if defined . triggers the finalize episode function once for the whole job
9,374
private function finalizeEpisode ( $ episode ) { $ event = new EncodedEpisodeEvent ( $ episode ) ; $ this -> getContainer ( ) -> get ( 'event_dispatcher' ) -> dispatch ( OktolabMediaEvent :: ENCODED_EPISODE , $ event ) ; $ this -> oktolab_media -> addFinalizeEpisodeJob ( $ episode -> getUniqID ( ) , false , true ) ; }
adds finalize job and dispatches encoded_episode event
9,375
private function createNewCacheAssetForResolution ( $ episode , $ resolution ) { $ asset = $ this -> getContainer ( ) -> get ( 'bprs.asset' ) -> createAsset ( ) ; $ asset -> setFilekey ( sprintf ( '%s.%s' , $ asset -> getFilekey ( ) , $ resolution [ 'container' ] ) ) ; $ asset -> setAdapter ( $ this -> getContainer ( )...
returns an empty asset to be used in an encoding situation . the filekey mimetype and adapter are already set for ffmpeg
9,376
public function withScope ( $ scope ) { if ( $ scope == Grid \ Exporter :: SCOPE_ALL ) { return $ this ; } list ( $ scope , $ args ) = explode ( ':' , $ scope ) ; if ( $ scope == Grid \ Exporter :: SCOPE_CURRENT_PAGE ) { $ this -> grid -> model ( ) -> usePaginate ( true ) ; } if ( $ scope == Grid \ Exporter :: SCOPE_SE...
Export data with scope .
9,377
public function create ( array $ attributes ) { $ model = $ this -> getModelName ( ) ; $ nodeType = $ model :: create ( $ attributes ) ; $ this -> builderService -> buildTable ( $ nodeType -> getName ( ) , $ nodeType -> getKey ( ) ) ; return $ nodeType ; }
Creates a node type
9,378
public function destroy ( $ id ) { $ model = $ this -> getModelName ( ) ; $ nodeType = $ model :: findOrFail ( $ id ) ; $ this -> builderService -> destroyTable ( $ nodeType -> getName ( ) , $ nodeType -> getFieldKeys ( ) , $ nodeType -> getKey ( ) ) ; $ nodeType -> delete ( ) ; return $ nodeType ; }
Destroys a node type
9,379
public function getNodeTypesByIds ( $ ids ) { if ( empty ( $ ids ) ) { return null ; } if ( is_string ( $ ids ) ) { $ ids = json_decode ( $ ids , true ) ; } if ( is_array ( $ ids ) && ! empty ( $ ids ) ) { $ model = $ this -> getModelName ( ) ; $ placeholders = implode ( ',' , array_fill ( 0 , count ( $ ids ) , '?' ) )...
Returns node types by ids
9,380
public function validate ( ) { try { Yaml \ Yaml :: parse ( $ this -> data ) ; } catch ( \ Exception $ e ) { return false ; } return true ; }
Validates a Yaml string
9,381
public function configureComposerJson ( Event $ event ) { static :: $ plugin -> getInstanceOf ( ComposerConfigurator :: class ) -> configure ( $ event -> getComposer ( ) , $ event -> getIO ( ) ) ; }
Configure the composer sonfiguration file .
9,382
public function setWordPressInstallDirectory ( PackageEvent $ event ) { if ( $ this -> getPackageName ( $ event ) != 'johnpbloch/wordpress' ) { return ; } $ composer = $ event -> getComposer ( ) ; $ rootPkg = $ composer -> getPackage ( ) ; if ( ! $ rootPkg ) { return ; } $ extra = $ rootPkg -> getExtra ( ) ; if ( isset...
Set the WordPress installation directory .
9,383
public function cleanWordPressInstallation ( PackageEvent $ event ) { if ( $ this -> getPackageName ( $ event ) != 'johnpbloch/wordpress' ) { return ; } static :: $ plugin -> getInstanceOf ( WordPressInstallationCleaner :: class ) -> clean ( $ event -> getComposer ( ) , $ event -> getIO ( ) ) ; }
Clean the WordPress installation .
9,384
public function activateWordPressPlugin ( PackageEvent $ event ) { if ( ! $ this -> isWordPressPlugin ( $ this -> getPackage ( $ event ) ) ) { return ; } static :: $ plugin -> getInstanceOf ( PluginInteractor :: class ) -> activate ( $ event -> getComposer ( ) , $ event -> getIO ( ) , preg_replace ( '/^wpackagist-plugi...
Activate a WordPress plugin .
9,385
public function deactivateWordPressPlugin ( PackageEvent $ event ) { if ( ! $ this -> isWordPressPlugin ( $ this -> getPackage ( $ event ) ) ) { return ; } static :: $ plugin -> getInstanceOf ( PluginInteractor :: class ) -> deactivate ( $ event -> getComposer ( ) , $ event -> getIO ( ) , preg_replace ( '/^wpackagist-p...
Deactivate a WordPress plugin .
9,386
public function uninstallWordPressPlugin ( PackageEvent $ event ) { if ( ! $ this -> isWordPressPlugin ( $ this -> getPackage ( $ event ) ) ) { return ; } static :: $ plugin -> getInstanceOf ( PluginInteractor :: class ) -> uninstall ( $ event -> getComposer ( ) , $ event -> getIO ( ) , preg_replace ( '/^wpackagist-plu...
Uninstall a WordPress plugin .
9,387
protected function getPackage ( PackageEvent $ event ) { $ operation = $ event -> getOperation ( ) ; if ( method_exists ( $ operation , 'getPackage' ) ) { return $ operation -> getPackage ( ) ; } return $ operation -> getTargetPackage ( ) ; }
Get the PackageInterface from a PackageEvent .
9,388
public function loadMetadataForClass ( \ ReflectionClass $ class ) { $ classMetadata = new ClassMetadata ( $ class -> name ) ; $ classMetadata -> fileResources [ ] = $ class -> getFileName ( ) ; foreach ( $ this -> reader -> getClassAnnotations ( $ class ) as $ annotation ) { if ( $ annotation instanceof NamespaceNode ...
Load metadata class
9,389
protected function getIndexKey ( $ element ) { $ key = $ element -> getFullyQualifiedStructuralElementName ( ) ; if ( $ element instanceof PropertyInterface ) { list ( $ fqcn , $ propertyName ) = explode ( '::' , $ key ) ; $ key = $ fqcn . '::$' . $ propertyName ; } return $ key ; }
Retrieves a key for the index for the provided element .
9,390
public function set ( $ index , $ item ) { $ this -> offsetSet ( $ index , $ this -> parser -> text ( $ item ) ) ; }
Sets a new object onto the collection or clear it using null .
9,391
public function register ( ) { $ this -> helper_callbacks = array ( ) ; $ arguments = func_get_args ( ) ; if ( count ( $ arguments ) > 0 ) { foreach ( $ arguments as $ argument ) { if ( $ argument instanceof Plugin ) { $ callback = $ argument -> getEventHelperCallback ( $ this -> getName ( ) ) ; if ( is_callable ( $ ca...
register an array of plugins objects and allow the plugins to join the process of handling this event
9,392
public function start ( ) { $ result = array ( ) ; if ( count ( $ this -> helper_callbacks ) > 0 ) { foreach ( $ this -> helper_callbacks as $ callback ) { $ return_value = call_user_func_array ( $ callback , array ( $ this ) ) ; $ result [ ] = $ return_value ; } } return $ result ; }
start this event
9,393
private function executeHandles ( & $ active , & $ mrc , $ timeout = 1 ) { do { $ mrc = curl_multi_exec ( $ this -> multiHandle , $ active ) ; } while ( $ mrc == CURLM_CALL_MULTI_PERFORM && $ active ) ; $ this -> checkCurlResult ( $ mrc ) ; if ( $ active && $ mrc == CURLM_OK && curl_multi_select ( $ this -> multiHandle...
Execute and select curl handles until there is activity
9,394
protected function removeErroredRequest ( RequestInterface $ request , \ Exception $ e = null , $ buffer = true ) { if ( $ buffer ) { $ this -> exceptions [ ] = array ( 'request' => $ request , 'exception' => $ e ) ; } $ this -> remove ( $ request ) ; $ this -> dispatch ( self :: MULTI_EXCEPTION , array ( 'exception' =...
Remove a request that encountered an exception
9,395
protected function processResponse ( RequestInterface $ request , CurlHandle $ handle , array $ curl ) { $ handle -> updateRequestFromTransfer ( $ request ) ; $ curlException = $ this -> isCurlException ( $ request , $ handle , $ curl ) ; $ this -> removeHandle ( $ request ) ; if ( ! $ curlException ) { $ state = $ req...
Check for errors and fix headers of a request based on a curl response
9,396
protected function removeHandle ( RequestInterface $ request ) { if ( isset ( $ this -> handles [ $ request ] ) ) { $ handle = $ this -> handles [ $ request ] ; unset ( $ this -> handles [ $ request ] ) ; unset ( $ this -> resourceHash [ ( int ) $ handle -> getHandle ( ) ] ) ; curl_multi_remove_handle ( $ this -> multi...
Remove a curl handle from the curl multi object
9,397
protected function getTemplates ( InputInterface $ input ) { $ configurationHelper = $ this -> getHelper ( 'phpdocumentor_configuration' ) ; $ templates = $ input -> getOption ( 'template' ) ; if ( ! $ templates ) { $ templatesFromConfig = $ configurationHelper -> getConfigValueFromPath ( 'transformations/templates' ) ...
Retrieves the templates to be used by analyzing the options and the configuration .
9,398
public function loadTransformations ( Transformer $ transformer ) { $ configurationHelper = $ this -> getHelper ( 'phpdocumentor_configuration' ) ; $ received = array ( ) ; $ transformations = $ configurationHelper -> getConfigValueFromPath ( 'transformations/transformations' ) ; if ( is_array ( $ transformations ) ) {...
Load custom defined transformations .
9,399
protected function createTransformation ( array $ transformations ) { return new Transformation ( isset ( $ transformations [ 'query' ] ) ? $ transformations [ 'query' ] : '' , $ transformations [ 'writer' ] , isset ( $ transformations [ 'source' ] ) ? $ transformations [ 'source' ] : '' , isset ( $ transformations [ '...
Create Transformation instance .