idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
50,600
private function calculate ( ) { $ this -> second = 0 ; $ iters = 0 ; $ maxIters = 100 ; while ( $ iters < $ maxIters && ! $ this -> satisfied ( ) ) { if ( $ this -> params -> minute !== '*' && ( $ this -> minute != $ this -> params -> minute ) ) { if ( $ this -> minute > $ this -> params -> minute ) { $ this -> modify...
Calculates the next run timestamp .
50,601
private function satisfied ( ) { return ( $ this -> params -> minute === '*' || $ this -> params -> minute == $ this -> minute ) && ( $ this -> params -> hour === '*' || $ this -> params -> hour == $ this -> hour ) && ( $ this -> params -> day === '*' || $ this -> params -> day == $ this -> day ) && ( $ this -> params ...
Checks if the calculated next run timestamp satisfies the date parameters .
50,602
protected function matchFilters ( $ params ) { foreach ( $ this -> filters as $ key => $ expression ) { if ( ! isset ( $ params [ $ key ] ) ) { return false ; } if ( ! preg_match ( $ expression , $ params [ $ key ] ) ) { return false ; } } return true ; }
Validate params against given expressions .
50,603
protected function liefhierarchy_parse_options ( array $ options ) { foreach ( $ options as $ key => $ label ) { if ( is_array ( $ label ) ) { $ option = \ ran \ HTMLTag :: i ( $ this -> confs , 'option' , $ key ) -> set ( 'disabled' , '' ) ; $ this -> appendtagbody ( $ option -> render ( ) ) ; $ this -> liefhierarchy_...
Parses hierarchy input array .
50,604
function options_table ( array $ table , $ valuekey = null , $ labelkey = null , $ groupkey = null ) { $ optgroups = [ ] ; $ options = [ ] ; if ( $ groupkey === null ) { $ options = static :: associativeFrom ( $ table , $ valuekey , $ labelkey ) ; } else { foreach ( $ table as $ row ) { if ( $ row [ $ groupkey ] !== nu...
Inserts values by interpreting tablular array as is typically the result of a SQL call . If the table is nonstandard you can provide an idkey and titlekey to help the function retrieve the correct values .
50,605
protected static function associativeFrom ( array & $ table , $ key_ref = 'id' , $ value_ref = 'title' ) { $ assoc = [ ] ; foreach ( $ table as $ row ) { $ assoc [ $ row [ $ key_ref ] ] = $ row [ $ value_ref ] ; } return $ assoc ; }
Given an array converts it to an associative array based on the key and value reference provided .
50,606
public function add ( Route $ route ) : self { if ( $ route -> uri === "" || $ route -> method === 0b0 || $ route -> action === null ) { $ this -> logger -> error ( "Route incomplete. Unable to add" ) ; $ this -> logger -> debug ( "Incomplete Route" , [ $ route ] ) ; throw new Exception \ RouteIncompleteException ( "Re...
Add Route definition
50,607
protected function iterateRoutes ( string $ function ) { if ( ( $ route = $ function ( $ this -> routes ) ) !== false ) { $ this -> currentRoute = $ route ; return $ this -> currentRoute ; } return false ; }
Iterate internal Routes array
50,608
static function getColumnNames ( ) { $ class = get_called_class ( ) ; if ( ! isset ( self :: $ _columnNames [ $ class ] ) ) { self :: $ _columnNames [ $ class ] = array_keys ( static :: $ _columns ) ; } return self :: $ _columnNames [ $ class ] ; }
Access to array of column names
50,609
static function getQuery ( array $ params = array ( ) , Query $ q = null ) { $ model_class = get_called_class ( ) ; $ query_class = class_exists ( $ model_class . 'Query' ) ? $ model_class . 'Query' : 'Dabl\\Query\\Query' ; $ q = $ q ? clone $ q : new $ query_class ; $ tablename = $ q -> getTable ( ) ; if ( ! $ tablena...
Given an array of params construct a query where the keys are used as column names and values as query parameters . Will try to do fully - qualified names .
50,610
static function retrieveFromPool ( $ pk_value ) { if ( ! static :: $ _poolEnabled || null === $ pk_value ) { return null ; } $ pk_value = ( string ) $ pk_value ; if ( isset ( static :: $ _instancePool [ $ pk_value ] ) ) { return static :: $ _instancePool [ $ pk_value ] ; } return null ; }
Return the cached instance from the pool .
50,611
static function removeFromPool ( $ object_or_pk ) { $ pool_key = $ object_or_pk instanceof Model ? implode ( '-' , $ object_or_pk -> getPrimaryKeyValues ( ) ) : $ object_or_pk ; if ( isset ( static :: $ _instancePool [ $ pool_key ] ) ) { unset ( static :: $ _instancePool [ $ pool_key ] ) ; -- static :: $ _instancePoolC...
Remove the object from the instance pool .
50,612
static function doSelectRS ( Query $ q = null ) { $ q = $ q ? clone $ q : static :: getQuery ( ) ; if ( ! $ q -> getTable ( ) ) { $ q -> setTable ( static :: getTableName ( ) ) ; } return $ q -> doSelect ( static :: getConnection ( ) ) ; }
Executes a select query and returns the PDO result
50,613
static function doSelectIterator ( Query $ q = null ) { $ q = $ q ? clone $ q : static :: getQuery ( ) ; if ( ! $ q -> getTable ( ) ) { $ q -> setTable ( static :: getTableName ( ) ) ; } return new QueryModelIterator ( $ q , get_called_class ( ) ) ; }
Returns a simple Iterator that wraps PDOStatement for lightweight foreach
50,614
function hasPrimaryKeyValues ( ) { $ pks = static :: $ _primaryKeys ; if ( ! $ pks ) return false ; foreach ( $ pks as & $ pk ) if ( $ this -> $ pk === null ) return false ; return true ; }
Returns true if this table has primary keys and if all of the primary values are not null
50,615
function getPrimaryKeyValues ( ) { $ arr = array ( ) ; $ pks = static :: $ _primaryKeys ; foreach ( $ pks as & $ pk ) { $ arr [ ] = $ this -> { "get$pk" } ( ) ; } return $ arr ; }
Returns an array of all primary key values .
50,616
function castInts ( ) { foreach ( static :: $ _columns as $ column_name => & $ type ) { if ( $ this -> { $ column_name } === null || ! static :: isIntegerType ( $ type ) ) { continue ; } if ( '' === $ this -> { $ column_name } ) { $ this -> { $ column_name } = null ; continue ; } $ this -> { $ column_name } = ( int ) $...
Cast returned values from the database into integers where appropriate .
50,617
protected function insert ( ) { $ conn = static :: getConnection ( ) ; $ pk = static :: getPrimaryKey ( ) ; $ fields = array ( ) ; $ values = array ( ) ; $ placeholders = array ( ) ; foreach ( static :: $ _columns as $ column_name => & $ type ) { $ value = $ this -> $ column_name ; if ( $ value === null && ! $ this -> ...
Creates and executes INSERT query string for this object
50,618
protected function update ( ) { if ( ! static :: $ _primaryKeys ) { throw new RuntimeException ( 'This table has no primary keys' ) ; } $ column_values = array ( ) ; foreach ( $ this -> getModifiedColumns ( ) as $ column ) { $ column_values [ $ column ] = $ this -> $ column ; } if ( empty ( $ column_values ) ) { return...
Creates and executes UPDATE query string for this object . Returns the number of affected rows .
50,619
public function move ( $ directory ) { if ( false === is_string ( $ directory ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ directory ) ) , E_USER_ERROR ) ; } if ( false === is_dir ( $ directory ) ) { return trigger_error ( sprintf (...
Moves the current file to given directory
50,620
public function delete ( ) { if ( false !== $ this -> file -> getExists ( ) ) { if ( unlink ( $ this -> file -> getBasepath ( ) ) ) { $ this -> refresh ( ) ; } } return $ this ; }
Deletes current file
50,621
public function touch ( $ time = null , $ accesstime = null ) { if ( null !== $ time && false === ( '-' . intval ( $ time ) == '-' . $ time ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type integer, "%s" given' , __METHOD__ , gettype ( $ time ) ) , E_USER_ERROR ) ; } if ( null !== $ ...
Sets access and modification time of file . If the file does not exist it will be created
50,622
public function copy ( $ directory ) { if ( false === is_string ( $ directory ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ directory ) ) , E_USER_ERROR ) ; } if ( false === is_dir ( $ directory ) ) { return trigger_error ( sprintf (...
Makes a copy of the file to the destination directory
50,623
public function rename ( $ name ) { if ( false === is_string ( $ name ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ name ) ) , E_USER_ERROR ) ; } if ( false !== $ this -> file -> getExists ( ) ) { if ( rename ( $ this -> file -> getB...
Attempts to rename oldname to newname . If newname exists it will be overwritten
50,624
public function getContent ( ) { if ( false !== $ this -> file -> getExists ( ) ) { $ this -> refresh ( ) ; if ( false === $ this -> file -> getReadable ( ) ) { trigger_error ( sprintf ( 'File "%s" is not readable' , $ this -> file -> getBasepath ( ) ) , E_USER_ERROR ) ; } return file_get_contents ( $ this -> file -> g...
Returns the content of current file
50,625
public function append ( $ data ) { if ( false === is_string ( $ data ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ data ) ) , E_USER_ERROR ) ; } if ( false !== $ this -> file -> getExists ( ) ) { if ( false === is_writable ( $ this ...
Appends data to current file
50,626
public function prepend ( $ data ) { if ( false === is_string ( $ data ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ data ) ) , E_USER_ERROR ) ; } if ( false !== $ this -> file -> getExists ( ) ) { $ this -> refresh ( ) ; if ( false ...
Prepends data to current file
50,627
public function flush ( ) { if ( false !== $ this -> file -> getExists ( ) ) { if ( false === is_writable ( $ this -> file -> getBasepath ( ) ) ) { return trigger_error ( sprintf ( 'File "%s" passed to %s() is not writable' , $ this -> file -> getBasepath ( ) , __METHOD__ ) , E_USER_ERROR ) ; } $ fh = fopen ( $ this ->...
Empty the current file content
50,628
public function chmod ( $ type ) { if ( null !== $ type && false === ( '-' . intval ( $ type ) == '-' . $ type ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type integer, "%s" given' , __METHOD__ , gettype ( $ type ) ) , E_USER_ERROR ) ; } if ( false !== $ this -> file -> getExists ( ...
Changes current file mode
50,629
public function getAccessTime ( ) { if ( false !== $ this -> file -> getExists ( ) ) { $ this -> refresh ( ) ; return $ this -> file -> getAccessTime ( ) ; } }
Returns the access time of current file
50,630
public function getGroup ( ) { if ( false !== $ this -> file -> getExists ( ) ) { $ this -> refresh ( ) ; return $ this -> file -> getGroup ( ) ; } }
Returns group name of current file
50,631
public function getModificationTime ( ) { if ( false !== $ this -> file -> getExists ( ) ) { $ this -> refresh ( ) ; return $ this -> file -> getModificationTime ( ) ; } }
Returns the modification time of current file
50,632
public function getOwner ( ) { if ( false !== $ this -> file -> getExists ( ) ) { $ this -> refresh ( ) ; return $ this -> file -> getOwner ( ) ; } }
Returns the owner of current file
50,633
public function isReadable ( ) { if ( false !== $ this -> file -> getExists ( ) ) { $ this -> refresh ( ) ; return $ this -> file -> getReadable ( ) ; } return false ; }
Returns if the current file is readable
50,634
public function isWritable ( ) { if ( false !== $ this -> file -> getExists ( ) ) { $ this -> refresh ( ) ; return $ this -> file -> getWritable ( ) ; } return false ; }
Returns if the current file is writable
50,635
public function getMime ( ) { if ( null === $ this -> mime ) { $ this -> mime = new Mime ( ) ; } return Mime :: get ( $ this -> file -> getExtension ( ) ) ; }
Returns mime type of current file
50,636
public function has ( string $ name ) : bool { if ( isset ( $ this -> all [ $ name ] ) ) return true ; return false ; }
Check if header is present
50,637
protected function rebuildConnectionString ( ) { foreach ( $ this -> availableDrivers as $ driverName ) { if ( array_key_exists ( $ driverName , $ this -> connectionStrings ) ) { continue ; } $ ConnStringInterface = __NAMESPACE__ . '\\ConnectionString\\' . ucfirst ( $ driverName ) . 'ConnectionString' ; if ( class_exis...
Rebuild ConnectionString .
50,638
public function registerConnectionString ( ConnectionStringInterface $ connString , $ driverName ) { $ this -> connectionStrings [ $ driverName ] = $ connString ; if ( ! in_array ( $ driverName , $ this -> availableDrivers ) ) { $ this -> availableDrivers [ ] = $ driverName ; } $ this -> error -> setMessage ( null ) ; ...
Register new Connection String .
50,639
public function getAttr ( $ key = null ) { if ( null !== $ key ) { return isset ( $ this -> attr [ $ attribute ] ) ? $ this -> attr [ $ attribute ] : null ; } return $ this -> attr ; }
Get Current Attribute .
50,640
public function setAttrArray ( array $ attributes ) { foreach ( $ attributes as $ attribute => $ value ) { $ this -> setAttr ( $ attribute , $ value ) ; } }
Batch Setup Attribute .
50,641
private function __buildConfig ( array $ config ) { foreach ( $ config as $ key => $ conf ) { if ( $ key == 'driver' ) { $ this -> rawConfig [ 'type' ] = strtolower ( $ conf ) ; continue ; } if ( ! array_key_exists ( $ key , $ this -> rawConfig ) ) { $ this -> error -> setMessage ( sprintf ( "invalid config '%s', allow...
Build Self Config .
50,642
public function getRawConfig ( ) { $ raw = array ( ) ; foreach ( $ this -> rawConfig as $ key => $ conf ) { $ raw [ $ key ] = call_user_func_array ( array ( $ this , 'get' . ucfirst ( $ key ) ) , array ( ) ) ; } return $ raw ; }
Get Raw Config .
50,643
public function getPort ( ) { $ defaultPorts = array ( 'mysql' => '3306' , 'pgsql' => '5432' , 'oci' => '1521' , ) ; if ( ! $ this -> rawConfig [ 'port' ] && isset ( $ defaultPorts [ $ this -> getType ( ) ] ) ) { $ this -> rawConfig [ 'port' ] = $ defaultPorts [ $ this -> getType ( ) ] ; } return intval ( $ this -> raw...
Get Database Port .
50,644
public function getDsn ( ) { if ( $ this -> rawConfig [ 'dsn' ] ) { return $ this -> rawConfig [ 'dsn' ] ; } if ( isset ( $ this -> connectionStrings [ $ this -> getType ( ) ] ) ) { return $ this -> connectionStrings [ $ this -> getType ( ) ] -> getDsn ( ) ; } }
Get Database DSN .
50,645
public function preventNoLocalDriver ( $ prevented = true ) { if ( $ prevented && ! array_key_exists ( $ this -> getType ( ) , $ this -> connectionStrings ) ) { $ this -> availableDrivers [ ] = $ this -> getType ( ) ; $ this -> rebuildConnectionString ( ) ; } $ this -> preventNoLocalDriver = $ prevented ; }
Prevent error if driver is not available .
50,646
protected function bootBindings ( ) { $ this -> app -> singleton ( 'Lia\Addons\JWTAuth\JWTAuth' , function ( $ app ) { return $ app [ 'lia.jwt.auth' ] ; } ) ; $ this -> app -> singleton ( 'Lia\Addons\JWTAuth\Providers\User\UserInterface' , function ( $ app ) { return $ app [ 'lia.jwt.provider.user' ] ; } ) ; $ this -> ...
Bind some Interfaces and implementations .
50,647
protected function registerUserProvider ( ) { $ this -> app -> singleton ( 'lia.jwt.provider.user' , function ( $ app ) { $ provider = $ this -> config ( 'providers.user' ) ; $ model = $ app -> make ( $ this -> config ( 'user' ) ) ; return new $ provider ( $ model ) ; } ) ; }
Register the bindings for the User provider .
50,648
protected function registerJWTManager ( ) { $ this -> app -> singleton ( 'lia.jwt.manager' , function ( $ app ) { $ instance = new JWTManager ( $ app [ 'lia.jwt.provider.jwt' ] , $ app [ 'lia.jwt.blacklist' ] , $ app [ 'lia.jwt.payload.factory' ] ) ; return $ instance -> setBlacklistEnabled ( ( bool ) $ this -> config ...
Register the bindings for the JWT Manager .
50,649
protected function registerPayloadFactory ( ) { $ this -> app -> singleton ( 'lia.jwt.payload.factory' , function ( $ app ) { $ factory = new PayloadFactory ( $ app [ 'lia.jwt.claim.factory' ] , $ app [ 'request' ] , $ app [ 'lia.jwt.validators.payload' ] ) ; return $ factory -> setTTL ( $ this -> config ( 'ttl' ) ) ; ...
Register the bindings for the Payload Factory .
50,650
protected function determineClientIpAddress ( $ request ) { $ ipAddress = null ; $ serverParams = $ request -> getServerParams ( ) ; if ( isset ( $ serverParams [ 'REMOTE_ADDR' ] ) && $ this -> isValidIpAddress ( $ serverParams [ 'REMOTE_ADDR' ] ) ) { $ ipAddress = $ serverParams [ 'REMOTE_ADDR' ] ; } $ checkProxyHeade...
Find out the client s IP address from the headers available to us
50,651
protected function isValidIpAddress ( $ ip ) { $ flags = FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6 ; if ( filter_var ( $ ip , FILTER_VALIDATE_IP , $ flags ) === false ) { return false ; } return true ; }
Check that a given string is a valid IP address
50,652
public function offset ( $ date = null ) : string { $ offset = $ this -> offsetInSeconds ( $ date ) ; $ hours = intval ( abs ( $ offset ) / 3600 ) ; $ minutes = ( abs ( $ offset ) - ( $ hours * 3600 ) ) / 60 ; return sprintf ( '%s%02d%02d' , ( $ offset < 0 ? '-' : '+' ) , $ hours , $ minutes ) ; }
returns offset of the time zone
50,653
public function offsetInSeconds ( $ date = null ) : int { if ( null === $ date ) { return $ this -> timeZone -> getOffset ( new \ DateTime ( 'now' ) ) ; } return $ this -> timeZone -> getOffset ( Date :: castFrom ( $ date ) -> handle ( ) ) ; }
returns offset to given date in seconds
50,654
public function translate ( $ date ) : Date { $ handle = Date :: castFrom ( $ date ) -> handle ( ) ; $ handle -> setTimezone ( $ this -> timeZone ) ; return new Date ( $ handle ) ; }
translates a date from one timezone to a date of this timezone
50,655
public function getElementRegister ( ) { if ( $ this -> elementRegister === null ) { $ this -> elementRegister = new ElementRegister ( ) ; $ this -> initializeElementRegister ( $ this -> elementRegister ) ; } return $ this -> elementRegister ; }
Gets the element register .
50,656
protected function initializeElementRegister ( ElementRegister $ register ) { $ register -> set ( 'a' , new AnchorElement ( ) ) ; $ register -> set ( 'admonition' , new AdmonitionElement ( ) ) ; $ register -> set ( 'br' , new BreakElement ( ) ) ; $ register -> set ( 'code' , new CodeElement ( ) ) ; $ register -> set ( ...
Initializes athe element register .
50,657
public function getLink ( $ page , $ header = null ) { $ id = preg_replace ( '/[^a-z0-9\/]+/i' , '' , $ page ) ; $ link = $ this -> getBaseUrl ( ) . '/' . $ id ; if ( $ header !== null ) { $ link .= '#' . $ this -> createId ( $ header ) ; } else if ( $ id == 'index' ) { $ link = $ this -> getBaseUrl ( ) ; } return $ li...
Gets the link for the given source file .
50,658
public function build ( Generator $ generator ) { $ renderer = new DOMRenderer ( $ generator , $ this ) ; $ publisher = new Publisher ( $ generator , $ this ) ; $ pageManager = $ this -> loadPageManager ( $ generator ) ; while ( ! $ pageManager -> getQueue ( ) -> isEmpty ( ) ) { $ page = $ pageManager -> getQueue ( ) -...
Builds the source files .
50,659
public function run ( ) { $ method = strtoupper ( $ this -> getRequest ( ) -> getMethod ( ) ) ; $ collections = $ this -> resolveGroupAndWhen ( RouteCollector :: getRoutes ( ) ) ; if ( ! $ this -> hasAnyRouteInRequestMethod ( $ collections , $ method ) ) { $ this -> callRouteNotFoundCommand ( ) ; } $ collections = $ co...
Run the router and check requested uri
50,660
protected function dispatchCollection ( $ collection ) { $ group = isset ( $ collection [ 'group' ] ) ? $ collection [ 'group' ] : null ; $ content = $ this -> getActionDispatcher ( ) -> dispatch ( $ collection [ 'action' ] , $ group ) ; if ( is_string ( $ content ) ) { $ this -> sendContentString ( $ content , $ this ...
dispatch matched collection
50,661
protected function resolveGroupAndWhen ( $ collections ) { if ( count ( RouteCollector :: getGroups ( ) ) ) { $ collections = $ this -> resolveGroupCollections ( $ collections ) ; } if ( isset ( $ collections [ 'WHEN' ] ) ) { $ collections = $ this -> resolveWhenCollections ( $ collections [ 'WHEN' ] ) ; } if ( count (...
resolve group and when collections
50,662
protected function resolveWhenCollections ( array $ collections = [ ] ) { foreach ( $ collections as $ index => $ collection ) { if ( $ this -> getMatcher ( ) -> matchWhen ( $ collection [ 'uri' ] ) ) { RouteCollector :: $ firing [ 'when' ] = $ collection [ 'uri' ] ; app ( ) -> call ( $ collection [ 'action' ] , [ app ...
resolve when collections
50,663
private function resolveGroupCollections ( array $ groups = [ ] ) { foreach ( $ groups as $ index => $ group ) { RouteCollector :: $ firing [ 'group' ] = $ group ; app ( ) -> call ( $ group [ 'callback' ] , [ app ( 'route' ) ] ) ; unset ( RouteCollector :: $ firing [ 'group' ] ) ; RouteCollector :: removeGroup ( $ inde...
resolve the when collections
50,664
private function sendContentString ( $ content = '' , Request $ request ) { $ response = $ request -> getResponse ( ) ; $ response -> setContent ( $ content ) ; $ response -> send ( ) ; }
send the content
50,665
public function detect ( ) { $ detected = true ; if ( empty ( $ this -> ua ) ) { $ detected = false ; } else { if ( ! $ this -> isMSIE ( ) && ! $ this -> isChrome ( ) && ! $ this -> isFirefox ( ) && ! $ this -> isSafari ( ) && ! $ this -> isEdge ( ) && ! $ this -> isOpera ( ) ) { if ( ! $ this -> isOtherMobile ( ) ) { ...
Detects the various items from the user agent and returns what it can in the the array format desired by DeviceFeatureInfo . If nothing can be detected returns null .
50,666
private function isSafari ( ) { $ is = false ; if ( preg_match ( "/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//" , $ this -> ua , $ matches ) ) { if ( ! preg_match ( "/(PhantomJS|Silk|rekonq|OPR|Chrome|Android|Edge|bot)/" , $ this -> ua ) ) { $ is = true ; $ major = ( isset ( $ matches [ 2 ] ) ) ? $ matches [ 2 ] : n...
Determines if a browser is Safari by the user agent string .
50,667
private function isChrome ( ) { $ is = false ; if ( preg_match ( "/(Chrome|Chromium)\/([0-9\.]+)/" , $ this -> ua , $ matches ) ) { if ( ! preg_match ( "/(MRCHROME|FlyFlow|baidubrowser|bot|Edge)/i" , $ this -> ua ) ) { $ is = true ; $ version = $ matches [ 2 ] ; $ parts = explode ( '.' , $ matches [ 2 ] ) ; $ major = a...
Determines if a browser is chrome by the user agent string .
50,668
private function isEdge ( ) { if ( preg_match ( "/Edge (([0-9]+)\.?([0-9]*))/" , $ this -> ua , $ matches ) ) { if ( stripos ( $ this -> ua , 'bot' ) === false ) { $ this -> browser = "edge" ; $ this -> version = $ matches [ 1 ] ; $ this -> major = $ matches [ 2 ] ; $ this -> minor = $ matches [ 3 ] ; } } return false ...
Determines if a browser is Microsoft Edge by the user agent string .
50,669
private function isMSIE ( ) { $ is = false ; if ( preg_match ( "/MSIE (([0-9]+)\.?([0-9]*))/" , $ this -> ua , $ matches ) ) { $ is = true ; $ version = $ matches [ 1 ] ; $ major = $ matches [ 2 ] ; $ minor = $ matches [ 3 ] ; } elseif ( preg_match ( "/Trident\/[0-9]\.[0-9]; [^;]*[;\s]*rv:(([0-9]+)\.?([0-9]*))/" , $ th...
Determines if a browser is Internet Explorer by the user agent string .
50,670
private function isOpera ( ) { $ is = false ; if ( preg_match ( "/(Opera)\/9.80.*Version\/((\d+)\.(\d+)(?:\.(\d+))?)/" , $ this -> ua , $ matches ) ) { $ is = true ; $ version = $ matches [ 2 ] ; $ major = $ matches [ 3 ] ; $ minor = $ matches [ 4 ] ; } elseif ( preg_match ( "/Opera (([0-9]+)\.?([0-9]*))/" , $ this -> ...
Determines if a browser is Opera by the user agent string .
50,671
private function isOperaMobile ( ) { $ is = false ; $ android = false ; $ ios = false ; $ tablet = false ; $ phone = false ; $ touch = false ; if ( $ this -> browser == 'opera' || $ this -> isOpera ( ) ) { if ( preg_match ( "/(?:Mobile Safari).*(OPR)/" , $ this -> ua ) ) { $ is = true ; $ android = true ; } elseif ( pr...
Determines if the browser is the mobile or mini version of opera by the user agent string .
50,672
private function isChromeMobile ( ) { $ is = false ; $ android = false ; $ ios = false ; $ tablet = false ; $ phone = false ; if ( $ this -> browser == 'chrome' || $ this -> isChrome ( ) ) { if ( stripos ( $ this -> ua , 'android' ) !== false ) { $ is = true ; $ android = true ; $ tablet = ( stripos ( $ this -> ua , 'm...
Determines if the browser is Chrome on a mobile device by the user agent string .
50,673
private function isSafariMobile ( ) { $ is = false ; $ tablet = false ; $ phone = false ; if ( $ this -> browser == 'safari' || $ this -> isSafari ( ) ) { if ( preg_match ( "/(iPhone|iPod|iPad)/" , $ this -> ua , $ matches ) ) { $ is = true ; $ tablet = ( $ matches [ 1 ] == 'iPad' ) ; $ phone = ( $ matches [ 1 ] == 'iP...
Determines if the browser is Safari Mobile by the User Agent String .
50,674
private function isFirefoxMobile ( ) { $ is = false ; $ tablet = false ; $ phone = false ; $ android = false ; $ touch = true ; if ( $ this -> browser == 'firefox' || $ this -> isFirefox ( ) ) { if ( preg_match ( "/(Mobile|Tablet|TV)/" , $ this -> ua , $ matches ) ) { $ is = true ; $ tablet = ( $ matches [ 1 ] == 'Tabl...
Determines if the browser is Firefox Mobile by the User Agent string .
50,675
public function save ( $ savepath ) { $ result = move_uploaded_file ( $ this -> stored_filename , $ savepath ) ; if ( $ result === true ) { $ this -> stored_filename = $ savepath ; return true ; } else { return false ; } }
Save the uploaded file to a specific path .
50,676
protected static function createSlug ( string $ input , array $ rulesets = self :: SLUG_RULESETS , string $ separator = '-' ) : string { $ slugify = new Slugify ( [ 'rulesets' => $ rulesets , 'separator' => $ separator ] ) ; $ slug = $ slugify -> slugify ( $ input ) ; return $ slug ; }
Creates a slug from an input .
50,677
private function createJsonApiAdapter ( $ configName , ContainerBuilder $ container ) { $ serializerName = Utility :: getAliasedName ( 'api.serializer' ) ; $ definition = new Definition ( Utility :: getLibraryClass ( 'Api\JsonApiOrg\Serializer' ) ) ; $ definition -> setPublic ( false ) ; $ container -> setDefinition ( ...
Creates the jsonapi . org Adapter service definition .
50,678
private function loadAdapter ( $ adapterName , $ configName , array $ adapterConfig , ContainerBuilder $ container ) { if ( isset ( $ adapterConfig [ 'service' ] ) ) { $ container -> setAlias ( $ adapterName , Utility :: cleanServiceName ( $ adapterConfig [ 'service' ] ) ) ; return $ this ; } switch ( $ adapterConfig [...
Loads the Adapter service based on the adapter config .
50,679
private function loadConfiguration ( $ name , array $ restConfig , ContainerBuilder $ container ) { $ definition = new Definition ( Utility :: getLibraryClass ( 'Rest\RestConfiguration' ) , [ new Reference ( Utility :: getAliasedName ( 'util.validator' ) ) , ] ) ; $ definition -> setPublic ( false ) ; $ endpoint = $ re...
Loads the Rest config service based on the config .
50,680
private function loadKernel ( $ adapterName , $ configName , $ debug , ContainerBuilder $ container ) { $ definition = new Definition ( Utility :: getLibraryClass ( 'Rest\RestKernel' ) , [ new Reference ( $ adapterName ) , new Reference ( $ configName ) , ] ) ; $ definition -> addMethodCall ( 'enableDebug' , [ $ debug ...
Loads the Rest Kernel service based on the config .
50,681
private function doRefresh ( $ document , array & $ visited ) { $ oid = spl_object_hash ( $ document ) ; if ( isset ( $ visited [ $ oid ] ) ) { return ; } $ visited [ $ oid ] = $ document ; $ class = $ this -> dm -> getClassMetadata ( get_class ( $ document ) ) ; if ( ! $ class -> isEmbeddedDocument ) { if ( $ this -> ...
Executes a refresh operation on a document .
50,682
public function getAssociationPersister ( ) { if ( ! isset ( $ this -> associationPersister ) ) { $ this -> associationPersister = new Persister \ AssociationPersister ( $ this -> dm , $ this ) ; } return $ this -> associationPersister ; }
Get the association persister instance .
50,683
public function getDocumentIdentifier ( $ document ) { return isset ( $ this -> documentIdentifiers [ spl_object_hash ( $ document ) ] ) ? $ this -> documentIdentifiers [ spl_object_hash ( $ document ) ] : null ; }
Gets the identifier of a document .
50,684
public function size ( ) { $ count = 0 ; foreach ( $ this -> identityMap as $ documentSet ) { $ count += count ( $ documentSet ) ; } return $ count ; }
Calculates the size of the UnitOfWork . The size of the UnitOfWork is the number of documents in the identity map .
50,685
protected function supportsCommonTableExpressionQuery ( ) { $ driver = DB :: connection ( ) -> getDriverName ( ) ; if ( $ driver == 'mysql' ) { return true ; } if ( $ driver == 'sqlite' && \ SQLite3 :: version ( ) [ 'versionNumber' ] >= 3008003 ) { return true ; } return false ; }
Tests if the driver supports Common Table Expression .
50,686
public function getDescent ( $ id ) { $ key = $ this -> getCacheKey ( 'descent' , $ id ) ; if ( $ results = $ this -> cache -> get ( $ key ) ) { return $ results ; } $ this -> cache -> add ( $ key , $ results = $ this -> getRecursiveRetriever ( ) -> getDescent ( $ id ) , 2 ) ; return $ results ; }
Get all childs recursively .
50,687
protected function prepareVertices ( $ data ) { $ vertices = [ ] ; foreach ( $ data as $ content ) { $ content -> term_id = "$content->term_id" ; $ content -> parent_id = "$content->parent_id" ; if ( ! array_key_exists ( $ content -> term_id , $ vertices ) ) { $ vertices [ $ content -> term_id ] = new Vertex ( $ conten...
Prepare the vertices to create the graph .
50,688
public function getAncestryGraph ( $ id ) { $ data = $ this -> getAncestry ( $ id ) ; if ( count ( $ data ) == 0 ) { return [ null , null ] ; } $ this -> vertices = $ this -> prepareVertices ( $ data ) ; $ graph = new DirectedGraph ( ) ; foreach ( $ this -> vertices as $ vertex ) { $ graph -> add_vertex ( $ vertex ) ; ...
Get all parents recursively
50,689
public function setCity ( City $ city ) : void { $ this -> city = $ city -> getName ( ) ; $ this -> postCode = $ city -> getPostCode ( ) ; }
Set the value of post code and city through a City instance .
50,690
public function getIterator ( $ models = [ ] , $ requestedClassPath = '' ) { $ possiblePath = '' ; if ( $ requestedClassPath ) { $ possiblePath = $ this -> iteratorFactory -> getDefaultNamespaceAbs ( $ requestedClassPath ) ; if ( ! class_exists ( $ possiblePath ) ) { throw new \ Exception ( "Unable to find iterator '$p...
get the iterator specific to this class or a custom one if required
50,691
public function getInsertGenericSql ( array $ cols ) { $ sql = [ 'insert into' , "`{$this->getTableNameLazy()}`" , '(' ] ; $ sqlCols = [ ] ; foreach ( $ cols as $ col ) { $ sqlCols [ ] = "`$col`" ; } $ sql [ ] = implode ( ', ' , $ sqlCols ) ; $ sql [ ] = ') values (' ; $ sqlCols = [ ] ; foreach ( $ cols as $ col ) { $ ...
builds insert statement using cols provided
50,692
public function getUpdateGenericSql ( array $ cols ) { $ sql = [ 'update' , "`{$this->getTableNameLazy()}`" , 'set' ] ; $ sqlCols = [ ] ; foreach ( $ cols as $ col ) { $ sqlCols [ ] = "`$col` = :$col" ; } $ sql [ ] = implode ( ', ' , $ sqlCols ) ; $ sql [ ] = "where `id` = :id" ; return implode ( ' ' , $ sql ) ; }
builds update statement using cols provided
50,693
protected function scanDirectory ( string $ path , string $ parentDir ) : array { $ files = [ ] ; $ rdi = new \ RecursiveDirectoryIterator ( $ path , \ FilesystemIterator :: SKIP_DOTS | \ FilesystemIterator :: KEY_AS_FILENAME | \ FilesystemIterator :: CURRENT_AS_FILEINFO ) ; $ rii = new \ RecursiveIteratorIterator ( $ ...
Scans the given directory and its sub - directories returning a list of all the relative path to each file from the given marker .
50,694
private function loadIndexFile ( string $ indexFilepath ) : array { $ this -> status = IndexInterface :: STATUS_LOADED ; return \ unserialize ( \ file_get_contents ( $ indexFilepath ) ) ; }
Reads the file and unserializes it .
50,695
public function createTable ( BeanInterface $ bean , $ findCondition = "" ) { if ( $ this -> _table_factory instanceof TableFactoryInterface ) { return $ this -> _table_factory -> generateTable ( $ bean , $ findCondition , true ) ; } return false ; }
This function generates the Table based on the Bean and the search condition that is passed .
50,696
public function matches ( \ Neos \ ContentRepository \ Domain \ Model \ NodeData $ node ) { $ nodeIsMatchingNodeType = false ; for ( $ i = 0 ; $ i < $ this -> searchDepth ; $ i ++ ) { $ parentNode = $ node -> getParent ( ) ; if ( $ parentNode !== null ) { $ nodeType = $ parentNode -> getNodeType ( ) ; if ( $ this -> wi...
Returns TRUE if the given node has a parent of a specific nodetype
50,697
public function handleFilter ( $ filtererName , $ method , $ params , $ locals , $ globals ) { $ this -> allowTemplateCode = false ; $ this -> locals = $ locals ; $ this -> globals = $ globals ; $ this -> params = $ params ; if ( strlen ( $ method ) == 0 && $ this -> getDefaultMethod ( ) != null ) $ methodResolved = $ ...
This function is used to handle the call to the filterer method . It fires preHandle the specified filterer method then postHandle .
50,698
protected function readOption ( string $ key , $ fallback = null ) { $ value = get_option ( $ this -> prefix . $ key , $ fallback ?? false ) ; if ( false === $ value ) { return $ fallback ; } return $ value ; }
Read a single option from the persistence mechanism .
50,699
public function redirect ( ClientInterface $ client , string $ url , int $ status = 302 ) : EndPointInterface { $ client -> acceptResponse ( new Response \ RedirectResponse ( $ url , $ status ) ) ; return $ this ; }
Returns a RedirectResponse to the given URL .