idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
11,800
private function checkMethodExists ( $ method ) { if ( ! $ this -> controllerClass -> hasMethod ( $ method ) ) { throw new MissingControllerMethodException ( sprintf ( "Method %s::%s() is not defined in controller." , $ this -> controllerClass -> getShortName ( ) , $ method ) ) ; } }
Check if controller class has the provided method name
11,801
public static function getLogger ( $ level = null ) { if ( empty ( $ level ) ) { $ level = static :: DEFAULT_LEVEL ; } if ( empty ( static :: $ logger ) ) { static :: setLogger ( $ level ) ; } return static :: $ logger ; }
Get logger object
11,802
public static function setLogger ( $ level = null , $ logger = null ) { if ( empty ( $ level ) ) { $ level = static :: DEFAULT_LEVEL ; } if ( ! empty ( $ logger ) ) { static :: $ logger = $ logger ; return ; } static :: $ logger = new \ Monolog \ Logger ( "log" ) ; $ handler = static :: getHandler ( $ level ) ; static ...
Set logger object
11,803
public static function setColors ( array $ colors = array ( ) ) { if ( ! empty ( $ colors ) ) { static :: $ colors = $ colors ; return ; } static :: $ colors = array ( \ Monolog \ Logger :: DEBUG => 'purple' , \ Monolog \ Logger :: INFO => 'cyan' , \ Monolog \ Logger :: NOTICE => 'green' , \ Monolog \ Logger :: WARNING...
Set log message colors configuration
11,804
public static function setFormatter ( $ formatter = null ) { if ( ! empty ( $ formatter ) ) { static :: $ formatter = $ formatter ; return ; } static :: $ formatter = new \ Monolog \ Formatter \ ColorLineFormatter ( "[c=%color%]%message%[/c]\n" , null , true , true ) ; }
Set log formatter
11,805
public static function getHandler ( $ level = null ) { if ( empty ( $ level ) ) { $ level = static :: DEFAULT_LEVEL ; } if ( empty ( static :: $ handler ) ) { static :: setHandler ( $ level ) ; } return static :: $ handler ; }
Get log handler
11,806
public static function setHandler ( $ level = null , $ handler = null ) { if ( empty ( $ level ) ) { $ level = static :: DEFAULT_LEVEL ; } if ( ! empty ( $ handler ) ) { static :: $ handler = $ handler ; return ; } static :: $ handler = new \ Monolog \ Handler \ StdoutHandler ( constant ( "\Monolog\Logger::$level" ) ) ...
Set log handler
11,807
private function regenerateDependencyMap ( ) : DependencyMap { $ loader = new DependencyLoader ( $ this -> namespaceRegistry , $ this -> logger ) ; foreach ( $ this -> dependencyFiles as $ dependencyFile ) { $ loader -> importFile ( $ dependencyFile ) ; } return new DependencyMap ( $ loader -> getDependencyMap ( ) ) ; ...
Regenerates the dependency map
11,808
public function getIterator ( ) { if ( $ this -> iteratorCreator ) { return call_user_func ( $ this -> iteratorCreator , $ this , $ this -> filesystem ) ; } return $ this -> createIterator ( ) ; }
Return an iterator to iterate bytes by bytes
11,809
public function get ( $ entity ) { foreach ( $ this -> services as $ interface => $ generator ) { if ( $ entity instanceof $ interface ) { return $ generator ; } } throw new NonExistingServiceException ( get_class ( $ entity ) ) ; }
Return the generator used for the given entity
11,810
protected function mergeRequires ( RootPackageInterface $ root , PluginState $ state ) { if ( ! empty ( $ requires = $ this -> getPackage ( ) -> getRequires ( ) ) ) { $ this -> mergeStabilityFlags ( $ root , $ requires ) ; $ duplicateLinks = [ ] ; $ requires = $ this -> replaceSelfVersionDependencies ( 'require' , $ re...
Merge require into a RootPackage .
11,811
protected function mergeDevRequires ( RootPackageInterface $ root , PluginState $ state ) { if ( ! empty ( $ requires = $ this -> getPackage ( ) -> getDevRequires ( ) ) ) { $ this -> mergeStabilityFlags ( $ root , $ requires ) ; $ duplicateLinks = [ ] ; $ requires = $ this -> replaceSelfVersionDependencies ( 'require-d...
Merge require - dev into RootPackage .
11,812
protected function mergeStabilityFlags ( RootPackageInterface $ root , array $ requires ) { $ flags = StabilityFlags :: extract ( $ root -> getStabilityFlags ( ) , $ root -> getMinimumStability ( ) , $ requires ) ; self :: unwrapIfNeeded ( $ root , 'setStabilityFlags' ) -> setStabilityFlags ( $ flags ) ; }
Extract and merge stability flags from the given collection of requires and merge them into a RootPackage .
11,813
public function addRelation ( Relation $ relation ) { switch ( get_class ( $ relation ) ) { case BelongsTo :: class : $ this -> relations [ 'belongsTo' ] [ ] = $ relation ; break ; case BelongsToMany :: class : $ this -> relations [ 'belongsToMany' ] [ ] = $ relation ; break ; case HasOne :: class : $ this -> relations...
Add a relations
11,814
public function writeXml ( $ filename ) { $ dom = new DOMImplementation ; $ dtd = $ dom -> createDocumentType ( 'entity' , '' , $ this -> entityDtd ) ; $ xml = $ dom -> createDocument ( '' , '' , $ dtd ) ; $ xml -> encoding = 'UTF-8' ; $ root = $ this -> createRootElement ( $ xml ) ; $ root -> appendChild ( $ this -> c...
Writes the XML file
11,815
protected function setRelations ( $ values ) { if ( isset ( $ values [ 0 ] -> belongsTo ) ) { $ this -> relations [ 'belongsTo' ] = $ values [ 0 ] -> belongsTo ; } if ( isset ( $ values [ 0 ] -> belongsToMany ) ) { $ this -> relations [ 'belongsToMany' ] = $ values [ 0 ] -> belongsToMany ; } if ( isset ( $ values [ 0 ]...
Set the relations
11,816
protected function setStorage ( $ values ) { $ vars = get_object_vars ( $ values [ 0 ] ) ; foreach ( $ vars as $ type => $ attributes ) { $ this -> storage = get_object_vars ( $ attributes [ 0 ] ) ; $ this -> storage [ 'type' ] = $ type ; if ( isset ( $ this -> storage [ 'primary' ] ) ) { $ this -> primary = $ this -> ...
Sets the storage
11,817
protected function validate ( $ request , $ user , $ password , $ routeUsername = null , $ routePassword = null ) { if ( $ this -> specificRouteRestrictionExists ( ) ) { if ( $ routeUsername && $ routePassword ) { if ( trim ( $ user ) == $ routeUsername && trim ( $ password ) == $ routePassword ) { return true ; } else...
Validates the user password combination against the request .
11,818
private function extractClosureNamespaces ( \ Closure $ closure ) { $ function = new \ ReflectionFunction ( $ closure ) ; if ( $ function -> getFileName ( ) === false || strpos ( $ function -> getFileName ( ) , 'eval()\'d code' ) !== false ) { return [ 'namespace' => null , 'uses' => [ ] , ] ; } $ tokens = token_get_al...
Returns Closure s namespace and uses .
11,819
private function extractNamespaces ( array $ tokens ) { $ closureNamespace = null ; $ closureUses = [ ] ; $ state = null ; $ namespace = null ; $ alias = null ; foreach ( $ tokens as $ token ) { if ( is_array ( $ token ) ) { if ( $ state === null && ( $ token [ 0 ] === T_NAMESPACE || $ token [ 0 ] === T_USE ) ) { $ sta...
Extracts namespace and uses from PHP tokens .
11,820
public function realType ( $ alias ) { return isset ( $ this -> aliases [ $ alias ] ) ? $ this -> aliases [ $ alias ] : $ alias ; }
Returns the real type of the passed alias or if non found the alias itself .
11,821
protected function extensionOfName ( $ fileName ) { if ( mb_strpos ( $ fileName , '.' ) === false ) { return mb_strtolower ( $ fileName ) ; } return mb_strtolower ( pathinfo ( $ fileName , PATHINFO_EXTENSION ) ) ; }
Calculate the extension of fileName .
11,822
protected function loadBaseSetIfNotLoaded ( ) { if ( $ this -> baseSetLoaded ) { return ; } $ this -> fillByArray ( $ this -> baseSet ) ; $ this -> registerBaseAliases ( ) ; $ this -> baseSetLoaded = true ; }
Loads the baseSet if not done before .
11,823
private function fetchAllFilesUnderGit ( ) { $ command = "git ls-files" ; exec ( $ command , $ output , $ return ) ; if ( $ return != 0 ) $ this -> logError ( "Can not execute command %s in exec" , $ command ) ; foreach ( $ output as $ filename ) { $ this -> myLastCommitTimes [ $ filename ] = 0 ; } }
Fetches all files that are currently under git .
11,824
private function fetchLastCommitTimes ( ) { $ command = "git log --format='format:%ai' --name-only" ; exec ( $ command , $ output , $ return ) ; if ( $ return != 0 ) $ this -> logError ( "Can not execute command %s in exec" , $ command ) ; $ commit_date = '' ; foreach ( $ output as $ line ) { if ( ( preg_match ( '/^\d{...
Fetches last commit time of each file in the Git repository .
11,825
private function setFilesMtime ( ) { $ files = new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ this -> myWorkDirName , FilesystemIterator :: UNIX_PATHS ) ) ; foreach ( $ files as $ full_path => $ file ) { if ( $ file -> isFile ( ) ) { $ key = substr ( $ full_path , strlen ( $ this -> myWorkDirName . ...
Set last commit time to all files in build directory .
11,826
protected function registerPathMappings ( $ factory ) { $ assetPath = $ this -> app -> __invoke ( PathFinder :: class ) -> to ( 'assets' ) ; $ factory -> map ( 'css' , $ assetPath -> absolute ( 'css' ) , $ assetPath -> url ( 'css' ) ) ; $ factory -> map ( 'js' , $ assetPath -> absolute ( 'js' ) , $ assetPath -> url ( '...
This method assumes that the CoreBootstrapper already has assigned a assets path and url .
11,827
public static function end ( ) { if ( ! empty ( static :: $ stack ) ) { $ widget = array_pop ( static :: $ stack ) ; if ( get_class ( $ widget ) === get_called_class ( ) ) { echo $ widget -> run ( ) ; return $ widget ; } else { throw new InvalidCallException ( 'Expecting end() of ' . get_class ( $ widget ) . ', found '...
Ends a widget . Note that the rendering result of the widget is directly echoed out .
11,828
public function report ( Exception $ e ) { try { if ( $ e instanceof NodesException && $ e -> getReport ( ) ) { app ( 'nodes.bugsnag' ) -> notifyException ( $ e , function ( Report $ report ) use ( $ e ) { $ report -> setMetaData ( $ e -> getMeta ( ) , true ) ; $ report -> setSeverity ( $ e -> getSeverity ( ) ) ; } ) ;...
Report exception to bugsnag .
11,829
public function bind ( $ param , $ value , $ type = null ) { if ( is_null ( $ type ) ) { switch ( true ) { case is_int ( $ value ) : $ type = PDO :: PARAM_INT ; break ; case is_bool ( $ value ) : $ type = PDO :: PARAM_BOOL ; break ; case is_null ( $ value ) : $ type = PDO :: PARAM_NULL ; break ; default : $ type = PDO ...
bind the inputs with the placeholders we put in place
11,830
public function select ( $ table , $ where = '' , $ fields = '*' , $ order = '' , $ limit = null , $ offset = '' ) { $ query = "SELECT $fields FROM $table " . ( $ where ? " WHERE $where " : '' ) . ( $ order ? " ORDER BY $order " : '' ) . ( $ limit ? " LIMIT $limit " : '' ) . ( ( $ offset && $ limit ? " OFFSET $offset "...
The select method allows to to specify different inputs to enable you to run various select queries .
11,831
public function insert ( $ table , $ data ) { $ fieldNames = implode ( ',' , array_keys ( $ data ) ) ; $ fieldValues = ':' . implode ( ', :' , array_keys ( $ data ) ) ; $ query = "INSERT INTO $table ($fieldNames) VALUES($fieldValues)" ; $ this -> prepare ( $ query ) ; foreach ( $ data as $ key => $ value ) { $ this -> ...
Insert data into the table
11,832
public function update ( $ table , $ data , $ where = '' ) { $ fieldDetails = null ; foreach ( $ data as $ key => $ value ) { $ fieldDetails .= "$key = :$key," ; } $ fieldDetails = rtrim ( $ fieldDetails , ',' ) ; $ query = "UPDATE $table SET $fieldDetails " . ( $ where ? 'WHERE ' . $ where : '' ) ; $ this -> prepare (...
Update data in the table
11,833
public function delete ( $ table , $ where ) { $ this -> prepare ( "DELETE FROM $table WHERE $where" ) ; $ this -> execute ( ) ; $ num = $ this -> rowCount ( ) ; if ( $ num < 1 ) { throw new NonExistentID ( 'Cannot delete the record with that ID since it is non existent' ) ; } }
Delete row from database .
11,834
public function objectSet ( $ clazz ) { $ this -> execute ( ) ; self :: $ statement -> setFetchMode ( PDO :: FETCH_CLASS , $ clazz ) ; return self :: $ statement -> fetchAll ( ) ; }
Return an array containing all the records
11,835
public function singleObject ( $ entity_class ) { $ this -> execute ( ) ; self :: $ statement -> setFetchMode ( PDO :: FETCH_CLASS , $ entity_class ) ; $ results = self :: $ statement -> fetch ( ) ; if ( empty ( $ results ) ) { throw new NonExistentID ( 'Could not find that record, pass a record ID that exists' , 1 ) ;...
Return single object .
11,836
public function execute ( InputInterface $ input , OutputInterface $ output ) { parent :: execute ( $ input , $ output ) ; $ log = $ this -> changeLog -> parse ( ) ; $ this -> changeLog -> write ( $ log ) ; }
Reads and writes the log to covert the format .
11,837
public function getCurrentBranch ( $ projectRoot ) { $ result = Shell :: execute ( '(cd {projectRoot}; {binPath} branch)' , [ '{binPath}' => $ this -> binPath , '{projectRoot}' => $ projectRoot , ] ) ; foreach ( $ result -> outputLines as $ line ) { if ( ( $ pos = stripos ( $ line , '* ' ) ) === 0 ) { return trim ( sub...
Returns currently active GIT branch name for the project .
11,838
public function addCategoryValues ( $ values ) { $ this -> _categoryValues = array_unique ( array_merge ( $ this -> getCategoryValues ( true ) , $ this -> filterCategoryValues ( $ values ) ) ) ; }
Adds categories .
11,839
public function removeCategoryValues ( $ values ) { $ this -> _categoryValues = array_diff ( $ this -> getCategoryValues ( true ) , $ this -> filterCategoryValues ( $ values ) ) ; }
Removes categories .
11,840
public function hasCategoryValues ( $ values ) { $ tagValues = $ this -> getCategoryValues ( true ) ; foreach ( $ this -> filterCategoryValues ( $ values ) as $ value ) { if ( ! in_array ( $ value , $ tagValues ) ) { return false ; } } return true ; }
Returns a value indicating whether categories exists .
11,841
public function filterCategoryValues ( $ values ) { return array_unique ( preg_split ( '/\s*,\s*/u' , preg_replace ( '/\s+/u' , ' ' , is_array ( $ values ) ? implode ( ',' , $ values ) : $ values ) , - 1 , PREG_SPLIT_NO_EMPTY ) ) ; }
Filters categories .
11,842
protected function initializeProductSuperLink ( array $ attr ) { $ parentId = $ attr [ MemberNames :: PARENT_ID ] ; $ productId = $ attr [ MemberNames :: PRODUCT_ID ] ; if ( $ this -> loadProductSuperLink ( $ productId , $ parentId ) ) { return ; } return $ attr ; }
Initialize the product super link with the passed attributes and returns an instance .
11,843
public function widget ( $ args , $ options ) { $ default_args = [ 'before_widget' => '' , 'after_widget' => '' , 'before_title' => '' , 'after_title' => '' , ] ; $ args = ( array ) $ args ; $ args = array_merge ( $ default_args , $ args ) ; $ args = array_intersect_key ( $ args , $ default_args ) ; $ args = array_map ...
Output widget markup .
11,844
public function update ( $ new , $ options ) { $ new = ( array ) $ new ; $ new = $ this -> App -> c :: unslash ( $ new ) ; $ new = $ this -> App -> c :: mbTrim ( $ new ) ; return $ this -> merge ( ( array ) $ options , $ new ) ; }
Update widget options on save .
11,845
public static function render ( $ query , array $ bindings = [ ] , $ quoteChar = "'" ) { if ( ! $ bindings ) { return "$query" ; } $ keys = [ ] ; $ values = [ ] ; foreach ( $ bindings as $ key => $ value ) { $ keys [ ] = is_string ( $ key ) ? '/:' . $ key . '/' : '/[?]/' ; $ values [ ] = is_numeric ( $ value ) ? ( int ...
Try to build a readable sql query of a prepared one .
11,846
public static function rule ( $ operator , $ parameters = [ ] , $ name = null ) { return new Constraint ( $ name ? : $ operator , ( array ) $ parameters , $ operator ) ; }
Create a new constraint
11,847
public static function where ( $ key , $ operatorOrValue = null , $ value = null ) { $ g = new ConditionGroup ( ) ; if ( func_num_args ( ) == 1 ) { return $ g -> where ( $ key ) ; } if ( func_num_args ( ) == 2 ) { return $ g -> where ( $ key , $ operatorOrValue ) ; } return $ g -> where ( $ key , $ operatorOrValue , $ ...
Create a new ConditionGroup .
11,848
public static function find ( string $ text ) : Header { $ matches = [ ] ; $ parent = new Header ( ) ; if ( \ preg_match_all ( self :: HEADERS_REGEX , $ text , $ matches , PREG_OFFSET_CAPTURE ) ) { foreach ( $ matches [ 0 ] as $ index => $ match ) { $ parent -> append ( new Header ( ( int ) $ match [ 1 ] , \ strlen ( $...
Find all headers in text
11,849
public static function fixText ( string $ text , int $ delta = 0 , bool $ relocateOrphans = false ) : TextWithHeader { $ headers = self :: find ( $ text ) ; $ headers -> fix ( $ delta , $ relocateOrphans ) ; foreach ( $ headers -> getRecursiveReverseIterator ( ) as $ header ) { $ realLevel = $ header -> getRealLevel ( ...
Find all headers in text and fix semantical hierarchy
11,850
public function getRecursiveReverseIterator ( ) { foreach ( \ array_reverse ( $ this -> children ) as $ child ) { yield from $ child -> getRecursiveReverseIterator ( ) ; yield $ child ; } }
Get resursive reverse iterator for proceeding to replacements
11,851
private function append ( Header $ header ) { if ( $ this -> children ) { $ latest = \ end ( $ this -> children ) ; if ( $ latest -> userLevel < $ header -> userLevel ) { $ latest -> append ( $ header ) ; return ; } } $ this -> children [ ] = $ header ; $ header -> parent = $ this ; }
Only in use at built time append the child at the right place in the tree
11,852
protected function validateSortableParameters ( $ key , $ direction ) { if ( is_null ( $ key ) ) { $ key = \ Request :: input ( Supporter :: keyName ) ; } if ( is_null ( $ direction ) ) { $ direction = \ Request :: input ( Supporter :: directionName ) ; } $ direction = $ this -> getSortableDirection ( $ direction ) ; $...
Validates sortable parameters
11,853
public function getSortableKey ( $ key = null ) { if ( ! is_null ( $ key ) ) { return $ this -> determineSortableKey ( $ key ) ; } return $ this -> getDefaultSortableKey ( ) ; }
Returns default key if isset or validates key
11,854
public function getSortableDirection ( $ direction = null ) { if ( ! is_null ( $ direction ) ) { return $ this -> validateSortableDirection ( $ direction ) ; } return $ this -> getDefaultSortableDirection ( ) ; }
Returns default direction if isset or validates direction
11,855
public function toRoman ( $ number ) { $ number = ( int ) $ number ; $ roman = '' ; foreach ( $ this -> getRomanValues ( ) as $ romanValue => $ numberValue ) { $ roman .= str_repeat ( $ romanValue , floor ( $ number / $ numberValue ) ) ; $ number = $ number % $ numberValue ; } foreach ( $ this -> getRomanExceptions ( )...
Converts a number to a roman representation number will be casted to integer
11,856
public function fromRoman ( $ roman ) { $ number = 0 ; foreach ( $ this -> getRomanExceptions ( ) as $ withThis => $ replaceThis ) { $ roman = str_replace ( $ replaceThis , $ withThis , $ roman ) ; } foreach ( $ this -> getRomanValues ( ) as $ romanValue => $ numberValue ) { $ number += $ numberValue * substr_count ( $...
Converts a roman number to a decimal representation
11,857
public function authenticate ( $ code ) { if ( $ code ) { $ this -> client -> authenticate ( $ code ) ; $ access_token = $ this -> client -> getAccessToken ( ) ; $ this -> session -> put ( 'googleapi_token' , $ access_token ) ; return true ; } return false ; }
Authenticate with Google and get access token
11,858
public function logout ( $ redirect = '/' , $ token = null ) { $ current_token = $ token ? : $ this -> parseToken ( ) ; if ( $ redirect and $ current_token ) { $ this -> session -> forget ( 'googleapi_token' ) ; $ this -> client -> revokeToken ( $ current_token ) ; return $ this -> redirect -> to ( $ redirect ) ; } ret...
Logout revoke access token and redirect to location
11,859
public function getService ( $ service = null ) { if ( $ service and ! array_key_exists ( $ service , $ this -> service ) ) { $ this -> setService ( $ service ) ; } $ this -> setToken ( ) ; return $ this -> service [ $ service ] ; }
Returns Google Service
11,860
public function setService ( $ service ) { $ prefix = $ this -> getConfig ( 'service_class_prefix' ) ; $ this -> service [ $ service ] = $ this -> createInstance ( $ service , $ prefix , [ $ this -> client ] ) ; }
Set Google Service
11,861
public function parseToken ( $ key = 'access_token' ) { if ( $ token = $ this -> getToken ( ) ) { $ token_array = json_decode ( $ token , true ) ; return $ token_array [ $ key ] ; } }
Get parsed token element
11,862
public function setToken ( $ token = null ) { if ( ! $ token and $ this -> session -> has ( 'googleapi_token' ) ) { $ token = $ this -> session -> get ( 'googleapi_token' ) ; } return $ this -> client -> setAccessToken ( $ token ) ; }
Set an access token
11,863
private function setupGoogleClient ( ) { $ client = new Google_Client ( ) ; $ client -> setClientId ( $ this -> getConfig ( 'oauth2_client_id' ) ) ; $ client -> setClientSecret ( $ this -> getConfig ( 'oauth2_client_secret' ) ) ; $ client -> setRedirectUri ( $ this -> getConfig ( 'oauth2_redirect_uri' ) ) ; $ client ->...
Setup a new Google Client
11,864
final public static function removeEmptyData ( array $ routes ) : array { $ c = count ( $ routes ) ; for ( $ i = 0 ; $ i < $ c ; $ i ++ ) { if ( trim ( $ routes [ $ i ] ) == "" || $ routes [ $ i ] == null || empty ( $ routes [ $ i ] ) ) { unset ( $ routes [ $ i ] ) ; } } return ( $ routes ) ; }
Remove blank data in array
11,865
public static function checkRouteMatchesMethod ( $ ctr , string $ met_call ) : int { if ( isset ( $ ctr [ "m_allow" ] ) && in_array ( "ALL" , $ ctr [ "m_allow" ] ) ) { return ( 1 ) ; } elseif ( isset ( $ ctr [ "m_allow" ] ) && is_string ( $ ctr [ "m_allow" ] ) && $ ctr [ "m_allow" ] === $ met_call ) { return ( 1 ) ; } ...
Check match of Method request and method request route
11,866
public static function localGetPart ( string $ appname , array $ webroutes , string $ stringwebroute ) : ? array { if ( true === Locale :: isEnabled ( ) ) { $ lapp = new AppLocale ( $ appname ) ; if ( true === $ lapp -> isEnabled ( ) ) { foreach ( $ lapp -> getValues ( ) as $ one ) { $ comp = $ webroutes [ 0 ] ?? null ...
Compare the local on url
11,867
final public static function redirectToRoute ( string $ routename , array $ params = array ( ) , bool $ domain = true , array $ query = array ( ) , int $ status = 302 ) : void { $ querystring = $ domainstring = "" ; $ route = self :: generateRoute ( $ routename , $ params ) ; if ( ! empty ( $ query ) ) { foreach ( $ qu...
Redirect to an app route
11,868
final public static function analysePath ( string $ routename , string $ path , array $ parameters ) : string { $ arraypath = explode ( "/" , $ path ) ; $ arrayElem = array ( ) ; $ narray = array ( ) ; foreach ( $ arraypath as $ one ) { if ( preg_match ( "/{(.*?)}/" , $ one ) ) { $ nstr = str_replace ( "{" , "" , $ one...
Analyse path to change dynamic parameters with specific parameters array
11,869
private static function advancedMatch ( array $ itemsapp , array $ itemsweb ) : bool { $ max = count ( $ itemsapp ) ; for ( $ iterator = 0 ; $ iterator < $ max ; $ iterator ++ ) { $ last = strlen ( $ itemsapp [ $ iterator ] ) - 1 ; if ( isset ( $ itemsapp [ $ iterator ] [ 0 ] ) && "{" === $ itemsapp [ $ iterator ] [ 0 ...
Advanced match for route with dynamic parameters
11,870
public function getArgs ( int $ argc , array $ argv ) { if ( $ argc == 1 ) { Output :: displayAsGreen ( "Welcome to the Framework Console Manager\n" . "I noticed that you didn't enter any parameters.\n" . "For more information, you can use the help command to get a command list." ) ; } $ c = $ this -> searchCommand ( $...
Get prompt arguments
11,871
protected function searchCommand ( string $ name ) : array { $ f = $ this -> fileCommand ; $ finalC = array ( ) ; if ( $ f == null ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Framework Console Arguments Error : Command File is empty" , "solution" => "Command file not be empty" ) ) ) ; } $ comman...
Search a command name
11,872
public function index ( $ id = null ) : Response { $ this -> additionalSearchFields = [ [ 'id' , ':' , $ this -> userData -> getId ( ) ] , ] ; return parent :: index ( ) ; }
List of Users but always returns the one user
11,873
public function edit ( $ id ) : Response { if ( $ user = $ this -> model -> findFirst ( $ this -> userData -> getId ( ) ) ) { $ request = $ this -> request -> getPut ( ) ; if ( empty ( $ request ) ) { $ request = $ this -> request -> getJsonRawBody ( true ) ; } if ( array_key_exists ( 'password' , $ request ) && ! empt...
Update a User Info
11,874
public function getUri ( $ pageUid , $ forceTsfe = false ) { if ( ! isset ( $ GLOBALS [ 'TSFE' ] ) ) { if ( $ forceTsfe ) { ( new Tsfe ) -> create ( $ this -> getRootPage ( $ pageUid ) ) ; } else { throw new Exception ( 'TSFE must be available to use this method' ) ; } } return $ GLOBALS [ 'TSFE' ] -> cObj -> typoLink_...
Convenience method for fetching the full URI to a page .
11,875
public function getRootPage ( $ pageUid ) { $ info = $ this -> getPageInfo ( $ pageUid ) ; while ( $ info && $ info [ 'pid' ] && ! $ info [ 'is_siteroot' ] ) { $ info = $ this -> getPageInfo ( ( int ) $ info [ 'pid' ] ) ; } return ( int ) $ info [ 'uid' ] ; }
Get the root page UID of the given page .
11,876
public static function addLocaleToCollection ( Collection $ collection , LocaleInterface $ locale ) { $ exist = $ collection -> exists ( function ( $ key , LocaleInterface $ el ) use ( $ locale ) { return $ el -> isLocale ( $ locale -> getLocale ( ) ) ; } ) ; if ( ! $ exist ) { $ collection -> add ( $ locale ) ; } retu...
add Locale to Collection .
11,877
public function setLoggingMode ( $ mode , $ filename = NULL ) { $ this -> logging_mode = $ mode ; $ this -> log_filename = $ filename ; }
Set logging mode
11,878
public function sendPresence ( $ to , $ from = NULL , $ type = NULL ) { $ type = is_null ( $ type ) ? '' : " type=\"{$type}\"" ; return $ this -> send ( '<presence to="' . htmlspecialchars ( $ to ) . '" from="' . ( is_null ( $ from ) ? $ this -> component_name : htmlspecialchars ( "$from@{$this->component_name}" ) ) . ...
Send a presence stanza to some JID
11,879
public function sendMessage ( $ body , $ to , $ item = NULL , $ type = NULL , $ subject = NULL , $ tobare = false ) { $ to = new JID ( $ to ) ; $ this -> send ( '<message ' . ( is_null ( $ type ) ? ' ' : 'type="' . $ type . '" ' ) . 'from="' . ( is_null ( $ item ) ? ( $ from = $ this -> component_name ) : ( $ from = $ ...
Send a message stanza to some JID
11,880
public static function getDefaultValue ( $ param = null ) { $ result = null ; if ( empty ( $ param ) ) { return static :: $ defaults ; } if ( isset ( static :: $ defaults [ $ param ] ) ) { $ result = static :: $ defaults [ $ param ] ; } return $ result ; }
Get default configuration value for given parameter
11,881
public static function secureString ( $ string , $ privateInfo , $ padWith = 'x' ) { $ result = $ string ; if ( empty ( $ privateInfo ) ) { return $ result ; } if ( ! is_array ( $ privateInfo ) ) { $ privateInfo = array ( $ privateInfo ) ; } foreach ( $ privateInfo as $ privateString ) { $ replacement = str_repeat ( $ ...
Secure string for screen output
11,882
protected function updateHistory ( ) { $ time = time ( ) ; $ version = $ this -> App :: VERSION ; if ( ! $ this -> history [ 'first_time' ] ) { $ this -> history [ 'first_time' ] = $ time ; } $ this -> history [ 'last_time' ] = $ time ; $ this -> history [ 'last_version' ] = $ version ; $ this -> history [ 'versions' ]...
Update installed version .
11,883
public function diffChangeLog ( $ output = null , $ metadata = null ) { $ output = $ this -> sanitizeOutputParameter ( $ output ) ; $ metadata = $ this -> sanitizeMetadatas ( $ metadata ) ; $ sm = $ this -> em -> getConnection ( ) -> getSchemaManager ( ) ; $ fromSchema = $ sm -> createSchema ( ) ; $ this -> removeLiqui...
Generate a diff changelog from differences between actual database state and doctrine metadata .
11,884
public function changeLog ( $ output = null , $ metadata = null ) { $ output = $ this -> sanitizeOutputParameter ( $ output ) ; $ metadata = $ this -> sanitizeMetadatas ( $ metadata ) ; $ schema = $ this -> getSchemaFromMetadata ( $ metadata ) ; $ liquibaseVisitor = new LiquibaseSchemaVisitor ( $ output ) ; $ output ->...
Generate a full changelog from doctrine metadata .
11,885
public function diffChangeLogFromSchemaDiff ( SchemaDiff $ schemaDiff , $ output = null ) { $ output = $ this -> sanitizeOutputParameter ( $ output ) ; $ output -> started ( $ this -> em ) ; foreach ( $ schemaDiff -> newNamespaces as $ newNamespace ) { $ output -> createSchema ( $ newNamespace ) ; } foreach ( $ schemaD...
Generate a diff changelog from SchemaDiff object .
11,886
private function buildMatcher ( ) { $ this -> matchers = [ ] ; foreach ( $ this -> option as $ key => $ value ) { $ this -> matchers [ $ key ] = $ this -> buildOneMatcher ( $ key , $ value ) ; } }
Builds matcher array
11,887
protected function createObject ( $ abstract = null , array $ parameters = [ ] ) { $ abstract = $ this -> factoryAbstract ( $ abstract ) ; if ( ! $ this -> _customFactory ) { return $ this -> createWithoutFactory ( $ abstract , $ parameters ) ; } return Lambda :: callFast ( $ this -> _customFactory , [ $ abstract , $ p...
Create the object via the custom callable
11,888
public static function create ( array $ definition , ShapeMap $ shapeMap ) { static $ map = [ 'structure' => 'ILAB_Aws\Api\StructureShape' , 'map' => 'ILAB_Aws\Api\MapShape' , 'list' => 'ILAB_Aws\Api\ListShape' , 'timestamp' => 'ILAB_Aws\Api\TimestampShape' , 'integer' => 'ILAB_Aws\Api\Shape' , 'double' => 'ILAB_Aws\Ap...
Get a concrete shape for the given definition .
11,889
public function create ( array $ suppressions ) { foreach ( $ suppressions as $ suppression ) { $ this -> assertValidSuppression ( $ suppression ) ; } $ request = new Request ( 'suppressions' ) ; $ request -> setParams ( [ 'subscribers' => $ suppressions ] ) ; $ response = $ this -> client -> post ( $ request ) ; $ thi...
Creates new Suppression
11,890
private function assertValidSuppression ( array $ suppression ) { if ( isset ( $ suppression [ 'suppress_on' ] ) ) { if ( isset ( $ suppression [ 'suppress_on' ] [ 'campaign' ] ) ) $ this -> assertValidCampaign ( $ suppression [ 'suppress_on' ] [ 'campaign' ] ) ; if ( isset ( $ suppression [ 'suppress_on' ] [ 'transact...
Check if Suppression data is valid
11,891
public function brightness ( $ level ) { Argument :: i ( ) -> test ( 1 , 'numeric' ) ; imagefilter ( $ this -> resource , IMG_FILTER_BRIGHTNESS , $ level ) ; return $ this ; }
Applies the brightness filter . Changes the brightness of the image .
11,892
public function contrast ( $ level ) { Argument :: i ( ) -> test ( 1 , 'numeric' ) ; imagefilter ( $ this -> resource , IMG_FILTER_CONTRAST , $ level ) ; return $ this ; }
Applies the contrast filter . Changes the contrast of the image .
11,893
public function invert ( $ vertical = false ) { Argument :: i ( ) -> test ( 1 , 'bool' ) ; $ orgWidth = imagesx ( $ this -> resource ) ; $ orgHeight = imagesy ( $ this -> resource ) ; $ invert = imagecreatetruecolor ( $ orgWidth , $ orgHeight ) ; if ( $ vertical ) { imagecopyresampled ( $ invert , $ this -> resource , ...
Inverts the image .
11,894
public function resize ( $ width = null , $ height = null ) { Argument :: i ( ) -> test ( 1 , 'numeric' , 'null' ) -> test ( 2 , 'numeric' , 'null' ) ; $ orgWidth = imagesx ( $ this -> resource ) ; $ orgHeight = imagesy ( $ this -> resource ) ; if ( is_null ( $ width ) ) { $ width = $ orgWidth ; } if ( is_null ( $ heig...
Resizes the image . This is a version of scale but keeping it s original aspect ratio
11,895
public function setTransparency ( ) { imagealphablending ( $ this -> resource , false ) ; imagesavealpha ( $ this -> resource , true ) ; return $ this ; }
Sets the background color to be transparent
11,896
public function smooth ( $ level ) { Argument :: i ( ) -> test ( 1 , 'numeric' ) ; imagefilter ( $ this -> resource , IMG_FILTER_SMOOTH , $ level ) ; return $ this ; }
Applies the smooth filter . Makes the image smoother .
11,897
public function save ( $ path , $ type = null ) { if ( ! $ type ) { $ type = $ this -> type ; } switch ( $ type ) { case 'gif' : imagegif ( $ this -> resource , $ path ) ; break ; case 'png' : $ quality = ( 100 - $ this -> quality ) / 10 ; if ( $ quality > 9 ) { $ quality = 9 ; } imagepng ( $ this -> resource , $ path ...
Saves the image data to a file
11,898
public function runPreSearch ( ) { $ needles = $ this -> preSearch ; foreach ( $ needles as $ needle ) { if ( strpos ( $ this -> value , $ needle ) !== false ) { return true ; } } return false ; }
characters to search before normalize to speed up the process
11,899
public function getUnreadPosts ( $ target = '' ) { if ( ! $ this -> unreadPosts ) { $ filter = array ( 'Created:GreaterThan' => $ this -> owner -> LastPostView , ) ; if ( strlen ( $ target ) ) { $ filter [ 'Target' ] = $ target ; } $ this -> unreadPosts = $ this -> microBlogService -> globalFeed ( $ filter , $ orderBy ...
Gets the latest posts that _this_ member can view