idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
235,500
public function getLongLinkbyShort ( $ shortLink ) { $ this -> client -> setMethod ( 'GET' ) ; $ this -> client -> setUri ( "https://www.googleapis.com/urlshortener/v1/url?shortUrl={$shortLink}" ) ; $ contentJson = $ this -> client -> send ( ) -> getContent ( ) ; $ responseArray = json_decode ( $ contentJson , true ) ;...
Return Long url bu Short url
235,501
public function start ( $ iMaxDuration , $ iHeartbeat ) { $ fNow = microtime ( true ) ; $ this -> aData = [ 'ts_limit' => $ fNow + $ iMaxDuration , 'lap_duration' => $ iHeartbeat , 'lap_start' => $ fNow , 'lap_end' => $ fNow + $ iHeartbeat , 'lap_nb_events' => 0 , 'total_nb_events' => 0 ] ; return $ this ; }
Init data structure .
235,502
public function doTic ( ) { $ aData = & $ this -> aData ; $ fNow = microtime ( true ) ; if ( $ fNow >= $ aData [ 'lap_end' ] || $ this -> isTimeLimitExceeded ( ) ) { $ iNbEventsPerSec = round ( $ aData [ 'lap_nb_events' ] / ( $ fNow - $ aData [ 'lap_start' ] ) ) ; $ sMsg = sprintf ( $ this -> sFormat , $ iNbEventsPerSe...
Display stats about number of processed events since last display .
235,503
protected function getCart ( ShopInterface $ shop , ClientInterface $ client = null , $ sessionId , $ currency ) { $ cart = $ this -> repository -> findCart ( $ client , $ sessionId , $ shop ) ; if ( null === $ cart ) { $ cart = $ this -> createCart ( $ shop , $ client ) ; } else { $ this -> updateCart ( $ cart , $ cli...
Returns an existent cart or creates a new one if needed
235,504
protected function createCart ( ShopInterface $ shop , ClientInterface $ client = null ) { $ cart = $ this -> initResource ( ) ; $ cart -> setShop ( $ shop ) ; $ cart -> setClient ( $ client ) ; $ this -> createResource ( $ cart ) ; return $ cart ; }
Creates cart using factory
235,505
protected function execute ( string $ username , ServerRequestInterface $ request ) : \ PDOStatement { $ stmt = $ this -> pdo -> prepare ( $ this -> getSql ( ) ) ; $ stmt -> execute ( [ $ username ] ) ; return $ stmt ; }
Queries the database table .
235,506
protected function fetchResult ( array $ results , string $ username ) : array { if ( count ( $ results ) > 1 ) { throw new \ Caridea \ Auth \ Exception \ UsernameAmbiguous ( $ username ) ; } elseif ( count ( $ results ) == 0 ) { throw new \ Caridea \ Auth \ Exception \ UsernameNotFound ( $ username ) ; } return curren...
Fetches a single result from the database resultset .
235,507
public function addEventFilter ( FilterCollectionEvent $ event ) : void { $ now = new \ DateTime ( ) ; $ qb = $ event -> getQueryBuilder ( ) ; $ query = $ qb -> query ( ) -> bool ( ) -> addMust ( $ qb -> query ( ) -> term ( [ '_index' => 'event' ] ) ) -> addMust ( $ qb -> query ( ) -> term ( [ 'active' => true ] ) ) ->...
Add the event filter to search .
235,508
public function addScheduleFilter ( FilterCollectionEvent $ event ) : void { $ now = new \ DateTime ( ) ; $ qb = $ event -> getQueryBuilder ( ) ; $ query = $ qb -> query ( ) -> bool ( ) -> addMust ( $ qb -> query ( ) -> term ( [ '_index' => 'schedule' ] ) ) -> addMust ( $ qb -> query ( ) -> term ( [ 'active' => true ] ...
Add the schedule filter to search .
235,509
public function fetchTree ( $ rootId = null , $ depth = null ) { $ wrappers = $ this -> fetchTreeAsArray ( $ rootId , $ depth ) ; return ( ! is_array ( $ wrappers ) || empty ( $ wrappers ) ) ? null : $ wrappers [ 0 ] ; }
Fetches the complete tree returning the root node of the tree
235,510
public function fetchTreeAsArray ( $ rootId = null , $ depth = null ) { $ config = $ this -> getConfiguration ( ) ; $ lftField = $ config -> getLeftFieldName ( ) ; $ rgtField = $ config -> getRightFieldName ( ) ; $ rootField = $ config -> getRootFieldName ( ) ; $ hasManyRoots = $ config -> hasManyRoots ( ) ; if ( $ roo...
Fetches the complete tree returning a flat array of node wrappers with parent children ancestors and descendants pre - populated .
235,511
public function fetchBranch ( $ pk , $ depth = null ) { $ wrappers = $ this -> fetchBranchAsArray ( $ pk , $ depth ) ; return ( ! is_array ( $ wrappers ) || empty ( $ wrappers ) ) ? null : $ wrappers [ 0 ] ; }
Fetches a branch of a tree returning the starting node of the branch . All children and descendants are pre - populated .
235,512
public function fetchBranchAsArray ( $ pk , $ depth = null ) { $ config = $ this -> getConfiguration ( ) ; $ lftField = $ config -> getLeftFieldName ( ) ; $ rgtField = $ config -> getRightFieldName ( ) ; $ rootField = $ config -> getRootFieldName ( ) ; $ hasManyRoots = $ config -> hasManyRoots ( ) ; if ( $ depth === 0 ...
Fetches a branch of a tree returning a flat array of node wrappers with parent children ancestors and descendants pre - populated .
235,513
public function createRoot ( Node $ node ) { if ( $ node instanceof NodeWrapper ) { throw new \ InvalidArgumentException ( 'Can\'t create a root node from a NodeWrapper node' ) ; } $ node -> setLeftValue ( 1 ) ; $ node -> setRightValue ( 2 ) ; if ( $ this -> getConfiguration ( ) -> hasManyRoots ( ) ) { $ rootValue = $ ...
Creates a new root node
235,514
public function wrapNode ( Node $ node ) { if ( $ node instanceof NodeWrapper ) { throw new \ InvalidArgumentException ( 'Can\'t wrap a NodeWrapper node' ) ; } $ oid = spl_object_hash ( $ node ) ; if ( ! isset ( $ this -> wrappers [ $ oid ] ) || $ this -> wrappers [ $ oid ] -> getNode ( ) !== $ node ) { $ this -> wrapp...
wraps the node using the NodeWrapper class
235,515
public function updateLeftValues ( $ first , $ last , $ delta , $ rootVal = null ) { $ hasManyRoots = $ this -> getConfiguration ( ) -> hasManyRoots ( ) ; foreach ( $ this -> wrappers as $ wrapper ) { if ( ! $ hasManyRoots || ( $ wrapper -> getRootValue ( ) == $ rootVal ) ) { if ( $ wrapper -> getLeftValue ( ) >= $ fir...
Internal Updates the left values of managed nodes
235,516
public function updateRightValues ( $ first , $ last , $ delta , $ rootVal = null ) { $ hasManyRoots = $ this -> getConfiguration ( ) -> hasManyRoots ( ) ; foreach ( $ this -> wrappers as $ wrapper ) { if ( ! $ hasManyRoots || ( $ wrapper -> getRootValue ( ) == $ rootVal ) ) { if ( $ wrapper -> getRightValue ( ) >= $ f...
Internal Updates the right values of managed nodes
235,517
public function updateValues ( $ first , $ last , $ delta , $ oldRoot = null , $ newRoot = null ) { if ( ! $ this -> wrappers ) { return ; } $ hasManyRoots = $ this -> getConfiguration ( ) -> hasManyRoots ( ) ; foreach ( $ this -> wrappers as $ wrapper ) { if ( ! $ hasManyRoots || ( $ wrapper -> getRootValue ( ) == $ o...
Internal Updates the left right and root values of managed nodes
235,518
public function removeNodes ( $ left , $ right , $ root = null ) { $ hasManyRoots = $ this -> getConfiguration ( ) -> hasManyRoots ( ) ; $ removed = array ( ) ; foreach ( $ this -> wrappers as $ oid => $ wrapper ) { if ( ! $ hasManyRoots || ( $ wrapper -> getRootValue ( ) == $ root ) ) { if ( $ wrapper -> getLeftValue ...
Internal Removes managed nodes
235,519
public function filterNodeDepth ( $ nodes , $ depth ) { if ( empty ( $ nodes ) || $ depth === 0 ) { return array ( ) ; } $ newNodes = array ( ) ; $ stack = array ( ) ; $ level = 0 ; foreach ( $ nodes as $ node ) { $ parent = end ( $ stack ) ; while ( $ parent && $ node -> getLeftValue ( ) > $ parent -> getRightValue ( ...
Internal Filters an array of nodes by depth
235,520
public function addHintToQuery ( \ Doctrine \ ORM \ Query $ query ) { return $ query -> setHint ( $ this -> getConfiguration ( ) -> GetQueryHintName ( ) , $ this -> getConfiguration ( ) -> GetQueryHintValue ( ) ) ; }
Adds a Query hint to a Query Object
235,521
protected function getMapsOptions ( ) { return [ 'dragndrop' => Translate :: t ( 'map.options.dragndrop' , [ ] , 'mapfield' ) , 'streetview' => Translate :: t ( 'map.options.streetview' , [ ] , 'mapfield' ) , 'zoomcontrol' => Translate :: t ( 'map.options.zoomcontrol' , [ ] , 'mapfield' ) , 'mapcontrol' => Translate ::...
Return all available maps options .
235,522
private function saveToCache ( $ rawCacheKey , $ value ) { $ cacheKey = $ rawCacheKey . self :: $ CACHE_SALT ; $ this -> cache -> save ( $ cacheKey , $ value ) ; if ( $ this -> debug ) $ this -> cache -> save ( '[C]' . $ cacheKey , time ( ) ) ; }
Saves a value to the cache .
235,523
private function isCacheFresh ( $ cacheKey , \ ReflectionClass $ class ) { if ( false === $ filename = $ class -> getFileName ( ) ) return true ; return $ this -> cache -> fetch ( '[C]' . $ cacheKey ) >= filemtime ( $ filename ) ; }
Checks if the cache is fresh .
235,524
public function findLoader ( \ SplFileInfo $ source ) { foreach ( $ this -> loaders as $ loader ) { if ( $ loader -> isSupported ( $ source ) ) { return $ loader ; } } throw new \ OutOfBoundsException ( sprintf ( 'No configuration loader found for "%s"' , $ source -> getPathname ( ) ) ) ; }
Picks a config loader for the given file and returns it .
235,525
public function validate ( $ value , Constraint $ constraint ) : void { $ item_values = [ ] ; foreach ( $ value as $ item ) { $ item_value = $ this -> property_accessor -> getValue ( $ item , $ constraint -> property ) ; if ( isset ( $ item_values [ $ item_value ] ) ) { $ this -> context -> buildViolation ( $ constrain...
Validate a constraint .
235,526
public function getPathInfo ( ) { if ( $ this -> pathInfo === null ) { $ end = strpos ( $ this -> uri , '?' ) ; if ( $ end === false ) { $ this -> pathInfo = $ this -> uri ; } else { $ this -> pathInfo = substr ( $ this -> uri , 0 , $ end ) ; } if ( empty ( $ this -> pathInfo ) ) { $ this -> pathInfo = '/' ; } } return...
Get the path info which is the uri without the query parameters
235,527
public function getMaxAllowedPacket ( ) { if ( $ this -> maxAllowedPacket === null ) { $ statement = $ this -> prepare ( 'SELECT @@global.max_allowed_packet' ) ; $ statement -> execute ( ) ; $ this -> maxAllowedPacket = ( int ) $ statement -> fetchColumn ( ) ; } return $ this -> maxAllowedPacket ; }
Gets the MySQL max allowed packet constant .
235,528
protected function Init ( ) { $ this -> layout = new Layout ( Request :: GetData ( 'layout' ) ) ; if ( ! $ this -> layout -> Exists ( ) ) { Response :: Redirect ( BackendRouter :: ModuleUrl ( new LayoutList ( ) ) ) ; return true ; } $ this -> listProvider = new AreaListProvider ( $ this -> layout ) ; $ this -> area = $...
Initializes the list
235,529
protected function CreateAfterUrl ( Area $ area ) { $ args = array ( 'layout' => $ this -> layout -> GetID ( ) ) ; $ args [ 'previous' ] = $ area -> GetID ( ) ; return BackendRouter :: ModuleUrl ( new AreaForm ( ) , $ args ) ; }
The create url for an area after another
235,530
protected function NextArea ( ) { $ area = $ this -> area ; $ this -> area = $ this -> listProvider -> NextOf ( $ this -> area ) ; return $ area ; }
Gets the next area
235,531
protected function CanEdit ( Area $ area ) { return self :: Guard ( ) -> Allow ( BackendAction :: Edit ( ) , $ area ) && self :: Guard ( ) -> Allow ( BackendAction :: UseIt ( ) , new AreaForm ( ) ) ; }
True if area can be edited
235,532
public function addBlogContent ( \ Haven \ CmsBundle \ Entity \ PageContent $ pageContents ) { $ this -> addPageContent ( $ pageContents ) ; return $ this ; }
Add page_contents for blogcontent type
235,533
public function addBusCardContent ( \ Haven \ CmsBundle \ Entity \ PageContent $ pageContents ) { $ this -> addPageContent ( $ pageContents ) ; return $ this ; }
Add page_contents for buscardcontent type
235,534
public function addEnterpriseContent ( \ Haven \ CmsBundle \ Entity \ PageContent $ pageContents ) { $ this -> addPageContent ( $ pageContents ) ; return $ this ; }
Add page_contents for enterprisecontent type
235,535
public function setSchema ( Schema $ schema ) { $ this -> schema = $ schema ; if ( ! $ this -> getSchema ( ) -> hasTable ( $ this -> getName ( ) ) ) { $ this -> getSchema ( ) -> addTable ( $ this ) ; } }
Sets the table schema .
235,536
public function createColumn ( $ name , $ type , array $ properties = array ( ) ) { if ( is_string ( $ type ) ) { $ type = Type :: getType ( $ type ) ; } $ column = new Column ( $ name , $ type , $ properties ) ; $ this -> addColumn ( $ column ) ; return $ column ; }
Creates and adds a new column .
235,537
public function getColumn ( $ name ) { if ( ! $ this -> hasColumn ( $ name ) ) { throw SchemaException :: tableColumnDoesNotExist ( $ this -> getName ( ) , $ name ) ; } return $ this -> columns [ $ name ] ; }
Gets a table column .
235,538
public function dropColumn ( $ name ) { if ( ! $ this -> hasColumn ( $ name ) ) { throw SchemaException :: tableColumnDoesNotExist ( $ this -> getName ( ) , $ name ) ; } unset ( $ this -> columns [ $ name ] ) ; }
Drops a column .
235,539
public function createPrimaryKey ( array $ columnNames , $ name = null ) { if ( $ this -> hasPrimaryKey ( ) ) { throw SchemaException :: tablePrimaryKeyAlreadyExists ( $ this -> getName ( ) ) ; } $ primaryKey = new PrimaryKey ( $ name , $ columnNames ) ; $ this -> setPrimaryKey ( $ primaryKey ) ; $ this -> createIndex ...
Creates and adds a new primary key .
235,540
public function setPrimaryKey ( PrimaryKey $ primaryKey ) { foreach ( $ primaryKey -> getColumnNames ( ) as $ columnName ) { $ this -> getColumn ( $ columnName ) -> setNotNull ( true ) ; } $ this -> primaryKey = $ primaryKey ; }
Sets the table primery key .
235,541
public function dropPrimaryKey ( ) { if ( ! $ this -> hasPrimaryKey ( ) ) { throw SchemaException :: tablePrimaryKeyDoesNotExist ( $ this -> getName ( ) ) ; } foreach ( $ this -> getIndexes ( ) as $ index ) { if ( $ index -> hasSameColumnNames ( $ this -> getPrimaryKey ( ) -> getColumnNames ( ) ) ) { $ this -> dropInde...
Drops the table primary key .
235,542
public function createForeignKey ( array $ localColumnNames , $ foreignTable , array $ foreignColumnNames , $ onDelete = ForeignKey :: RESTRICT , $ onUpdate = ForeignKey :: RESTRICT , $ name = null ) { if ( $ foreignTable instanceof Table ) { $ foreignTable = $ foreignTable -> getName ( ) ; } $ foreignKey = new Foreign...
Creates and adds a new foreign key .
235,543
public function setForeignKeys ( array $ foreignKeys ) { $ this -> foreignKeys = array ( ) ; foreach ( $ foreignKeys as $ foreignKey ) { $ this -> addForeignKey ( $ foreignKey ) ; } }
Sets the table foreign keys .
235,544
public function getForeignKey ( $ name ) { if ( ! $ this -> hasForeignKey ( $ name ) ) { throw SchemaException :: tableForeignKeyDoesNotExist ( $ this -> getName ( ) , $ name ) ; } return $ this -> foreignKeys [ $ name ] ; }
Gets a foreign key
235,545
public function addForeignKey ( ForeignKey $ foreignKey ) { if ( $ this -> hasForeignKey ( $ foreignKey -> getName ( ) ) ) { throw SchemaException :: tableForeignKeyAlreadyExists ( $ this -> getName ( ) , $ foreignKey -> getName ( ) ) ; } foreach ( $ foreignKey -> getLocalColumnNames ( ) as $ columnName ) { if ( ! $ th...
Adds a foreign key to the table .
235,546
public function renameForeignKey ( $ oldName , $ newName ) { if ( ! $ this -> hasForeignKey ( $ oldName ) ) { throw SchemaException :: tableForeignKeyDoesNotExist ( $ this -> getName ( ) , $ oldName ) ; } if ( $ this -> hasForeignKey ( $ newName ) ) { throw SchemaException :: tableForeignKeyAlreadyExists ( $ this -> ge...
Renames a foreign key .
235,547
public function dropForeignKey ( $ name ) { if ( ! $ this -> hasForeignKey ( $ name ) ) { throw SchemaException :: tableForeignKeyDoesNotExist ( $ this -> getName ( ) , $ name ) ; } unset ( $ this -> foreignKeys [ $ name ] ) ; }
Drops a foreign key .
235,548
public function createIndex ( array $ columnNames , $ unique = false , $ name = null ) { $ index = new Index ( $ name , $ columnNames , $ unique ) ; $ this -> addIndex ( $ index ) ; return $ index ; }
Creates and adds a new index .
235,549
public function setIndexes ( array $ indexes ) { $ this -> indexes = array ( ) ; foreach ( $ indexes as $ index ) { $ this -> addIndex ( $ index ) ; } }
Sets the table indexes .
235,550
public function getIndex ( $ name ) { if ( ! $ this -> hasIndex ( $ name ) ) { throw SchemaException :: tableIndexDoesNotExist ( $ this -> getName ( ) , $ name ) ; } return $ this -> indexes [ $ name ] ; }
Gets a table index .
235,551
public function dropIndex ( $ name ) { if ( ! $ this -> hasIndex ( $ name ) ) { throw SchemaException :: tableIndexDoesNotExist ( $ this -> getName ( ) , $ name ) ; } unset ( $ this -> indexes [ $ name ] ) ; }
Drops an index .
235,552
public function createCheck ( $ constraint , $ name = null ) { $ check = new Check ( $ name , $ constraint ) ; $ this -> addCheck ( $ check ) ; return $ check ; }
Creates and adds a new check .
235,553
public function setChecks ( array $ checks ) { $ this -> checks = array ( ) ; foreach ( $ checks as $ check ) { $ this -> addCheck ( $ check ) ; } }
Sets the table chekcs .
235,554
public function getCheck ( $ name ) { if ( ! $ this -> hasCheck ( $ name ) ) { throw SchemaException :: tableCheckDoesNotExist ( $ this -> getName ( ) , $ name ) ; } return $ this -> checks [ $ name ] ; }
Gets a table check .
235,555
public function addCheck ( Check $ check ) { if ( $ this -> hasCheck ( $ check -> getName ( ) ) ) { throw SchemaException :: tableCheckAlreadyExists ( $ this -> getName ( ) , $ check -> getName ( ) ) ; } $ this -> checks [ $ check -> getName ( ) ] = $ check ; }
Adds a check to the table .
235,556
public function renameCheck ( $ oldName , $ newName ) { if ( ! $ this -> hasCheck ( $ oldName ) ) { throw SchemaException :: tableCheckDoesNotExist ( $ this -> getName ( ) , $ oldName ) ; } if ( $ this -> hasCheck ( $ newName ) ) { throw SchemaException :: tableCheckAlreadyExists ( $ this -> getName ( ) , $ newName ) ;...
Renames a check .
235,557
public function dropCheck ( $ name ) { if ( ! $ this -> hasCheck ( $ name ) ) { throw SchemaException :: tableCheckDoesNotExist ( $ this -> getName ( ) , $ name ) ; } unset ( $ this -> checks [ $ name ] ) ; }
Drops a check .
235,558
public function getHeaders ( ) { $ digest = Klarna :: digest ( Klarna :: colon ( $ this -> config [ 'eid' ] , $ this -> params [ 'currency' ] , $ this -> config [ 'secret' ] ) ) ; return array ( "Accept: {$this->accept}" , "Authorization: xmlrpc-4.2 {$digest}" ) ; }
Get the headers associated to this request
235,559
private function toArray ( ) { $ data = [ ] ; $ reflection = new ReflectionClass ( $ this ) ; foreach ( $ reflection -> getProperties ( ) as $ property ) { $ property -> setAccessible ( true ) ; $ data [ $ property -> getName ( ) ] = $ property -> getValue ( $ this ) ; } return $ data ; }
Convert the ViewModel object to an array
235,560
protected function makeModel ( TreeScope $ scope ) { $ model = clone $ this -> treeModelPrototype ; $ model -> setRootId ( $ scope -> getModelRootId ( ) ) ; $ model -> setPathPrefix ( $ scope -> getPathPrefix ( ) ) ; return $ model ; }
Make a sitetree model
235,561
public function dump ( $ file , $ content ) { $ fileWrited = file_put_contents ( $ file , '<?php return ' . var_export ( $ content , true ) . ';' ) ; if ( $ fileWrited === false ) { throw new \ Exception ( 'Unable to dump data into php file !' ) ; } }
Dump data into php file .
235,562
public function toArray ( $ deep = true ) { $ array = array ( ) ; foreach ( $ this -> __getSerialisablePropertyMap ( ) as $ key => $ value ) { if ( $ value instanceof AssociativeArray ) { $ array [ $ key ] = $ deep ? $ value -> toArray ( ) : $ value ; } else { $ array [ $ key ] = $ value ; } } return $ array ; }
Convert this into a regular php array .
235,563
public static function toAssociative ( $ array , $ recursive = false ) { $ associative = new AssociativeArray ( ) ; foreach ( $ array as $ key => $ value ) { if ( $ recursive && is_array ( $ value ) ) { $ associative [ $ key ] = self :: toAssociative ( $ value , true ) ; } else { $ associative [ $ key ] = $ value ; } }...
Convert a regular array to an associative array . optionally recursive is required .
235,564
protected function writeFile ( $ payload ) { $ file = $ this -> config [ 'file' ] [ 'path' ] . $ this -> config [ 'file' ] [ 'cookie_name' ] . '_' . $ this -> sessionId ; if ( ! $ handle = fopen ( $ file , 'c' ) ) { throw new \ Exception ( 'Could not open the session file in "' . $ this -> config [ 'file' ] [ 'path' ] ...
Writes the session file
235,565
protected function readFile ( ) { $ file = $ this -> config [ 'file' ] [ 'path' ] . $ this -> config [ 'file' ] [ 'cookie_name' ] . '_' . $ this -> sessionId ; if ( is_file ( $ file ) and $ handle = fopen ( $ file , 'r' ) ) { while ( ! flock ( $ handle , LOCK_SH ) ) ; if ( $ size = filesize ( $ file ) ) { $ payload = f...
Reads the session file
235,566
public function attribute ( $ name ) { $ v = $ this -> attributes ( ) -> $ name ; if ( ! empty ( $ v ) ) return ( string ) $ v ; }
Retrieves and attribute by name
235,567
public function xpathNSOne ( $ path , $ namespaces ) { $ result = $ this -> xpathNS ( $ path , $ namespaces ) ; if ( is_array ( $ result ) ) return current ( $ result ) ; return $ result ; }
Queries for a single result of an xpath query respecting the namespaces given
235,568
public function xpathOne ( $ path ) { $ result = $ this -> xpath ( $ path ) ; if ( is_array ( $ result ) ) return current ( $ result ) ; return $ result ; }
Query an xpath and return the first result
235,569
public function addChild ( $ name , $ value = null , $ namespace = null ) { $ esc_val = utf8_encode ( htmlentities ( $ value , ENT_QUOTES , 'UTF-8' , false ) ) ; if ( $ value == $ esc_val ) return parent :: addChild ( $ name , $ esc_val , $ namespace ) ; else { $ xml_field = parent :: addChild ( $ name , '' , $ namespa...
Adds a child to the current element but with automatic CDATA support .
235,570
public function replace ( SimpleXMLExtended $ child ) { $ node1 = dom_import_simplexml ( $ this ) ; $ dom_sxe = dom_import_simplexml ( $ child ) ; $ node2 = $ node1 -> ownerDocument -> importNode ( $ dom_sxe , true ) ; $ node1 -> parentNode -> replaceChild ( $ node2 , $ node1 ) ; return $ this ; }
Replaces the current element with the element specified
235,571
public function asPrettyXML ( $ level = 4 ) { $ xml = preg_replace ( '/\<\?xml([^\>\/]*)\>/' , '' , $ this -> asXML ( ) ) ; $ dom = new DOMDocument ( ) ; $ dom -> preserveWhiteSpace = false ; $ dom -> formatOutput = true ; $ dom -> loadXML ( $ xml ) ; $ formatted = $ dom -> saveXml ( ) ; return $ formatted ; }
Returns a properly indented form of the current XML tree
235,572
public static function valueOf ( $ str ) { $ key = get_called_class ( ) ; if ( ! array_key_exists ( $ key , self :: $ types ) ) return null ; $ str = str_replace ( array ( ' ' , '-' ) , '_' , trim ( $ str ) ) ; if ( array_key_exists ( $ str , self :: $ types [ $ key ] ) ) return self :: $ types [ $ key ] [ $ str ] ; re...
Attempts to match a string name to an enum element .
235,573
public function getParameter ( $ key ) { if ( $ this -> hasParameter ( $ key ) ) { return $ this -> parameters [ $ key ] ; } throw new \ InvalidArgumentException ( sprintf ( 'Wrong parameter key "%s" , invalid returned the key' , $ key ) ) ; }
Get the parameter of object event
235,574
public function read ( ) { $ this -> position ++ ; if ( $ this -> position >= count ( $ this -> buffer ) ) return false ; return $ this -> buffer [ $ this -> position ] ; }
Read the buffer and the current position
235,575
public function peek ( ) { $ peekPosition = $ this -> position + 1 ; if ( $ peekPosition >= count ( $ this -> buffer ) ) return - 1 ; return $ this -> buffer [ $ peekPosition ] ; }
Look one char ahead in the buffer
235,576
public function mergeAnd ( self $ filter ) { $ clause = "({$this->clause}) AND ({$filter->clause})" ; $ parameters = array_merge ( $ this -> parameters , $ filter -> parameters ) ; return new self ( $ clause , $ parameters ) ; }
Combines two filters together with a AND operator . Current and provided instances will not be altered ; the returned new instance will hold the result of the computation .
235,577
public function mergeOr ( self $ filter ) { $ clause = "({$this->clause}) OR ({$filter->clause})" ; $ parameters = array_merge ( $ this -> parameters , $ filter -> parameters ) ; return new self ( $ clause , $ parameters ) ; }
Combines two filters together with a OR operator . Current and provided instances will not be altered ; the returned new instance will hold the result of the computation .
235,578
private function resolve ( Definition $ definition ) { if ( ! $ this -> container -> isFrozen ( ) ) { throw new \ LogicException ( "cannot use create method on factory without freezing/compiling container" ) ; } $ subContainer = new ContainerBuilder ( ) ; $ subContainer -> merge ( $ this -> container ) ; $ subContainer...
todo heavy optimization likely to be needed for this method
235,579
public static function normalize ( string $ path ) : string { if ( strpos ( $ path , 'data://' ) === 0 ) { return $ path ; } $ path = self :: stringReplaceIgnoringStreamWrapper ( [ '\\' , '/' ] , DIRECTORY_SEPARATOR , $ path ) ; $ startOfPath = strpos ( $ path , '://' ) === false ? 0 : strpos ( $ path , '://' ) + strle...
Normalizes the supplied path
235,580
public static function combine ( string ... $ paths ) : string { $ paths = array_map ( [ __CLASS__ , 'normalize' ] , $ paths ) ; $ paths = array_filter ( $ paths , function ( $ path ) { return trim ( $ path , DIRECTORY_SEPARATOR ) !== '.' ; } ) ; $ combinedPath = implode ( DIRECTORY_SEPARATOR , $ paths ) ; return self ...
Combines the supplied paths
235,581
public static function routes ( ) { Route :: group ( [ 'namespace' => 'Auth' ] , function ( ) { Route :: group ( [ 'middleware' => [ 'guest' ] ] , function ( ) { Route :: get ( 'login' , 'LoginController@showLoginPage' ) -> name ( 'showLogin' ) ; Route :: post ( 'login' , 'LoginController@login' ) -> name ( 'login' ) ;...
Register auth routes
235,582
public function fillFromSearchResult ( ItemSearch $ item ) { $ query = parse_url ( $ item -> getLink ( ) , PHP_URL_QUERY ) ; parse_str ( $ query , $ query ) ; if ( empty ( $ query [ $ this -> getForm ( ) -> getName ( ) ] ) ) { return ; } return $ this -> fill ( $ query [ $ this -> getForm ( ) -> getName ( ) ] ) ; }
Fill from search result .
235,583
public function asString ( ) : string { return ( string ) $ this -> year . '-' . ( ( 10 > $ this -> month && strlen ( ( string ) $ this -> month ) === 1 ) ? ( '0' . $ this -> month ) : ( $ this -> month ) ) ; }
returns a string representation of the date object
235,584
protected function setViewData ( $ key , $ value = null ) { if ( is_array ( $ key ) ) { foreach ( $ key as $ name => $ data ) { view ( ) -> share ( $ name , $ data ) ; } } else { view ( ) -> share ( $ key , $ value ) ; } }
Pass data to the view .
235,585
function addPropertiesAndConstantsFromReflection ( ClassReflection $ classReflection ) { $ constants = $ classReflection -> getConstants ( ) ; foreach ( $ constants as $ name => $ value ) { $ this -> generator -> addProperty ( $ name , $ value , PropertyGenerator :: FLAG_CONSTANT ) ; } $ properties = $ classReflection ...
addPropertiesAndConstantsFromReflection - does what it s name says .
235,586
public function matchSchema ( $ json , $ schema ) { $ validator = new Validator ( ) ; if ( is_string ( $ json ) ) { $ json = $ this -> decode ( $ json , TRUE ) ; } elseif ( is_array ( $ json ) ) { $ json = ( object ) $ json ; } if ( is_string ( $ schema ) ) { $ schema = $ this -> decode ( $ schema , TRUE ) ; } elseif (...
Matches a JSON string or structure to a schema .
235,587
public function getSchemaErrorMessage ( ) { $ message = NULL ; foreach ( $ this -> lastSchemaErrors as $ error ) { $ message .= sprintf ( "[%s] %s\n" , $ error [ 'property' ] , $ error [ 'message' ] ) ; } if ( ! empty ( $ message ) ) { $ message = self :: FAIL_JSON_SCHEMA_MESSAGE . $ message ; } return $ message ; }
Returns the latest schema matching errors as a text message .
235,588
public static function fromNative ( ) { $ array = \ func_get_arg ( 0 ) ; $ keyValuePairs = array ( ) ; foreach ( $ array as $ arrayKey => $ arrayValue ) { $ key = new StringLiteral ( \ strval ( $ arrayKey ) ) ; if ( $ arrayValue instanceof \ Traversable || \ is_array ( $ arrayValue ) ) { $ value = Collection :: fromNat...
Returns a new Dictionary object
235,589
public function keys ( ) { $ count = $ this -> count ( ) -> toNative ( ) ; $ keysArray = new \ SplFixedArray ( $ count ) ; foreach ( $ this -> items as $ key => $ item ) { $ keysArray -> offsetSet ( $ key , $ item -> getKey ( ) ) ; } return new Collection ( $ keysArray ) ; }
Returns a Collection of the keys
235,590
public function values ( ) { $ count = $ this -> count ( ) -> toNative ( ) ; $ valuesArray = new \ SplFixedArray ( $ count ) ; foreach ( $ this -> items as $ key => $ item ) { $ valuesArray -> offsetSet ( $ key , $ item -> getValue ( ) ) ; } return new Collection ( $ valuesArray ) ; }
Returns a Collection of the values
235,591
public static function prepare ( string $ string , $ quotes = '/' ) : string { $ string = $ quotes ? preg_quote ( $ string , $ quotes ) : $ string ; return str_replace ( array_keys ( self :: REGEX_CHARS_REPLACEMENT ) , array_values ( self :: REGEX_CHARS_REPLACEMENT ) , $ string ) ; }
Prepare string to be safety used in regex
235,592
public function renderRequireJs ( $ compressed = true ) { if ( $ compressed && ! $ this -> buildFileExists ( ) ) { $ compressed = false ; } return $ this -> template -> render ( [ 'compressed' => $ compressed , 'build_path' => $ this -> config [ 'build_path' ] , 'config' => $ this -> provider -> getMainConfig ( ) , ] )...
Renders the RequireJs initialisation script .
235,593
protected function setDeviation ( $ mergedArray ) { if ( is_array ( $ this -> getDeviationArray1 ( ) ) && count ( $ this -> getDeviationArray1 ( ) ) > 0 ) { $ this -> setDeviationArray2 ( $ this -> deviationArray ( $ this -> getDeviationArray1 ( ) , $ mergedArray ) ) ; } else { $ this -> setDeviationArray1 ( $ this -> ...
set deviation arrays
235,594
public function getDB ( $ db = null ) { if ( null !== $ db && ! ( $ db instanceof DB ) ) throw new InvalidTypeException ( "Invalid database" ) ; return $ db ? : $ this -> _source_db ? : DI :: getInjector ( ) -> getInstance ( DB :: class ) ; }
Get a suitable database . Either the provided database argument or when null the source database . If source database is also null the default database is returned .
235,595
public function insert ( $ db = null ) { $ this -> getDAO ( $ this -> getDB ( $ db ) ) -> save ( $ this ) ; return $ this ; }
Insert the record to the database
235,596
public function delete ( $ db = null ) { $ this -> getDAO ( $ this -> getDB ( $ db ) ) -> delete ( $ this ) ; return $ this ; }
Remove the current record from the database it was retrieved from .
235,597
public function setSourceDB ( DB $ db ) { if ( $ db === null ) throw new \ InvalidArgumentException ( "Source database must not be null" ) ; $ this -> _source_db = $ db ; return $ this ; }
Set the database this object came from
235,598
public function assignRecord ( array $ record , DB $ database ) { $ dao = $ this -> getDAO ( ) ; $ table = $ dao -> getTable ( $ database ) ; $ pkey = $ table -> getPrimaryColumns ( ) ; if ( $ pkey !== null ) { $ this -> _id = array ( ) ; foreach ( $ pkey as $ col ) $ this -> _id [ $ col -> getName ( ) ] = $ record [ $...
Assign the provided record to this object .
235,599
public function setID ( $ id ) { $ dao = $ this -> getDAO ( ) ; $ pkey = $ dao -> getPrimaryKey ( ) ; if ( count ( $ pkey ) === 1 && is_scalar ( $ id ) ) { $ pcol = reset ( $ pkey ) ; $ this -> setField ( $ pcol -> getName ( ) , $ id ) ; } elseif ( is_array ( $ id ) && array_keys ( $ id ) === array_keys ( $ pkey ) ) { ...
Set the primary key of the model instance