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 \ Ob...
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 = st...
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 ) { ...
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 -> cr...
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 -> han...
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 )...
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 ->...
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 ( ...
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 ) { ...
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 ( ) ; $...
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...
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 -> getPr...
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 :: H...
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 $ gener...
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...
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 ...
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 ==...
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 ) ; } }...
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...
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 ( $ ...
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 ...
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_ex...
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 ( $ ...
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' ] ; $...
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 ;...
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...
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" ) ; ...
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 = $ t...
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 , $ error...
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 ) {...
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 = imp...
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 ;...
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 ;...
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 [ $ ...
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 ; ...
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 ( ! em...
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...
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 ) ) { ...
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_use...
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 ( $ f...
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 ( $ fi...
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 ( ...
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 ] ) ;...
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_StandardAutol...
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 .