idx
int64 0
60.3k
| question
stringlengths 64
4.24k
| target
stringlengths 5
618
|
|---|---|---|
17,500
|
protected function getDefaultAnnouncementFilter ( ) { $ filter = new AnnouncementFilter ( ) ; $ filter -> setInsideAssociationID ( $ this -> arguments [ self :: ARGUMENT_INSIDEASSOCIATIONID ] ) ; return $ filter ; }
|
Get the default announcement filter .
|
17,501
|
protected function getDefaultFunctionaryFilter ( ) { $ filter = new FunctionaryFilter ( ) ; $ filter -> setInsideAssociationID ( $ this -> arguments [ self :: ARGUMENT_INSIDEASSOCIATIONID ] ) ; return $ filter ; }
|
Get the default functionary filter .
|
17,502
|
protected function removeNullValuesFromArray ( $ array ) { $ result = [ ] ; foreach ( $ array as $ key => $ value ) { if ( isset ( $ value ) ) { if ( ( $ value instanceof \ TYPO3 \ CMS \ Extbase \ Persistence \ ObjectStorage && count ( $ value ) > 0 ) || ! ( $ value instanceof \ TYPO3 \ CMS \ Extbase \ Persistence \ ObjectStorage ) ) { $ result [ $ key ] = $ value ; } } } return $ result ; }
|
remove all null values from the array
|
17,503
|
protected function checkDateTime ( $ value , $ base = null ) { if ( is_null ( $ value ) ) { return $ value ; } if ( ! $ value instanceof \ DateTimeInterface ) { return $ this -> buildDateTimebyString ( $ value , $ base ) ; } else { return $ value ; } }
|
check a dateTime value
|
17,504
|
protected function buildDateTimebyString ( $ stringDate , $ base = null ) { if ( is_null ( $ base ) ) { $ base = time ( ) ; } try { $ base = $ base instanceof \ DateTimeInterface ? $ base -> format ( 'U' ) : strtotime ( ( MathUtility :: canBeInterpretedAsInteger ( $ base ) ? '@' : '' ) . $ base ) ; $ dateTimestamp = strtotime ( ( MathUtility :: canBeInterpretedAsInteger ( $ date ) ? '@' : '' ) . $ date , $ base ) ; $ date = new \ DateTime ( '@' . $ dateTimestamp ) ; $ date -> setTimezone ( new \ DateTimeZone ( date_default_timezone_get ( ) ) ) ; } catch ( \ Exception $ exception ) { throw new Exception ( '"' . $ date . '" could not be parsed by \DateTime constructor: ' . $ exception -> getMessage ( ) , 1241722579 ) ; } }
|
Build a DateTime of a String
|
17,505
|
public function postReminder ( ) { $ email = Input :: get ( 'email' ) ; try { $ this -> reminder -> send ( $ email ) ; return Redirect :: to ( "/user/recupero-success" ) -> with ( array ( "messageReminder" => L :: t ( 'Check your mail inbox, we sent you an email to recover your password.' ) ) ) ; } catch ( Pbi $ e ) { $ errors = $ this -> reminder -> getErrors ( ) ; return Redirect :: back ( ) -> withErrors ( $ errors ) ; } }
|
Invio token per set nuova password via mail
|
17,506
|
private function _getParameterPattern ( $ template ) { $ template = preg_replace ( '/\*/' , '.*?' , $ template ) ; return sprintf ( '#^%s$#' , preg_replace_callback ( self :: REGEX_PARAM , array ( $ this , '_typePatternCallback' ) , $ template ) ) ; }
|
Gets a pattern that can be used for parsing a template
|
17,507
|
public function getService ( string $ key , ServiceLocatorInterface $ serviceLocator , array $ extra = null ) : object { $ factory = $ this -> getFactories ( ) [ $ key ] ; if ( is_string ( $ factory ) === true ) { $ factory = new $ factory ( ) ; $ this -> factories [ $ key ] = $ factory ; } try { return $ factory -> createService ( $ key , $ serviceLocator , $ extra ) ; } catch ( Throwable $ exception ) { throw new ServiceCreateFailed ( $ key , $ exception ) ; } }
|
When the factory is a string a new instance will be created and replaces the string .
|
17,508
|
public function buildClassContext ( \ ReflectionClass $ reflection , $ hash , $ view = null ) { $ classContext = new ClassContext ( ) ; $ classContext -> hash = $ hash ; $ classContext = $ this -> handleExclusionPolicy ( $ reflection , $ classContext ) ; $ classContext -> views = $ view ; $ classContext = $ this -> handleView ( $ classContext ) ; return $ classContext ; }
|
Entry point to build the class context object . Currently only knows how to handle exclusion policy . Any new top level class annotations need a handler in here .
|
17,509
|
private function handleExclusionPolicy ( \ ReflectionClass $ reflection , ClassContext $ classContext ) { $ annot = $ this -> annotationReader -> getClassAnnotation ( $ reflection , '\Represent\Annotations\ExclusionPolicy' ) ; if ( ! is_null ( $ annot ) && $ annot -> getPolicy ( ) === ExclusionPolicyEnum :: BLACKLIST ) { $ classContext -> policy = ExclusionPolicyEnum :: BLACKLIST ; $ classContext = $ this -> generatePropertiesForBlackList ( $ reflection , $ classContext ) ; } else { $ classContext -> policy = ExclusionPolicyEnum :: WHITELIST ; $ classContext = $ this -> generatePropertiesForWhiteList ( $ reflection , $ classContext ) ; } return $ classContext ; }
|
Determines exclusion policy and hands off to the appropriate method . Defaults to white list
|
17,510
|
private function generatePropertiesForBlackList ( \ ReflectionClass $ reflection , ClassContext $ classContext ) { $ properties = $ reflection -> getProperties ( ) ; $ reader = $ this -> annotationReader ; array_walk ( $ properties , function ( $ property ) use ( $ classContext , $ reader ) { $ annotation = $ reader -> getPropertyAnnotation ( $ property , '\Represent\Annotations\Show' ) ; if ( $ annotation ) { $ classContext -> properties [ ] = $ property ; } } ) ; return $ classContext ; }
|
Decides what properties should be represented using the black list policy
|
17,511
|
private function handleView ( ClassContext $ classContext ) { $ properties = $ classContext -> properties ; $ reader = $ this -> annotationReader ; $ classContext -> properties = array_filter ( $ properties , function ( $ property ) use ( $ reader , $ classContext ) { $ annotation = $ reader -> getPropertyAnnotation ( $ property , '\Represent\Annotations\View' ) ; return $ annotation == null || in_array ( $ classContext -> views , $ annotation -> name ) ; } ) ; return $ classContext ; }
|
Takes ClassContext and checks that each property belongs to the given view .
|
17,512
|
public static function createChar ( $ name , $ size ) { $ field = new DatabaseField ( $ name , self :: TYPE_CHAR ) ; $ field -> m_constraint = intval ( $ size ) ; return $ field ; }
|
for creating a varchar .
|
17,513
|
public static function createVarchar ( $ name , $ size ) { $ field = new DatabaseField ( $ name , self :: TYPE_VARCHAR ) ; $ field -> m_constraint = intval ( $ size ) ; return $ field ; }
|
Create a VARCHAR field
|
17,514
|
public static function createInt ( $ name , $ size , $ autoInc = false ) { $ field = new DatabaseField ( $ name , self :: TYPE_INT ) ; $ field -> m_constraint = $ size ; $ field -> m_autoIncrementing = $ autoInc ; return $ field ; }
|
Creates an integer type field .
|
17,515
|
public static function createDecimal ( $ name , $ precisionBefore , $ precisionAfter ) { $ field = new DatabaseField ( $ name , self :: TYPE_DECIMAL ) ; $ field -> m_constraint = intval ( $ precisionBefore ) . ',' . intval ( $ precisionAfter ) ; return $ field ; }
|
Creates the DECIMAL field type
|
17,516
|
public function getFieldString ( ) { $ fieldString = "`" . $ this -> m_name . "` " . $ this -> m_type ; if ( $ this -> m_constraint != null ) { $ fieldString .= " (" . $ this -> m_constraint . ")" ; } if ( $ this -> isAutoIncrementing ( ) ) { $ fieldString .= " AUTO_INCREMENT" ; } if ( $ this -> m_default !== null ) { $ fieldString .= " DEFAULT " . $ this -> m_default ; } if ( ! $ this -> m_allowNull ) { $ fieldString .= " NOT NULL" ; } return $ fieldString ; }
|
Returns the text representing this field s definition inside a create table statement .
|
17,517
|
protected function _validate ( $ subject ) { $ errors = $ this -> _getValidationErrors ( $ subject ) ; if ( ! $ this -> _countIterable ( $ errors ) ) { return ; } throw $ this -> _throwValidationFailedException ( $ this -> __ ( 'Validation failed' ) , null , null , true , $ subject , $ errors ) ; }
|
Validates a subject .
|
17,518
|
public static function set ( $ name , $ handler = null ) { if ( ! is_array ( $ name ) ) { $ name = [ $ name => $ handler ] ; } static :: $ _handlers = static :: $ _handlers + $ name ; }
|
Sets or replaces one or several built - in validation rules .
|
17,519
|
public static function containsAll ( $ haystack , array $ needles ) { foreach ( $ needles as $ needle ) { if ( $ needle != '' && mb_strpos ( $ haystack , $ needle ) === false ) { return false ; } } return true ; }
|
Determine if a given string contains all given substring .
|
17,520
|
public function importJournalIssues ( $ oldJournalId , $ newJournalId , $ sectionIds ) { $ issuesSql = "SELECT * FROM issues WHERE journal_id = :id" ; $ issuesStatement = $ this -> dbalConnection -> prepare ( $ issuesSql ) ; $ issuesStatement -> bindValue ( 'id' , $ oldJournalId ) ; $ issuesStatement -> execute ( ) ; $ issues = $ issuesStatement -> fetchAll ( ) ; return $ this -> importIssues ( $ issues , $ newJournalId , $ sectionIds ) ; }
|
Imports issues of given journal
|
17,521
|
public static function error ( $ severity , $ message , $ file , $ line ) { if ( preg_match ( '/filemtime/' , $ message ) ) return ; elseif ( preg_match ( '/^Argument (\d+) passed to ([\w\\\\]+)::(\w+)\(\) must be an instance of ([\w\\\\]+), ([\w\\\\]+) given, called in ([\w\s\.\/_-]+) on line (\d+)/' , $ message , $ m ) ) throw new \ InvalidArgumentException ( "Argument {$m[1]} to {$m[2]}::{$m[3]}() should be an instance of {$m[4]}, {$m[5]} given" , $ severity , new \ ErrorException ( $ message , 0 , $ severity , $ m [ 6 ] , $ m [ 7 ] ) ) ; throw new \ ErrorException ( $ message , 0 , $ severity , $ file , $ line ) ; }
|
Default error handler - convert errors to ErrorExceptions .
|
17,522
|
public static function logException ( \ Exception $ error ) { if ( ! static :: isFatal ( $ error ) ) { $ location = $ error -> getFile ( ) . ':' . $ error -> getLine ( ) ; if ( ( $ error instanceof \ InvalidArgumentException ) && ( $ error -> getPrevious ( ) instanceof \ ErrorException ) ) $ location = $ error -> getPrevious ( ) -> getFile ( ) . ':' . $ error -> getPrevious ( ) -> getLine ( ) ; error_log ( get_class ( $ error ) . ': ' . $ error -> getMessage ( ) . " [{$location}]" ) ; } }
|
Log an exception to the error log .
|
17,523
|
public static function checkFatal ( ) { $ error = error_get_last ( ) ; if ( $ error && static :: isFatal ( $ error [ 'type' ] ) ) { Yolk :: exception ( new \ ErrorException ( $ error [ 'message' ] , 0 , $ error [ 'type' ] , $ error [ 'file' ] , $ error [ 'line' ] ) ) ; } }
|
Shutdown function to catch fatal errors .
|
17,524
|
protected static function isFatal ( $ error ) { if ( $ error instanceof \ Exception ) return false ; $ fatal = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR ; if ( $ error instanceof \ ErrorException ) $ error = $ error -> getSeverity ( ) ; return ( bool ) ( $ error & $ fatal ) ; }
|
Determine if an error code or Exception is a fatal error .
|
17,525
|
public function execute ( ) { if ( ! is_null ( $ this -> action ) ) { $ this -> setResult ( $ this -> action -> execute ( $ this -> request ) ) ; } else { $ this -> setResult ( new Payload ( null , 'valid' ) ) ; } }
|
Perform logic .
|
17,526
|
protected function parseResult ( ) { if ( is_null ( $ this -> result ) ) { $ this -> setCode ( self :: HTTP_INTERNAL_SERVER_ERROR ) ; } else { $ this -> setCode ( $ this -> parseStatusCode ( ) ) ; $ this -> setBody ( ) ; } }
|
Parse the resulting Action Payload .
|
17,527
|
protected function parseStatusCode ( ) { try { if ( ! array_key_exists ( $ this -> result -> getStatus ( ) , $ this -> getStatus ( ) ) ) { throw new MisconfiguredStatusException ( ) ; } return $ this -> getStatus ( ) [ $ this -> result -> getStatus ( ) ] ; } catch ( MisconfiguredStatusException $ e ) { return self :: HTTP_INTERNAL_SERVER_ERROR ; } catch ( Exception $ e ) { return self :: HTTP_BAD_REQUEST ; } }
|
Parse the resulting Payload status to a HTTP code .
|
17,528
|
public function getApiContext ( $ prefix = false ) { if ( empty ( $ this -> apiContext ) ) { return $ this -> apiContext ; } $ apiContextExplode = explode ( '/' , $ this -> apiContext ) ; unset ( $ apiContextExplode [ 1 ] ) ; $ genericApiContext = implode ( '/' , $ apiContextExplode ) ; if ( $ prefix ) { return $ genericApiContext . '/' ; } return $ this -> apiContext ; }
|
Get API Context
|
17,529
|
public function getSource ( ) { if ( ! $ this -> hasSource ( ) ) { throw new ResponseException ( self :: PROP_SOURCE . ' is not set.' ) ; } return $ this -> get ( self :: PROP_SOURCE ) ; }
|
gets the source of the response
|
17,530
|
public static function create ( $ modelAlias = null , Criteria $ criteria = null ) { if ( $ criteria instanceof ChildSkillReferenceQuery ) { return $ criteria ; } $ query = new ChildSkillReferenceQuery ( ) ; if ( null !== $ modelAlias ) { $ query -> setModelAlias ( $ modelAlias ) ; } if ( $ criteria instanceof Criteria ) { $ query -> mergeWith ( $ criteria ) ; } return $ query ; }
|
Returns a new ChildSkillReferenceQuery object .
|
17,531
|
public function filterByReference ( $ reference , $ comparison = null ) { if ( $ reference instanceof \ gossi \ trixionary \ model \ Reference ) { return $ this -> addUsingAlias ( SkillReferenceTableMap :: COL_REFERENCE_ID , $ reference -> getId ( ) , $ comparison ) ; } elseif ( $ reference instanceof ObjectCollection ) { if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } return $ this -> addUsingAlias ( SkillReferenceTableMap :: COL_REFERENCE_ID , $ reference -> toKeyValue ( 'PrimaryKey' , 'Id' ) , $ comparison ) ; } else { throw new PropelException ( 'filterByReference() only accepts arguments of type \gossi\trixionary\model\Reference or Collection' ) ; } }
|
Filter the query by a related \ gossi \ trixionary \ model \ Reference object
|
17,532
|
public function useReferenceQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinReference ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Reference' , '\gossi\trixionary\model\ReferenceQuery' ) ; }
|
Use the Reference relation Reference object
|
17,533
|
protected static function getFacadeClass ( ) { $ base = App :: make ( 'database.base' ) ; $ tables = Config :: get ( 'database.tables' ) ; return new RegisterDispatcher ( $ base , $ tables ) ; }
|
get the register dispatcher facade
|
17,534
|
private function getDbTypesForProperties ( TableRow $ tableRow ) { $ dbTypes = [ ] ; foreach ( $ tableRow -> properties ( ) as $ propName => $ prop ) { $ dbTypes [ $ tableRow :: toDbColumnName ( $ propName ) ] = $ tableRow :: getDbTypeForProperty ( $ propName ) ; } return $ dbTypes ; }
|
Db types need to be an array in the same order as the properties
|
17,535
|
public static function getSystemTemporaryDirectory ( ) { $ tempDir = @ sys_get_temp_dir ( ) ; if ( is_string ( $ tempDir ) ) { $ tempDir = str_replace ( DIRECTORY_SEPARATOR , '/' , ( string ) $ tempDir ) ; if ( $ tempDir !== '/' ) { $ tempDir = rtrim ( $ tempDir , '/' ) ; } } else { $ tempDir = '' ; } if ( $ tempDir === '' || ! is_dir ( $ tempDir ) ) { throw new Exception \ PathNotFound ( $ tempDir , 'Unable to detect the system temporary directory.' ) ; } return $ tempDir ; }
|
Get the path of the system temporary directory .
|
17,536
|
public function getNewPath ( $ suffix = '' ) { $ result = $ this -> getPath ( ) . '/' . $ this -> uniqueCounter . ( string ) $ suffix ; ++ $ this -> uniqueCounter ; return $ result ; }
|
Get the path of a new item inside this directory .
|
17,537
|
public function getPath ( ) { if ( $ this -> path === null ) { $ parentDirectory = $ this -> parentDirectory ; if ( $ parentDirectory === '' ) { $ parentDirectory = static :: getSystemTemporaryDirectory ( ) ; } else { if ( ! is_dir ( $ parentDirectory ) ) { throw new Exception \ PathNotFound ( $ parentDirectory ) ; } } if ( ! is_writable ( $ parentDirectory ) ) { throw new Exception \ PathNotWritable ( $ parentDirectory ) ; } for ( ; ; ) { $ tempNam = @ tempnam ( $ parentDirectory , 'PCH' ) ; if ( $ tempNam === false ) { throw new Exception \ PathNotCreated ( "{$parentDirectory}/<TEMPORARY>" ) ; } @ unlink ( $ tempNam ) ; if ( @ mkdir ( $ tempNam ) ) { break ; } } $ this -> path = rtrim ( str_replace ( DIRECTORY_SEPARATOR , '/' , $ tempNam ) , '/' ) ; } return $ this -> path ; }
|
Get the path to the volatile directory .
|
17,538
|
private function supplementGetArray ( ) { if ( empty ( $ _SERVER [ "REQUEST_URI" ] ) ) { return ; } $ queryStringBegins = strpos ( $ _SERVER [ "REQUEST_URI" ] , '?' ) ; if ( empty ( $ queryStringBegins ) ) { return ; } $ queryString = substr ( $ _SERVER [ "REQUEST_URI" ] , $ queryStringBegins + 1 ) ; $ getArray = array ( ) ; parse_str ( $ queryString , $ getArray ) ; foreach ( $ getArray as $ variable => $ value ) { $ this -> getParams [ $ variable ] = $ this -> cleanVariable ( $ value ) ; } }
|
Some servers will not populate the remaining get params because of the mod rewrite redirect
|
17,539
|
private function initializeAndCleanSuperGlobal ( & $ superGlobal , & $ localStorage ) { $ localStorage = [ ] ; if ( ! empty ( $ superGlobal ) ) { foreach ( $ superGlobal as $ variableName => $ variableValue ) { $ localStorage [ $ variableName ] = $ this -> cleanVariable ( $ variableValue ) ; } } }
|
Initialize local storage of a super global and kill the super global version
|
17,540
|
private function cleanVariable ( $ input ) { if ( is_string ( $ input ) ) { if ( $ this -> shouldSanitizeInput ) { return trim ( strip_tags ( $ input ) ) ; } else { return trim ( $ input ) ; } } else { return $ input ; } }
|
Cleans a variable from input
|
17,541
|
public function request ( $ variable ) { $ order = ini_get ( 'request_order' ) ; if ( empty ( $ order ) ) { $ order = ini_get ( 'variables_order' ) ; } $ len = strlen ( $ order ) ; for ( $ i = 0 ; $ i < $ len ; ++ $ i ) { $ character = strtoupper ( $ order [ $ i ] ) ; if ( $ character == 'G' ) { if ( $ this -> get ( $ variable ) ) return $ this -> get ( $ variable ) ; } else if ( $ character == 'P' ) { if ( $ this -> post ( $ variable ) ) return $ this -> post ( $ variable ) ; } else if ( $ character == 'C' ) { if ( $ this -> cookie ( $ variable ) ) return $ this -> cookie ( $ variable ) ; } } return null ; }
|
Check get post and cookie for return
|
17,542
|
public function get ( $ variable = null , $ default = '' , $ validator = null ) { $ value = $ this -> returnLocalParam ( 'getParams' , $ variable , $ default ) ; return $ value ; }
|
Return a GET parameter enter null for the entire array
|
17,543
|
public function post ( $ variable = null , $ default = '' , $ validator = null ) { $ value = $ this -> returnLocalParam ( 'postParams' , $ variable , $ default ) ; return $ value ; }
|
Return a POSt parameter enter null for the entire array
|
17,544
|
public function setCookie ( $ variable , $ value ) { if ( ! empty ( $ value ) ) { $ this -> cookieParams [ $ variable ] = $ value ; return ; } unset ( $ this -> cookieParams [ $ variable ] ) ; }
|
Set the current page s instance of a cookie value . Does not actually set a cookie
|
17,545
|
private function returnLocalParam ( $ localStorage , $ variable , $ default = false ) { if ( ! empty ( $ variable ) ) { if ( isset ( $ this -> { $ localStorage } [ $ variable ] ) ) { return $ this -> { $ localStorage } [ $ variable ] ; } else { return $ default ; } } else { return $ this -> { $ localStorage } ; } }
|
Return a stored local variable
|
17,546
|
public function addOption ( array $ config ) { $ opt = new Option ; $ opt -> setAttributes ( $ config ) ; $ this -> addChild ( $ opt ) ; }
|
Adds an option given the config array .
|
17,547
|
public function setAttribute ( $ name , $ value ) { if ( strtolower ( $ name ) == 'value' ) { $ this -> setSelectedOption ( $ value ) ; } else { parent :: setAttribute ( $ name , $ value ) ; } }
|
Handles the value attribute . If the value attribute is set the option with the attribute s value is then selected .
|
17,548
|
public static function getResourceIdFromUrl ( $ url ) { $ url = rtrim ( $ url , '/' ) ; $ parts = explode ( '/' , $ url ) ; return ( int ) array_pop ( $ parts ) ; }
|
Gets the resource ID from a given URL
|
17,549
|
public static function getSafeDateProperty ( \ stdClass $ object , ... $ properties ) { $ val = self :: getSafeProperty ( $ object , ... $ properties ) ; if ( $ val === null ) { return null ; } $ val = preg_replace ( '/\.\d+/' , '' , $ val ) ; return new Carbon ( $ val ) ; }
|
Returns a Carbon object for a given date time .
|
17,550
|
public static function getSafeDatePropertyFromTimestamp ( \ stdClass $ object , ... $ properties ) { $ val = self :: getSafeProperty ( $ object , ... $ properties ) ; if ( $ val === null || ! \ is_numeric ( $ val ) ) { return null ; } $ return = new Carbon ( ) ; $ return -> setTimestamp ( $ val ) ; return $ return ; }
|
Returns a carbon object for a given timestamp .
|
17,551
|
public static function getSafeCollectionProperty ( \ stdClass $ object , ... $ properties ) { $ property = self :: getSafeProperty ( $ object , ... $ properties ) ; if ( $ property === null || ! is_array ( $ property ) ) { return [ ] ; } return $ property ; }
|
Returns a collection of objects for the given property map .
|
17,552
|
protected function checkRoleResource ( $ role , $ resource ) { $ resource = $ this -> checkResource ( $ resource ) ; $ role = $ this -> checkRole ( $ role ) ; $ roleId = ( $ role -> getRoleId ( ) == null ) ? StorageInterface :: ALL_ROLES : $ role -> getRoleId ( ) ; $ resrcId = ( $ resource -> getResourceId ( ) == null ) ? StorageInterface :: ALL_RESOURCES : $ resource -> getResourceId ( ) ; if ( ! isset ( $ this -> permission [ $ roleId ] [ self :: NODE_RESOURCES ] [ $ resrcId ] [ self :: NODE_PERMISSION ] ) ) { $ this -> permission [ $ roleId ] [ self :: NODE_RESOURCES ] [ $ resrcId ] [ self :: NODE_PERMISSION ] = [ ] ; } return $ this ; }
|
Check if already exists a resource permission node config if not exist add it
|
17,553
|
private function addRegisterMappingsPass ( ContainerBuilder $ container ) { $ mappings = array ( realpath ( __DIR__ . '/Resources/config/doctrine/model' ) => 'Silvestra\Component\Media\Model' , ) ; $ ormCompilerClass = 'Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass' ; if ( class_exists ( $ ormCompilerClass ) ) { $ container -> addCompilerPass ( DoctrineOrmMappingsPass :: createXmlMappingDriver ( $ mappings ) ) ; } }
|
Add register mappings pass .
|
17,554
|
private function replaceParam ( $ name , $ value , & $ schema ) { $ schema = str_replace ( sprintf ( '##!%s!##' , $ name ) , $ value , $ schema ) ; }
|
Method for manipulating . skm files variables
|
17,555
|
private function loadMigrations ( ) { $ migrated = [ ] ; $ rows = $ this -> db -> table ( '_migrations' ) -> select ( 'name' ) -> all ( ) ; foreach ( $ rows as $ row ) { $ migrated [ ] = $ row [ 'name' ] ; } $ migrations = [ ] ; $ files = [ ] ; list_files ( $ files , $ this -> migrationPath , [ 'php' ] ) ; foreach ( $ files as $ file ) { $ name = basename ( $ file , '.php' ) ; $ migrations [ $ name ] = $ file ; } $ migrations = array_merge ( $ migrations , $ this -> pluginMigrations ( ) ) ; foreach ( $ migrations as $ name => $ file ) { if ( in_array ( $ name , $ migrated ) ) { unset ( $ migrations [ $ name ] ) ; } } return $ migrations ; }
|
Load the outstanding migrations .
|
17,556
|
private function loadPerformedMigrations ( $ batch ) { $ migrations = [ ] ; $ pluginMigrations = $ this -> pluginMigrations ( ) ; $ rows = $ this -> db -> table ( '_migrations' ) -> select ( 'name' ) -> whereCondition ( 'batch = ?' , [ $ batch ] ) -> all ( ) ; foreach ( $ rows as $ row ) { $ name = $ row [ 'name' ] ; $ migrations [ $ name ] = isset ( $ pluginMigrations [ $ name ] ) ? $ pluginMigrations [ $ name ] : $ this -> migrationPath . DIRECTORY_SEPARATOR . $ name . '.php' ; } return $ migrations ; }
|
Load the migrations already performed by batch number
|
17,557
|
private function pluginMigrations ( ) { $ files = [ ] ; if ( file_exists ( $ this -> pluginManifestOfMigrations ) ) { $ basePath = base_path ( ) ; $ migrations = include $ this -> pluginManifestOfMigrations ; foreach ( $ migrations as $ name => $ file ) { $ files [ $ name ] = $ basePath . DIRECTORY_SEPARATOR . $ file ; } } return $ files ; }
|
Read migrations included by plugins .
|
17,558
|
private function makeMigrationClass ( $ name , $ file ) { if ( ( $ pos = strpos ( $ name , '_' ) ) === false ) { throw new MigrationException ( 'Name of the migration file "' . $ name . '.php" is invalid. Format "<timestamp>_<classname>.php" expected.' ) ; } $ class = substr ( $ name , $ pos + 1 ) ; require_once $ file ; if ( ! class_exists ( $ class , false ) ) { throw new MigrationException ( 'Migration class "' . $ class . '" is not defined in file "' . $ name . '.php".' ) ; } $ instance = new $ class ; if ( ! ( $ instance instanceof Migration ) ) { throw new MigrationException ( 'Migration "' . $ name . '" is invalid. The Class have to implements the interface \Core\Services\Contracts\Migration.' ) ; } return $ instance ; }
|
Create a new migration class .
|
17,559
|
public function resolveDataValue ( $ data ) { if ( $ data instanceof Data ) { return $ this -> setData ( $ data ) ; } elseif ( is_array ( $ data ) ) { return $ this -> setData ( new Data ( $ data ) ) ; } throw new \ InvalidArgumentException ( "Data must be View\Data or array value" ) ; }
|
Resolves value for data
|
17,560
|
public function getContents ( ) { ob_start ( ) ; $ callback = $ this -> hasContext ( ) ? $ this -> getClosureForContextRender ( ) : $ this -> callContextRender ( ) ; call_user_func ( $ callback , $ this -> getFilename ( ) , $ this -> getData ( ) -> toArray ( ) ) ; return ltrim ( ob_get_clean ( ) ) ; }
|
Get the contents of View
|
17,561
|
public function validate ( ) { $ this -> validateRequiredParameters ( ) ; if ( ! is_string ( $ this -> getId ( ) ) ) { throw new InvalidPersonException ( "The id parameter must be a string" ) ; } if ( ! is_string ( $ this -> getName ( ) ) ) { throw new InvalidPersonException ( "The name parameter must be a string" ) ; } if ( $ this -> hasParameter ( 'type' ) ) { if ( ! is_string ( $ this -> getType ( ) ) ) { throw new InvalidPersonException ( "The type parameter must be a string" ) ; } } if ( $ this -> hasParameter ( 'email' ) ) { if ( ! filter_var ( $ this -> getEmail ( ) , FILTER_VALIDATE_EMAIL ) ) { throw new InvalidPersonException ( "The email parameter must be a valid email" ) ; } } if ( $ this -> hasParameter ( 'phone' ) ) { if ( ! is_string ( $ this -> getPhone ( ) ) ) { throw new InvalidPersonException ( "The phone parameter must be a string" ) ; } } if ( $ this -> hasParameter ( 'fax' ) ) { if ( ! is_string ( $ this -> getFax ( ) ) ) { throw new InvalidPersonException ( "The fax parameter must be a string" ) ; } } if ( $ this -> hasParameter ( 'address' ) ) { $ address = $ this -> getAddress ( ) ; if ( ! ( $ address instanceof Address ) ) { throw new InvalidPersonException ( "The address parameter must be an Address object" ) ; } $ address -> validate ( ) ; } }
|
Validate this person . If the person is invalid InvalidPersonException is thrown .
|
17,562
|
public function setAddress ( $ value ) { if ( is_array ( $ value ) ) { $ value = new Address ( $ value ) ; } return $ this -> setParameter ( 'address' , $ value ) ; }
|
Set person address
|
17,563
|
public static function execute ( $ value , $ classBaseName , array $ args = [ ] ) { $ plugins = static :: getPluginManager ( ) ; $ filter = $ plugins -> get ( $ classBaseName , $ args ) ; return $ filter -> filter ( $ value ) ; }
|
Returns a value filtered through a specified filter class without requiring separate instantiation of the filter object .
|
17,564
|
function presence ( $ show , $ status = null ) { $ data = $ this -> reqdata ( ) ; $ data [ 'nick' ] = $ this -> endpoint -> nick ; $ data [ 'show' ] = $ show ; if ( $ status ) $ data [ 'status' ] = $ status ; return $ this -> request ( 'presences/show' , $ data , 'POST' ) ; }
|
Send presence .
|
17,565
|
public function status ( $ to , $ show ) { $ data = array_merge ( $ this -> reqdata ( ) , array ( 'nick' => $ this -> endpoint -> nick , 'to' => $ to , 'show' => $ show , ) ) ; return $ this -> request ( 'statuses' , $ data , 'POST' ) ; }
|
Send endpoint chat status to other .
|
17,566
|
public function getNameAttribute ( $ value ) { if ( $ this -> person ) return $ this -> person -> givenName . ' ' . $ this -> person -> sn1 . ' ' . $ this -> person -> sn2 ; return $ value ; }
|
Accessor for name attribute .
|
17,567
|
public function getEmailFromUser ( ) { $ email = null ; try { $ email = $ this -> email ; } catch ( \ Exception $ e ) { return $ this -> getEmailFromPerson ( $ this -> person_id ) ; } if ( ! $ email ) { return $ this -> getEmailFromPerson ( $ this -> person_id ) ; } return $ email ; }
|
Get email from user .
|
17,568
|
protected function getEmailFromPerson ( $ personId ) { if ( $ personId ) { try { return \ Scool \ EbreEscoolModel \ Person :: find ( $ personId ) -> person_email ; } catch ( \ Exception $ e ) { info ( $ e -> getMessage ( ) ) ; } } return null ; }
|
Get email from person .
|
17,569
|
protected function response ( ) { if ( $ this -> responseObject ) { return $ this -> responseObject ; } $ this -> responseObject = new Response ; return $ this -> responseObject ; }
|
Get the response factory instance
|
17,570
|
public function getIsicV4 ( ) : ? string { if ( ! $ this -> hasIsicV4 ( ) ) { $ this -> setIsicV4 ( $ this -> getDefaultIsicV4 ( ) ) ; } return $ this -> isicV4 ; }
|
Get isic v4
|
17,571
|
protected function _resolveIterator ( Traversable $ iterator , $ test = null , $ limit = null ) { $ origIterator = $ iterator ; if ( ! is_callable ( $ test ) ) { $ test = function ( Traversable $ subject ) { return $ subject instanceof Iterator ; } ; } if ( is_null ( $ limit ) ) { $ limit = 100 ; } else { $ limit = $ this -> _normalizeInt ( $ limit ) ; } $ i = 0 ; while ( ! $ test ( $ iterator ) && $ i < $ limit ) { if ( ! ( $ iterator instanceof IteratorAggregate ) ) { break ; } $ _it = $ iterator -> getIterator ( ) ; if ( $ iterator === $ _it ) { throw $ this -> _createOutOfRangeException ( $ this -> __ ( 'Infinite recursion: looks like the traversable wraps itself on level %1$d' , [ $ i ] ) , null , null , $ origIterator ) ; } $ iterator = $ _it ; ++ $ i ; } if ( ! $ test ( $ iterator ) ) { throw $ this -> _createOutOfRangeException ( $ this -> __ ( 'The deepest iterator is not a match (limit is %1$d)' , [ $ limit ] ) , null , null , $ origIterator ) ; } return $ iterator ; }
|
Finds the deepest iterator that matches .
|
17,572
|
public function send ( MessageInterface $ message , $ target ) { $ msg = $ message -> getMessageString ( ) . "\n" ; if ( strpos ( $ target , ':' ) ) { list ( $ host , $ port ) = explode ( ':' , $ target ) ; } else { $ host = $ target ; $ port = self :: DEFAULT_TCP_PORT ; } $ sock = fsockopen ( $ host , $ port , $ errorCode , $ errorMsg , $ this -> timeout ) ; if ( $ sock === false ) { throw new \ RuntimeException ( "Error connecting to {$server}: [{$errorCode}] {$errorMsg}" ) ; } $ written = fwrite ( $ sock , $ msg ) ; fclose ( $ sock ) ; if ( $ written != strlen ( $ msg ) ) { throw new \ RuntimeException ( "Error sending message to {$server} not all bytes sent." ) ; } return $ this ; }
|
Send the syslog to target host using the TCP protocol . Automatically adds a \ n character to end of the message string
|
17,573
|
protected function loadConfigurationGroups ( ) { collect ( config ( 'flame' ) ) -> each ( function ( $ item , $ key ) { $ this -> loadViewsFrom ( $ item [ 'path' ] , $ key ) ; } ) ; }
|
Loads the flame configuration groups from your configuration file . Each group will be located via the view hint given by the namespace name .
|
17,574
|
public static function getInstance ( $ pClass , array $ pArgs = array ( ) ) { if ( strpos ( $ pClass , Agl :: AGL_CORE_POOL ) === 0 or strpos ( $ pClass , Agl :: AGL_MORE_POOL ) === 0 ) { $ moduleArr = explode ( '/' , $ pClass ) ; $ moduleArr = array_map ( 'ucfirst' , $ moduleArr ) ; if ( count ( $ moduleArr ) == 2 ) { $ moduleArr [ ] = $ moduleArr [ 1 ] ; } if ( strpos ( $ pClass , Agl :: AGL_MORE_POOL ) === 0 ) { self :: $ _loadedModules [ strtolower ( implode ( '/' , $ moduleArr ) ) ] = true ; } $ path = '\\' . Autoload :: AGL_POOL . '\\' . implode ( '\\' , $ moduleArr ) ; if ( empty ( $ pArgs ) ) { return new $ path ( ) ; } else { $ reflect = new ReflectionClass ( $ path ) ; return $ reflect -> newInstanceArgs ( $ pArgs ) ; } } else if ( strpos ( $ pClass , ModelInterface :: APP_PHP_HELPER_DIR ) === 0 ) { return self :: getHelper ( str_replace ( ModelInterface :: APP_PHP_HELPER_DIR . '/' , '' , $ pClass ) ) ; } else if ( strpos ( $ pClass , ModelInterface :: APP_PHP_DIR ) === 0 ) { return self :: getModel ( str_replace ( ModelInterface :: APP_PHP_DIR . '/' , '' , $ pClass ) ) ; } else if ( strpos ( $ pClass , CollectionInterface :: APP_PHP_DIR ) === 0 ) { return self :: getCollection ( str_replace ( CollectionInterface :: APP_PHP_DIR . '/' , '' , $ pClass ) ) ; } try { $ reflect = new ReflectionClass ( $ pClass ) ; return $ reflect -> newInstanceArgs ( $ pArgs ) ; } catch ( ReflectionException $ e ) { return NULL ; } }
|
Create a new instance of the requested class .
|
17,575
|
public static function getSingleton ( $ pClass , array $ pArgs = array ( ) ) { if ( strpos ( $ pClass , Agl :: AGL_CORE_POOL ) === 0 or strpos ( $ pClass , Agl :: AGL_MORE_POOL ) === 0 ) { $ moduleArr = explode ( '/' , $ pClass ) ; if ( count ( $ moduleArr ) == 2 ) { $ moduleArr [ ] = $ moduleArr [ 1 ] ; $ pClass = implode ( '/' , $ moduleArr ) ; } } $ registryKey = '_singleton/' . strtolower ( $ pClass ) ; $ instance = Registry :: get ( $ registryKey ) ; if ( ! $ instance ) { $ instance = self :: getInstance ( $ pClass , $ pArgs ) ; if ( $ instance === NULL ) { return NULL ; } Registry :: set ( $ registryKey , $ instance ) ; } return $ instance ; }
|
Create a new instance of the requested class as a singleton .
|
17,576
|
public static function getModel ( $ pModel , array $ pFields = array ( ) ) { $ fileName = strtolower ( $ pModel ) ; $ className = $ fileName . ModelInterface :: APP_SUFFIX ; if ( Agl :: isInitialized ( ) ) { $ modelPath = APP_PATH . Agl :: APP_PHP_DIR . ModelInterface :: APP_PHP_DIR . DS . $ fileName . Agl :: PHP_EXT ; if ( is_readable ( $ modelPath ) ) { return self :: getInstance ( $ className , array ( $ pModel , $ pFields ) ) ; } else { return new Model ( $ pModel , $ pFields ) ; } } else { return new Model ( $ pModel , $ pFields ) ; } }
|
Return an instance of the requested model .
|
17,577
|
public static function getCollection ( $ pCollection ) { $ fileName = strtolower ( $ pCollection ) ; $ className = $ fileName . CollectionInterface :: APP_SUFFIX ; if ( Agl :: isInitialized ( ) ) { $ collectionPath = APP_PATH . Agl :: APP_PHP_DIR . CollectionInterface :: APP_PHP_DIR . DS . $ fileName . Agl :: PHP_EXT ; if ( is_readable ( $ collectionPath ) ) { return self :: getInstance ( $ className , array ( $ pCollection ) ) ; } else { return new Collection ( $ pCollection ) ; } } else { return new Collection ( $ pCollection ) ; } }
|
Return an instance of the requested collection .
|
17,578
|
public function clean ( Response $ response ) { $ body = $ response -> json ( ) ; $ resources = $ body [ "list" ] [ "resources" ] ; $ cleaned = array_pop ( $ resources ) ; return $ cleaned ; }
|
This method process the response data to remove all unnecessary fields in the response
|
17,579
|
public static function foreground ( $ color ) { list ( $ red , $ green , $ blue ) = str_split ( substr ( $ color , 1 ) , 2 ) ; $ red = hexdec ( $ red ) ; $ green = hexdec ( $ green ) ; $ blue = hexdec ( $ blue ) ; return ( $ red < 200 && $ green < 100 && $ blue < 200 ) ? self :: WHITE : self :: BLACK ; }
|
Returns a colour string for use as a foreground colour with the specified background colour .
|
17,580
|
private function isStandardPort ( ) { return ( $ this -> scheme === self :: HTTP && $ this -> port === self :: HTTP_PORT ) || ( $ this -> scheme === self :: HTTPS && $ this -> port === self :: HTTPS_PORT ) ; }
|
Check if Uri use a standard port .
|
17,581
|
private function normalizeScheme ( $ scheme ) { if ( ! is_string ( $ scheme ) && ! method_exists ( $ scheme , '__toString' ) ) { throw new InvalidArgumentException ( 'Uri scheme must be a string' ) ; } $ scheme = str_replace ( '://' , '' , strtolower ( ( string ) $ scheme ) ) ; if ( ! isset ( $ this -> validSchema [ $ scheme ] ) ) { throw new InvalidArgumentException ( 'Uri scheme must be one of: "", "https", "http"' ) ; } return $ scheme ; }
|
Normalize scheme part of Uri .
|
17,582
|
private function normalizePath ( $ path ) { if ( ! is_string ( $ path ) && ! method_exists ( $ path , '__toString' ) ) { throw new InvalidArgumentException ( 'Uri path must be a string' ) ; } $ path = $ this -> urlEncode ( $ path ) ; if ( empty ( $ path ) ) { return '' ; } if ( $ path [ 0 ] !== '/' ) { return $ path ; } return '/' . ltrim ( $ path , '/' ) ; }
|
Normalize path part of Uri and ensure it is properly encoded ..
|
17,583
|
function flushStacked_abbr ( ) { $ out = array ( ) ; foreach ( $ this -> stack [ 'abbr' ] as $ k => $ tag ) { if ( ! isset ( $ tag [ 'unstacked' ] ) ) { array_push ( $ out , ' *[' . $ tag [ 'text' ] . ']: ' . $ tag [ 'title' ] ) ; $ tag [ 'unstacked' ] = true ; $ this -> stack [ 'abbr' ] [ $ k ] = $ tag ; } } if ( ! empty ( $ out ) ) { $ this -> out ( "\n\n" . implode ( "\n" , $ out ) ) ; } }
|
flush stacked abbr tags
|
17,584
|
public static function parse ( string $ data ) : self { if ( preg_match_all ( '/([^:\r\n]+):\s+([^\r\n]*(\r\n[ \t][^\r\n]+)*)\r\n/' , $ data , $ matches , PREG_SET_ORDER ) === false ) { throw new FormatException ( 'Invalid header format' ) ; } foreach ( $ matches as $ match ) { $ value = preg_replace ( '/\r\n[ \t]([^\r\n]+)/' , ' $1' , $ match [ 2 ] ) ; $ headers [ $ match [ 1 ] ] = $ value ; } return new self ( $ headers ) ; }
|
Parses headers from a string .
|
17,585
|
public function get ( string $ name ) : string { $ name = strtolower ( $ name ) ; return isset ( $ this -> headers [ $ name ] ) ? $ this -> headers [ $ name ] : '' ; }
|
Gets the value of a header .
|
17,586
|
public function findTemplateFile ( $ filename ) { foreach ( $ this -> dir as $ index => $ dirname ) { if ( is_dir ( $ dirname ) && file_exists ( $ dirname . '/' . $ filename ) ) { return $ dirname . '/' . $ filename ; } } return null ; }
|
Find a file in the template directories
|
17,587
|
public function setVars ( $ vars , $ clear = false ) { if ( $ clear ) { $ this -> vars = $ vars ; } else { if ( is_array ( $ vars ) ) $ this -> vars = array_merge ( $ this -> vars , $ vars ) ; } return $ this ; }
|
Set a bunch of variables at once using an associative array .
|
17,588
|
protected function compileFileBody ( $ file ) { $ tempFilePath = $ this -> tempFolder ( ) . '/' . $ file -> subPathsPath ( ) . $ file -> name ( ) . '-body' . ( $ this -> config [ 'compress' ] ? '-c' : '' ) . '.' . $ file -> type ( ) ; $ dir = pathinfo ( $ tempFilePath , PATHINFO_DIRNAME ) ; if ( ! is_dir ( $ dir ) ) { mkdir ( $ dir , 0775 , true ) ; } $ recompile = true ; if ( is_file ( $ tempFilePath ) ) { $ tempFileMTime = filemtime ( $ tempFilePath ) ; if ( filemtime ( $ file -> originalFilePath ( ) ) <= $ tempFileMTime ) { $ recompile = false ; } } if ( $ recompile ) { $ processor = new Processor \ Processor ( $ this ) ; $ compiledFile = $ processor -> compileFile ( $ file ) ; $ compiledFile = $ this -> compressCompiledFile ( $ file -> type ( ) , $ compiledFile ) ; file_put_contents ( $ tempFilePath , $ compiledFile ) ; } return [ 'file' => $ file , 'tempFilePath' => $ tempFilePath ] ; }
|
Compiles the file without executing directives .
|
17,589
|
protected function getSplatCallVars ( $ args ) { $ isSplatCall = false ; $ variables = [ ] ; foreach ( $ args as $ arg ) { if ( $ arg -> unpack ) { $ isSplatCall = true ; } $ variables [ ] = $ arg -> value ; } if ( ! $ isSplatCall ) { return ; } return $ variables ; }
|
Get variables of the splat function call .
|
17,590
|
protected function splatToCallUserFuncArray ( $ callee , $ variables ) { $ totalVars = count ( $ variables ) ; $ splatVar = $ variables [ $ totalVars - 1 ] ; $ mergeVars = [ ] ; for ( $ i = 0 ; $ i < $ totalVars - 1 ; $ i ++ ) { $ mergeVars [ ] = $ variables [ $ i ] ; } return new Expr \ FuncCall ( new Name ( 'call_user_func_array' ) , [ $ callee , new Expr \ FuncCall ( new Name ( 'array_merge' ) , [ new Expr \ Array_ ( $ mergeVars ) , $ splatVar ] ) ] ) ; }
|
Splact function call to call_user_func_array .
|
17,591
|
function write ( $ filename , $ content ) { if ( ! Config :: read ( 'App.Base.enable_cache' ) ) { return ; } $ expire = time ( ) + ( $ this -> getConfig ( 'cache_expiration' ) * 60 ) ; $ filename = md5 ( $ filename ) ; $ filepath = $ this -> getConfig ( 'cache_path' ) . $ filename . '.tmp' ; if ( ! $ fp = @ fopen ( $ filepath , 'w' ) ) { Loader :: getClass ( 'Sky.core.Log' ) -> write ( 400 , 'Unable to write cache file: ' . $ filepath ) ; Exceptions :: showError ( 'error' , "Unable to write cache file: " . $ filepath ) ; } if ( flock ( $ fp , LOCK_EX ) ) { fwrite ( $ fp , $ expire . 'T_SKY . $ content ) ; flock ( $ fp , LOCK_UN ) ; } else { Loader :: getClass ( 'Sky.core.Log' ) -> write ( 300 , 'Unable to secure a file lock for file at: ' . $ filepath ) ; return ; } fclose ( $ fp ) ; @ chmod ( $ filepath , 0755 ) ; }
|
Write or create new cache file
|
17,592
|
function read ( $ filename ) { $ filename = md5 ( $ filename ) ; $ filepath = $ this -> getConfig ( 'cache_path' ) . $ filename . '.tmp' ; if ( ! file_exists ( $ filepath ) ) { return FALSE ; } if ( ! $ fp = @ fopen ( $ filepath , 'r' ) ) { return FALSE ; } flock ( $ fp , LOCK_SH ) ; $ cache = '' ; if ( filesize ( $ filepath ) > 0 ) { $ cache = fread ( $ fp , filesize ( $ filepath ) ) ; } flock ( $ fp , LOCK_UN ) ; fclose ( $ fp ) ; if ( ! preg_match ( "/(\d+T_SKY , $ cache , $ match ) ) { return FALSE ; } if ( time ( ) >= trim ( str_replace ( 'TS- , '' , $ match [ '1' ] ) ) ) { if ( is_writable ( $ filepath ) ) { @ unlink ( $ filepath ) ; return FALSE ; } } return str_replace ( $ match [ '0' ] , '' , $ cache ) ; }
|
read and get cache file
|
17,593
|
public function reset ( ) { $ this -> status = NULL ; $ this -> body = NULL ; $ this -> headers = NULL ; $ this -> info = array ( ) ; }
|
Reset the Response Object
|
17,594
|
protected function extractInfo ( $ curlResource ) { $ this -> info = curl_getinfo ( $ curlResource ) ; foreach ( static :: $ _CURL_EXTRA_INFO as $ option ) { $ this -> info [ $ option ] = curl_getinfo ( $ curlResource , $ option ) ; } $ this -> status = $ this -> info [ 'http_code' ] ; }
|
Extract the information from the Curl Request via curl_getinfo Setup the Status property to be equal to the http_code
|
17,595
|
public static function factory ( $ options = null ) { if ( null === $ options ) { if ( ! isset ( self :: $ loaders [ self :: STANDARD_AUTOLOADER ] ) ) { $ autoloader = self :: getStandardAutoloader ( ) ; $ autoloader -> register ( ) ; self :: $ loaders [ self :: STANDARD_AUTOLOADER ] = $ autoloader ; } return ; } if ( ! is_array ( $ options ) && ! ( $ options instanceof Traversable ) ) { throw new Zend_Loader_Exception_InvalidArgumentException ( 'Options provided must be an array or Traversable' ) ; } foreach ( $ options as $ class => $ options ) { if ( ! isset ( self :: $ loaders [ $ class ] ) ) { $ autoloader = self :: getStandardAutoloader ( ) ; if ( ! class_exists ( $ class ) && ! $ autoloader -> autoload ( $ class ) ) { throw new Zend_Loader_Exception_InvalidArgumentException ( sprintf ( 'Autoloader class "%s" not loaded' , $ class ) ) ; } if ( version_compare ( PHP_VERSION , '5.3.7' , '>=' ) ) { if ( ! is_subclass_of ( $ class , 'Zend_Loader_SplAutoloader' ) ) { throw new Zend_Loader_Exception_InvalidArgumentException ( sprintf ( 'Autoloader class %s must implement Zend\\Loader\\SplAutoloader' , $ class ) ) ; } } if ( $ class === self :: STANDARD_AUTOLOADER ) { $ autoloader -> setOptions ( $ options ) ; } else { $ autoloader = new $ class ( $ options ) ; } $ autoloader -> register ( ) ; self :: $ loaders [ $ class ] = $ autoloader ; } else { self :: $ loaders [ $ class ] -> setOptions ( $ options ) ; } } }
|
Factory for autoloaders
|
17,596
|
public static function unregisterAutoloader ( $ autoloaderClass ) { if ( ! isset ( self :: $ loaders [ $ autoloaderClass ] ) ) { return false ; } $ autoloader = self :: $ loaders [ $ autoloaderClass ] ; spl_autoload_unregister ( array ( $ autoloader , 'autoload' ) ) ; unset ( self :: $ loaders [ $ autoloaderClass ] ) ; return true ; }
|
Unregister a single autoloader by class name
|
17,597
|
protected static function getStandardAutoloader ( ) { if ( null !== self :: $ standardAutoloader ) { return self :: $ standardAutoloader ; } $ stdAutoloader = substr ( strrchr ( self :: STANDARD_AUTOLOADER , '_' ) , 1 ) ; if ( ! class_exists ( self :: STANDARD_AUTOLOADER ) ) { } $ loader = new Zend_Loader_StandardAutoloader ( ) ; self :: $ standardAutoloader = $ loader ; return self :: $ standardAutoloader ; }
|
Get an instance of the standard autoloader
|
17,598
|
public function open ( ) : string { return $ this -> htmlComment ? '<!--' . str_replace ( ' , '--' . chr ( 0xC ) . '>' , substr ( $ this -> line -> getContent ( ) , 1 ) ) : '<?php /* ' . substr ( $ this -> line -> getContent ( ) , 2 ) ; }
|
Opening this node and returning node opener .
|
17,599
|
public static function getAll ( array $ only = [ ] , array $ exclude = [ ] , $ alias = false ) { return $ alias === true ? ArrayHelper :: only ( static :: $ classAliases , $ only , $ exclude ) : ArrayHelper :: only ( static :: $ classNames , $ only , $ exclude ) ; }
|
Returns all configs .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.