idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
4,900
public function getValueFrom ( array $ values , $ argName , $ argAltName ) { if ( isset ( $ values [ $ argName ] ) ) { return $ values [ $ argName ] ; } if ( $ argAltName && isset ( $ values [ $ argAltName ] ) ) { return $ values [ $ argAltName ] ; } return null ; }
Get value from input array
4,901
public function querySafe ( $ query ) { if ( $ this -> state === self :: STATE_SHEDULED ) { $ this -> state = self :: STATE_STARTED ; $ this -> begin ( ) ; } return $ this -> query ( $ query ) ; }
Complete query with transaction
4,902
protected function _setJwt ( $ userId ) { $ cookie = ! empty ( $ this -> _controller ( ) -> Cookie -> read ( 'CookieAuth' ) ) ; $ expiration = $ this -> _controller ( ) -> Cookie -> configKey ( 'CookieAuth' ) [ 'expires' ] ; $ this -> _controller ( ) -> Cookie -> configKey ( 'Jwt' , [ 'encryption' => false , 'expires' ...
Set Jwt token to a cookie
4,903
public function getValuesAsArray ( ) { if ( $ this -> files ) { $ parsedFileArray = [ ] ; foreach ( $ this -> files as $ name => $ file ) { if ( ! isset ( $ file [ 'name' ] ) ) { if ( ! isset ( $ parsedFileArray [ $ name ] ) ) { $ parsedFileArray [ $ name ] [ 'name' ] = [ ] ; $ parsedFileArray [ $ name ] [ 'type' ] = [...
Gets the parsed post
4,904
public function check_mysql ( ) { try { $ result = DB :: selectOne ( 'SELECT 1 AS n' ) ; if ( $ result -> n != 1 ) { throw new Exception ( "Unexpected Database Connection Result" , 1 ) ; } return [ 'up' => true , 'note' => null ] ; } catch ( Exception $ e ) { Log :: warning ( "Database Connection Failed: " . $ e -> get...
Built in Checks
4,905
public function getState ( ) { $ this -> loadCurrent ( ) ; return new State ( $ this -> document , $ this -> translator , $ this -> current ) ; }
Returns the current state
4,906
public function push ( ) { if ( $ this -> depth > 0 ) { $ this -> loadCurrent ( ) ; $ this -> loaded = false ; } $ selector = Selector :: create ( ) ; if ( count ( $ this -> stack ) > $ this -> depth ) { $ this -> stack [ $ this -> depth ] [ ] = $ selector ; } else { $ this -> stack [ ] = [ $ selector ] ; } $ this -> d...
Pushes a new selector to the path and return that instance
4,907
public function pop ( ) { if ( count ( $ this -> stack ) > $ this -> depth ) array_pop ( $ this -> stack ) ; if ( $ this -> depth == 0 ) throw new \ Exception ( 'Can\' pop nothing' ) ; $ this -> depth -- ; if ( $ this -> current != null ) { $ this -> current = $ this -> current -> getParent ( ) ; $ this -> loaded = $ t...
Pop the last selector
4,908
public function isMatch ( $ selector ) { return $ this -> isMatchingTail ( $ selector -> getEnd ( ) , $ this -> depth - 1 , count ( $ this -> stack [ $ this -> depth - 1 ] ) - 1 ) ; }
Returns true if this path matches the give selector
4,909
public function init ( ) { $ this -> output = new Output ( $ this ) ; $ this -> options = new Options ( [ ] , $ this ) ; $ this -> coverage = new Coverage ( $ this ) ; $ this -> parseArguments ( ) ; $ this -> bootstrap ( $ this -> pwd . '/tests' ) ; return $ this ; }
Initialize the test runner .
4,910
private function parseArguments ( ) { $ args = $ _SERVER [ 'argv' ] ; array_shift ( $ args ) ; foreach ( $ args as $ index => $ task ) { if ( strpos ( $ task , '-' ) === 0 ) { unset ( $ args [ $ index ] ) ; $ option = preg_replace ( '/^[-]{1,2}/' , '' , $ task ) ; if ( isset ( $ args [ $ index + 1 ] ) && $ args [ $ ind...
Parse arguments passed to the script .
4,911
public function run ( ) { $ this -> totalCount = 0 ; $ suites = $ this -> options -> suites ; if ( $ suite = $ this -> options -> suite ) { if ( ! $ this -> options -> suites -> { $ suite } ) { throw new TestNotFoundException ( 'The suite ' . $ suite . ' is not defined' ) ; } $ suites = [ $ suite => $ this -> options -...
Run all tests assigned to the runner .
4,912
public function addPass ( Test $ test ) { $ this -> output -> updateTable ( $ test -> pos -> x , $ test -> pos -> y , Graphite :: GREEN ) ; $ this -> passed [ ] = $ test ; }
Mark a test as passed and update the table of tests .
4,913
public function addFailure ( Test $ test ) { $ this -> output -> updateTable ( $ test -> pos -> x , $ test -> pos -> y , Graphite :: RED ) ; $ this -> failures [ ] = $ test ; }
Mark a test as failed and update the table of tests .
4,914
public function addError ( Test $ test ) { $ this -> output -> updateTable ( $ test -> pos -> x , $ test -> pos -> y , Graphite :: YELLOW ) ; $ this -> errors [ ] = $ test ; }
Mark a test as errored and update the table of tests .
4,915
public function addSkipped ( Test $ test ) { $ this -> output -> updateTable ( $ test -> pos -> x , $ test -> pos -> y , Graphite :: MAGENTA ) ; $ this -> skipped [ ] = $ test ; }
Mark a test as skipped and update the table of tests .
4,916
public function getServiceLocator ( ) { if ( is_null ( $ this -> _serviceLocator ) ) $ this -> _serviceLocator = new ServiceManager ( new Config ( ) ) ; return $ this -> _serviceLocator ; }
Get service locator
4,917
protected static function doGenerateKeys ( $ keySize = 2048 ) { if ( ! static :: isPhpSecInstalled ( ) ) { return false ; } $ rsa = new Crypt_RSA ( ) ; $ rsa -> setPrivateKeyFormat ( Crypt_RSA :: PRIVATE_FORMAT_PKCS1 ) ; $ rsa -> setPublicKeyFormat ( Crypt_RSA :: PUBLIC_FORMAT_PKCS1 ) ; defined ( 'CRYPT_RSA_EXPONENT' )...
Generate the keys
4,918
protected function dumpSimple ( ServerInterface $ server , $ spaces = 0 ) { $ value = $ this -> getValue ( ) ? ' ' . $ this -> getValue ( ) : '' ; return str_repeat ( ' ' , $ spaces ) . sprintf ( $ server -> getDumperSimpleDirective ( ) , $ this -> getName ( ) , $ value ) . PHP_EOL ; }
Dumps a simple directive .
4,919
public static function Faf03 ( $ t ) { $ a ; $ a = fmod ( 335779.526232 + $ t * ( 1739527262.8478 + $ t * ( - 12.7512 + $ t * ( - 0.001037 + $ t * ( 0.00000417 ) ) ) ) , TURNAS ) * DAS2R ; return $ a ; }
- - - - - - - - - i a u F a f 0 3 - - - - - - - - -
4,920
private function getStartGoogleAuthenticationResponse ( ) { $ response = new Redirection ( $ this -> getRequest ( ) ) ; $ currentUser = Users :: getCurrent ( ) ; try { $ identityProvider = new GoogleIdentityProvider ; $ response -> setNextUrl ( $ identityProvider -> getAuthenticationUrl ( ) ) ; } catch ( Authentication...
First step in the Google authentication process .
4,921
public function renderFormJavascriptPrototypes ( array $ context , FormView $ rootView ) { if ( ! isset ( $ rootView -> vars [ 'prototype' ] ) ) { throw new \ InvalidArgumentException ( 'The given root form view has no prototype' ) ; } $ stack = [ [ $ rootView -> vars [ 'prototype' ] , $ rootView -> vars [ 'prototype' ...
Render javascript prototypes .
4,922
public function pageAction ( ) { $ path = $ this -> params ( ) -> fromRoute ( 'path' ) ; $ page = $ this -> queryService -> findPublishedPageByPath ( trim ( $ path , '/' ) ) ; if ( $ page instanceof NullPage ) { $ response = $ this -> getResponse ( ) ; $ response -> setStatusCode ( Response :: STATUS_CODE_404 ) ; retur...
Page retrieval by route parameters
4,923
protected function addCurrency ( $ p_code , $ p_monnaie , $ p_cent ) { $ this -> currency_names [ $ p_code ] = array ( array ( $ p_monnaie ) , array ( $ p_cent ) ) ; return $ this ; }
Ajout d une monnaie
4,924
public function getCurrencyName ( $ p_currency ) { if ( array_key_exists ( $ p_currency , $ this -> currency_names ) ) { return $ this -> currency_names [ $ p_currency ] ; } throw NumberWordsException ( sprintf ( 'Can\'t find %s currency !' , $ p_currency ) ) ; }
Retourne la traduction pour une monnaie
4,925
public function getDigit ( $ p_digit ) { if ( array_key_exists ( $ p_digit , $ this -> digits ) ) { return $ this -> digits [ $ p_digit ] ; } throw new NumbersWordsException ( sprintf ( 'Can\'t find digit %s !' , $ p_digit ) ) ; }
Retourne la traduction d un chiffre
4,926
public function getExponent ( $ p_exp ) { if ( array_key_exists ( $ p_exp , $ this -> exponent ) ) { return $ this -> exponent [ $ p_exp ] ; } throw new NumbersWordsException ( sprintf ( 'Can\'t find %s exponent !' , $ p_exp ) ) ; }
Retourne un exposant
4,927
public function normalizeNumber ( $ p_num , $ p_dec = null ) { if ( is_null ( $ p_dec ) ) { $ p_dec = $ this -> decimalPoint ; } $ normalized = preg_replace ( '/[^-' . preg_quote ( $ p_dec ) . '0-9]/' , '' , $ p_num ) ; $ mn1 = floatval ( $ p_num ) ; $ mn2 = floatval ( $ normalized ) ; if ( $ mn1 != $ mn2 ) { throw new...
Supprime tout ce qui est bizarre
4,928
public function getData ( ) { $ properties = $ this -> getGeneratedProperties ( ) ; $ data = [ ] ; foreach ( $ properties as $ property ) { $ key = $ property -> getName ( ) ; $ data [ $ key ] = $ this -> { $ key } ; } $ result = array_merge ( $ this -> objectData , $ data ) ; ksort ( $ result ) ; return $ result ; }
Returns all data as an array including modifications to the generated properties .
4,929
private function parseConfiguration ( $ configuration ) { $ return = [ ] ; foreach ( $ configuration as $ page ) { foreach ( $ page as $ key => $ setting ) { if ( $ key == 'helpers' ) { foreach ( $ setting as $ a => $ b ) { if ( ! isset ( $ return [ 'renderers' ] ) ) { $ return [ 'renderers' ] = array ( ) ; } if ( ! is...
Custom configuration parser that will integrate certain elements of the configuration as returned by the configuration manager .
4,930
protected function determineViewType ( ) { $ filename = Core :: i ( ) -> request_uri ; $ extension = HTTPUtilities :: getFileExtension ( $ filename ) ; if ( PHP_SAPI === 'cli' || PHP_SAPI === 'cli-server' ) { $ this -> setViewType ( 'c l i' ) ; $ url_array [ ] = $ filename ; } elseif ( ! is_null ( $ extension ) ) { $ t...
Determines the view type using the request in the Framework .
4,931
protected function setViewType ( $ extension ) { foreach ( $ this -> renderers as $ type => $ config ) { if ( in_array ( $ extension , $ config [ 'extensions' ] ) ) { $ this -> view_type = $ type ; } } if ( ! isset ( $ this -> view_type ) ) { $ this -> view_type = $ this -> default_view_type ; } }
Determines based on the passed extension the proper file type
4,932
public function inlineTemplatesFunction ( $ path ) { $ pathinfo = pathinfo ( $ path ) ; $ templateDir = $ this -> kernelRootDir . '/../web/' . $ pathinfo [ 'dirname' ] ; if ( ! is_readable ( $ templateDir ) ) { return ; } $ finder = new Finder ( ) ; $ finder -> files ( ) -> name ( $ pathinfo [ 'filename' ] ) ; $ output...
Function to get include JS templates
4,933
public function serializeContextFunction ( $ context ) { $ json = array ( ) ; foreach ( $ context as $ key => $ value ) { if ( ! in_array ( $ key , array ( '_parent' , 'assetic' , 'app' ) ) && ! preg_match ( '#sonata#' , $ key ) ) { try { $ serializedValue = $ this -> serializer -> serialize ( $ value , 'json' ) ; } ca...
Function to serialize Twig context to JSON
4,934
public function valid ( ) : bool { if ( $ this -> privateErrors ( ) ) { return false ; } foreach ( ( array ) $ this as $ element ) { if ( is_string ( $ element ) ) { continue ; } if ( ! $ element -> getElement ( ) -> valid ( ) ) { return false ; } } return true ; }
Check whether the group is valid .
4,935
public function errors ( ) : array { $ errors = $ this -> privateErrors ( ) ; foreach ( ( array ) $ this as $ element ) { if ( is_string ( $ element ) ) { continue ; } $ name = $ element -> getElement ( ) -> name ( ) ; if ( $ error = $ element -> getElement ( ) -> errors ( ) ) { $ errors = array_merge ( $ errors , [ $ ...
Returns all errors for this group .
4,936
private function privateErrors ( ) : array { $ errors = [ ] ; if ( isset ( $ this -> tests ) ) { foreach ( $ this -> tests as $ error => $ test ) { if ( ! $ test ( ( array ) $ this ) ) { $ errors [ ] = $ error ; } } } return $ errors ; }
Helper function for internal use .
4,937
public function dispatch ( Request $ request ) { $ uri = $ request -> uri ( ) ; $ method = $ request -> method ( ) ; if ( in_array ( $ uri , self :: $ routes ) ) { if ( self :: $ methods [ $ uri ] == $ method || self :: $ methods [ $ uri ] == 'ANY' ) { if ( is_object ( self :: $ callbacks [ $ uri ] ) ) { call_user_func...
Runs the callback f or the given request
4,938
public static function format ( $ number , $ decimals = null , $ decimalPoint = null , $ thousandsSeparator = null ) { if ( is_null ( $ decimals ) ) { $ decimals = self :: $ decimals ; } if ( is_null ( $ decimalPoint ) ) { $ decimalPoint = self :: $ decimalPoint ; } if ( is_null ( $ thousandsSeparator ) ) { $ thousands...
Format a number with grouped thousands
4,939
public function addHandler ( Handler $ handler , $ getsPrevious = true , $ prepend = false ) { foreach ( $ this -> handlers as $ level => $ handlers ) { if ( $ handler -> accepts ( $ level ) ) { if ( $ prepend ) { array_unshift ( $ this -> handlers [ $ level ] , $ handler ) ; } else { array_push ( $ this -> handlers [ ...
Add a log handler .
4,940
public static function interpolate ( $ message , array $ context = array ( ) ) { foreach ( $ context as $ key => $ value ) { $ message = str_replace ( '{' . $ key . '}' , $ value , $ message ) ; } return $ message ; }
Interpolate context values into message .
4,941
protected function addColor ( $ text , array $ definition ) { $ fgColor = $ definition [ 0 ] ; $ bgColor = $ definition [ 1 ] ; $ deColor = $ definition [ 2 ] ; $ prefix = $ fgColor . $ bgColor . $ deColor ; $ suffix = $ prefix ? self :: DECO_END : '' ; return $ prefix . $ text . $ suffix ; }
add ansi color to text
4,942
public function flashMessage ( $ message , $ type = 'default' , $ comment = null , $ icon = null , $ width = 50 , $ iconSize = "lg" , $ timeout = 5 ) { $ id = $ this -> getParameterId ( 'flash' ) ; $ presenter = $ this -> getPresenter ( ) ; if ( $ presenter instanceof Presenter ) { $ messages = $ presenter -> getFlashS...
extend flash message
4,943
public function render_zoomify ( $ width = 800 , $ height = 500 ) { $ zoomifyswfurl = $ this -> _api -> get_zoomify_swf_url ( ) ; $ zoomifyurl = $ this -> _api -> get_zoomify_url ( $ this -> _id ) ; return <<<HTML5 <object type="application/x-shockwave-flash" data="$zoomifyswfurl" width="$width" height="$he...
Get Zoomify Object .
4,944
protected function _loadRequest ( ) { $ _goodies = array ( ) ; if ( isset ( $ _SERVER ) && ! empty ( $ _SERVER ) ) { foreach ( $ _SERVER as $ _key => $ _value ) { if ( false !== stripos ( $ _key , 'HTTP_' , 0 ) ) { if ( ! isset ( $ _goodies [ 'server.headers' ] ) || ! is_array ( $ _goodies [ 'server.headers' ] ) ) { $ ...
Load up with presents
4,945
public function create ( $ view , $ data = [ ] ) { $ filename = $ this -> getFinder ( ) -> find ( $ view ) ; $ mergeMethod = ( $ data instanceof Data ) ? 'addAll' : 'merge' ; $ this -> getData ( ) -> $ mergeMethod ( $ data ) ; return new View ( $ filename , $ this -> getData ( ) , new Context ( $ this ) ) ; }
Creates a view
4,946
public function pushMany ( array $ elements ) : Collection { foreach ( $ elements as $ element ) { if ( is_array ( $ element ) ) { $ element = new $ this -> type ( $ element ) ; if ( get_class ( $ element ) != $ this -> type && ! is_subclass_of ( $ element , $ this -> type , true ) ) throw new \ Exception ( "[MVQN\Coll...
Appends the specified elements to the end of the Collection .
4,947
public function get ( $ id ) { if ( ! isset ( $ this -> items [ $ id ] ) ) { throw new DataSetColumnNotFoundException ( $ id ) ; } return $ this -> items [ $ id ] ; }
Returns dataset column by its identifier
4,948
public function getSelectClause ( ) { $ select = [ ] ; foreach ( $ this -> all ( ) as $ column ) { $ select [ ] = $ column -> getRawSelect ( ) ; } return implode ( ', ' , $ select ) ; }
Returns SQL select clause as a string
4,949
public function init ( ? string $ configuration = 'project' ) : void { $ config = Core :: i ( ) -> config -> getConfiguration ( $ configuration ) ; if ( isset ( $ config [ 'site_name' ] ) ) { $ this -> site_name = $ config [ 'site_name' ] ; } if ( isset ( $ config [ 'title_format' ] ) ) { $ this -> title_format = $ con...
The init function is called when a view helper is loaded . This function should look in the configuration to find any initial settings for the view helper .
4,950
public function toArray ( ) : array { $ problem = [ 'status' => $ this -> getStatusCode ( ) , 'title' => $ this -> getTitle ( ) , 'detail' => $ this -> getDetail ( ) , 'type' => $ this -> getType ( ) , 'instance' => $ this -> getInstance ( ) , ] ; return $ this -> mergeArrays ( array_filter ( $ problem ) , $ this -> ad...
Return the Exception as an array suitable for serializing .
4,951
public function destroy ( ) { $ _SESSION = [ ] ; if ( ini_get ( "session.use_cookies" ) ) { $ params = session_get_cookie_params ( ) ; setcookie ( session_name ( ) , '' , time ( ) - 42000 , $ params [ "path" ] , $ params [ "domain" ] , $ params [ "secure" ] , $ params [ "httponly" ] ) ; } session_destroy ( ) ; }
Elimina todas las sesiones activas sin importar el ID
4,952
public function write ( $ name , $ value ) { $ _SESSION = Hash :: write ( $ _SESSION , $ name , $ value ) ; return $ value ; }
Escribe o modifica un valor en la sesion
4,953
public function push ( $ name , $ value ) { $ _SESSION = Hash :: insert ( $ _SESSION , $ name , $ value ) ; return $ value ; }
Inserta un nuevo valor de sesion
4,954
public function consume ( $ name ) { $ value = $ this -> read ( $ name ) ; $ this -> remove ( $ name ) ; return $ value ; }
Obtiene y elimina un valor de sesion
4,955
public static function fromCell ( $ cell ) { switch ( Cell :: toValue ( $ cell ) ) { case null : return null ; case Cell :: SMALL : return self :: SMALL ( ) ; case Cell :: TALL_TOP : return self :: TALL ( ) ; case Cell :: WIDE_LEFT : return self :: WIDE ( ) ; default : return false ; } }
Create the Tile corresponding to a cell .
4,956
public function start ( $ uuid ) { if ( $ uuid instanceof Service ) { $ uuid = $ uuid -> getUuid ( ) ; } $ response = $ this -> httpClient -> post ( $ this -> getResourceUrl ( $ uuid ) . 'start/' , [ ] ) ; return ServiceResponse :: createFromHttpResponse ( $ response ) ; }
Start a service
4,957
public function terminate ( $ uuid ) { if ( $ uuid instanceof Service ) { $ uuid = $ uuid -> getUuid ( ) ; } $ response = $ this -> httpClient -> delete ( $ this -> getResourceUrl ( $ uuid ) , [ ] ) ; return ServiceResponse :: createFromHttpResponse ( $ response ) ; }
Terminate a service
4,958
public function index ( $ state = null , $ name = null , $ unique_name = null ) { $ response = $ this -> httpClient -> get ( 'service/' , [ 'query' => ( new ArrayUtils ( ) ) -> filterNullValues ( [ 'state' => $ state , 'name' => $ name , 'unique_name' => $ unique_name ] ) ] ) ; return ServicesResponse :: createFromHttp...
Get all services
4,959
public function createRouteCollection ( ) { $ routeCollection = $ this -> createNew ( RouteCollection :: class ) ; $ routeCollection -> addRoute ( 'GET' , '/{resourceNamePlural}' , [ $ this , 'callGetResources' ] ) ; $ routeCollection -> addRoute ( 'POST' , '/{resourceNamePlural}' , [ $ this , 'callCreateNewResource' ]...
Create a League RoutCollection object and add our routes to it
4,960
public function createController ( $ resourceNamePlural ) { if ( isset ( $ this -> controllers [ $ resourceNamePlural ] ) == false ) { throw new ControllerNotFoundException ( 'the controller for "' . $ resourceNamePlural . '" does not exist' ) ; } $ controller = $ this -> createNew ( $ this -> controllers [ $ resourceN...
Create a new controller given a resource name
4,961
public function callMethod ( $ resourceNamePlural , $ methodName , $ arguments = [ ] ) { $ controller = $ this -> createController ( $ resourceNamePlural ) ; if ( method_exists ( $ controller , $ methodName ) == false ) { throw new InvalidMethodException ( 'The method (' . $ methodName . ') does not exist for the class...
Call a method on a resource
4,962
public function create ( $ className ) { $ builder = new Builder ( $ className , $ this ) ; $ this -> getGuesser ( ) -> fill ( $ builder ) ; return $ builder ; }
Create a new builder for building objects .
4,963
public function freshSample ( $ name ) { if ( $ name instanceof Builder ) { return $ this -> getSampler ( ) -> sample ( $ name ) ; } $ builder = $ this -> getLinkManager ( ) -> retrieve ( $ name ) ; return $ this -> getSampler ( ) -> sample ( $ builder ) ; }
Returns a fresh sample .
4,964
public function freshSamples ( $ name , $ count ) { if ( $ name instanceof Builder ) { return $ this -> getSampler ( ) -> samples ( $ name , $ count ) ; } $ builder = $ this -> getLinkManager ( ) -> retrieve ( $ name ) ; return $ this -> getSampler ( ) -> samples ( $ builder , $ count ) ; }
Returns fresh samples .
4,965
public function copy ( $ builder , $ type = null ) { if ( ! ( $ builder instanceof Builder ) ) { $ builder = $ this -> retrieve ( $ builder ) ; } return $ builder -> copy ( $ type ) ; }
Retrieve a cloned copy of the specified builder .
4,966
public static function Tttdb ( $ tt1 , $ tt2 , $ dtr , & $ tdb1 , & $ tdb2 ) { $ dtrd ; $ dtrd = $ dtr / DAYSEC ; if ( $ tt1 > $ tt2 ) { $ tdb1 = $ tt1 ; $ tdb2 = $ tt2 + $ dtrd ; } else { $ tdb1 = $ tt1 + $ dtrd ; $ tdb2 = $ tt2 ; } return 0 ; }
- - - - - - - - - i a u T t t d b - - - - - - - - -
4,967
public function add ( $ tag , $ controllerClass ) { add_shortcode ( $ tag , function ( $ tagAttributes , $ tagContent = null ) use ( $ tag , $ controllerClass ) { $ attributes = array ( 'tag' => $ tag , 'parameters' => ( is_array ( $ tagAttributes ) ? $ tagAttributes : array ( ) ) , 'content' => $ tagContent , ) ; $ th...
AddShortcode Add Plugin AddShortcode
4,968
public static function defaultCommandFactory ( DescriptionInterface $ description ) { return function ( $ name , array $ args = [ ] , ServiceClientInterface $ client ) use ( $ description ) { $ operation = null ; if ( $ description -> hasOperation ( $ name ) ) { $ operation = $ description -> getOperation ( $ name ) ; ...
Creates a callable function used to create command objects from a service description .
4,969
public static function make ( $ name , $ data = null , $ nest = null ) { self :: $ view = new Views ( ) ; return self :: $ view -> call ( $ name , $ data , $ nest ) ; }
Call and make a view .
4,970
public static function extend ( $ name , $ data = null ) { return self :: $ view -> call ( $ name , $ data ) -> show ( ) ; }
Extend to child view .
4,971
public static function tag ( $ tag , $ isKey = false , $ strip = null ) { if ( false !== $ isKey ) { return static :: neutralize ( $ tag , $ strip ) ; } $ _tag = static :: deneutralize ( $ tag ) ; return $ _tag ; }
Given a simple name clean it up to a Kisma standard camel - cased format .
4,972
public static function isPlural ( $ word , $ returnSingular = false ) { if ( empty ( $ word ) || ! is_string ( $ word ) || strlen ( $ word ) < 3 ) { return false ; } $ _temp = $ word [ strlen ( $ word ) - 1 ] ; if ( 's' == $ _temp && $ word == static :: pluralize ( substr ( $ word , 0 , - 1 ) ) ) { if ( false !== $ ret...
This function is NOT smart . It only looks for an s at the end of a word . You have been warned .
4,973
public static function pluralize ( $ name ) { static $ _blacklist = array ( 'Amoyese' , 'bison' , 'Borghese' , 'bream' , 'breeches' , 'britches' , 'buffalo' , 'cantus' , 'carp' , 'chassis' , 'clippers' , 'cod' , 'coitus' , 'Congoese' , 'contretemps' , 'corps' , 'debris' , 'deer' , 'diabetes' , 'djinn' , 'eland' , 'elk'...
Converts a word to its plural form . Totally swiped from Yii
4,974
public static function convert ( array $ array , $ rootElementName = '' , $ replaceSpacesByUnderScoresInKeyNames = true , $ xmlEncoding = null , $ xmlVersion = '1.0' ) { $ converter = new static ( $ array , $ rootElementName , $ replaceSpacesByUnderScoresInKeyNames , $ xmlEncoding , $ xmlVersion ) ; return $ converter ...
Convert the given array to an xml string .
4,975
public function strToTopology ( $ str ) { $ len = strlen ( $ str ) ; $ data = array ( 'str' => '' , 'u' => 0 , 'l' => 0 , 'd' => 0 , 's' => 0 ) ; for ( $ i = 0 ; $ i < $ len ; $ i ++ ) { if ( ctype_upper ( $ str [ $ i ] ) ) { $ str [ $ i ] = 'u' ; $ data [ 'u' ] ++ ; } elseif ( ctype_lower ( $ str [ $ i ] ) ) { $ str [...
Converts a string to a topology such that uppercase lowercase digit and special characters to u l d and s respectively .
4,976
public function getPasswordStrength ( $ password ) { $ topology = $ this -> strToTopology ( $ password ) ; $ str = $ topology [ 'str' ] ; $ upper = $ topology [ 'u' ] ; $ lower = $ topology [ 'l' ] ; $ digit = $ topology [ 'd' ] ; $ special = $ topology [ 's' ] ; $ len = strlen ( $ str ) ; $ pairs = unserialize ( file_...
Returns a number that indicates the strength of a topology . The password strength does not consider the characters but only character type . It is found that humans follow patterns based on topologies of uppercase lowercase digits and special characters .
4,977
public function getRoute ( $ url , $ config ) { $ url2 = substr ( $ url , strlen ( Config :: config ( ) [ 'user' ] [ 'framework' ] [ 'folder' ] ) , strlen ( $ url ) ) ; $ routeRight = null ; foreach ( $ this -> routes as $ route ) { if ( ( $ varsValues = $ route -> match ( $ url2 ) ) != false && ( $ route -> method ( )...
after url rewriting return the right route
4,978
protected function _setFirewallConfigArray ( $ in , $ array ) { if ( isset ( $ in [ '' . $ array [ 0 ] . '' ] ) ) { $ to = $ in [ '' . $ array [ 0 ] . '' ] ; array_splice ( $ array , 0 , 1 ) ; foreach ( $ array as $ value ) { if ( isset ( $ to [ '' . $ value . '' ] ) ) { $ to = $ to [ '' . $ value . '' ] ; } else { ret...
get token logged and role value from environment
4,979
protected function createClient ( Repository $ config ) { $ server = trim ( $ config [ 'host' ] ) ; $ port = intval ( $ config [ 'port' ] ) ; $ timeout = floatval ( $ config [ 'timeout' ] ) ; $ persistent = boolval ( $ config [ 'persistent' ] ) ; $ password = isset ( $ config [ 'password' ] ) ? $ config [ 'password' ] ...
create a Redis instance
4,980
public function getClient ( $ name ) { if ( ! isset ( $ this -> serverArray [ $ name ] ) ) { $ name = $ this -> defaultName ; } if ( isset ( $ this -> clientArray [ $ name ] ) ) { try { $ this -> clientArray [ $ name ] -> ping ( ) ; } catch ( \ RedisException $ ex ) { $ this -> clientArray [ $ name ] = $ this -> create...
get Redis instance by name
4,981
public function getHashClientName ( $ key ) { if ( 1 == $ this -> getServerCount ( ) ) { return $ this -> defaultName ; } $ count = intval ( sprintf ( '%u' , crc32 ( $ key ) ) ) ; return $ this -> hashArray [ $ count % sizeof ( $ this -> serverArray ) ] ; }
get server name by hash key
4,982
public function flushAll ( ) { foreach ( array_keys ( $ this -> serverArray ) as $ name ) { $ this -> getClient ( $ name ) -> flushAll ( ) ; } }
Removes all entries from all cache .
4,983
public function createMirror ( $ baseUrl , $ directory , EventDispatcherInterface $ dispatcher = NULL ) { return new ResourceMirror ( isset ( $ dispatcher ) ? $ dispatcher : $ this -> dispatcher , $ baseUrl , $ directory ) ; }
Creates a resource mirror .
4,984
protected function view ( $ name , array $ vars = array ( ) ) { $ path = str_replace ( '.' , DIRECTORY_SEPARATOR , $ name ) ; $ view = @ file_get_contents ( sprintf ( self :: VIEW_PATH_TEMPLATE , $ path ) ) ; if ( false === $ view ) { throw new SystemException ( sprintf ( 'Can\'t locate view "%s".' , $ name ) ) ; } ret...
Generates and returns view
4,985
private function generateView ( $ __queasyViewTemplate , array $ __queasyViewTemplateVars = array ( ) ) { extract ( $ __queasyViewTemplateVars ) ; try { $ output = eval ( ' ?>' . $ __queasyViewTemplate . '<?php ' ) ; if ( false === $ output ) { } return $ output ; } catch ( Throwable $ e ) { } }
Generates view from a template
4,986
public static function Ldn ( $ n , array $ b , array $ ob , array $ sc , array & $ sn ) { foreach ( $ b as $ i ) if ( $ i instanceof iauLDBODY == false ) throw new \ InvalidArgumentException ( "All \$b elements must be iauLDBODY type" ) ; $ CR = AULT / DAYSEC ; $ i ; $ v = [ ] ; $ dt ; $ ev = [ ] ; $ em ; $ e = [ ] ; I...
- - - - - - - i a u L d n - - - - - - -
4,987
public function append ( $ arr ) { if ( is_a ( $ arr , DictionaryInterface :: class ) ) { $ arr = $ arr -> getDictionary ( ) ; } elseif ( false === is_array ( $ arr ) ) { throw new \ Exception ( "Not an array" , 5 ) ; } foreach ( $ arr as $ key => $ val ) { if ( is_numeric ( $ key ) ) { $ this -> setString ( $ key , $ ...
Merge with array or Dictionary
4,988
public function translate ( $ arrayKeys = [ ] ) { $ result = [ ] ; foreach ( $ arrayKeys as $ key => $ value ) { if ( is_numeric ( $ key ) ) { $ fromDictionnary = $ this -> getString ( $ value ) ; $ result [ ] = ( false === $ fromDictionnary ) ? ucwords ( $ value ) : $ fromDictionnary ; } else { $ result [ ] = $ value ...
Translate arrayKeys values with Dictionary
4,989
public function remove ( Node $ node ) { unset ( $ this -> _children [ $ this -> indexOf ( $ node ) ] ) ; $ this -> _children = array_values ( $ this -> _children ) ; return $ this ; }
Remove a node from the list
4,990
public function render ( $ pagination , array $ queryParams = array ( ) , array $ viewParams = array ( ) ) { $ data = $ pagination -> getPaginationData ( ) ; $ data [ 'route' ] = $ pagination -> getRoute ( ) ; $ data [ 'query' ] = array_merge ( $ pagination -> getParams ( ) , $ queryParams ) ; return array_merge ( $ pa...
Generates pagination template data
4,991
public function getTransitionColor ( $ transition ) { return empty ( $ this -> colors [ 'transition' ] [ $ transition ] ) ? $ this -> options [ 'transition' ] [ 'default_color' ] : $ this -> colors [ 'transition' ] [ $ transition ] ; }
Get transition color .
4,992
public function isNegativeColor ( $ color , $ type ) { if ( empty ( $ this -> negativeColors [ $ type ] ) ) { return false ; } return in_array ( $ color , $ this -> negativeColors [ $ type ] ) ; }
Check color is negative?
4,993
public function isPositiveColor ( $ color , $ type ) { if ( empty ( $ this -> positiveColors [ $ type ] ) ) { return false ; } return in_array ( $ color , $ this -> positiveColors [ $ type ] ) ; }
Check color is positive?
4,994
public function getState ( $ state ) { if ( $ state instanceof StatableInterface ) { $ state = $ state -> getState ( ) ; } return $ this -> options [ 'state' ] [ 'translation' ] . '.' . $ state ; }
Get state translator key .
4,995
public function getStateColor ( $ state ) { if ( $ state instanceof StatableInterface ) { $ state = $ state -> getState ( ) ; } return empty ( $ this -> colors [ 'state' ] [ $ state ] ) ? $ this -> options [ 'state' ] [ 'default_color' ] : $ this -> colors [ 'state' ] [ $ state ] ; }
Get state color .
4,996
public function getPosibleTransitions ( StatableInterface $ object = null , $ objectIdentifier = 'id' ) { if ( empty ( $ object ) ) { return ; } $ sm = $ this -> factory -> get ( $ object , $ object -> getStateGraph ( ) ) ; if ( empty ( $ sm ) ) { return ; } $ tasks = array ( ) ; $ accessor = PropertyAccess :: createPr...
Get all of posible transitions .
4,997
public function pageDropDown ( array $ args ) { $ default = $ args [ 'post_type' ] -> name ; if ( isset ( $ this -> original_slugs [ $ args [ 'post_type' ] -> name ] ) ) { $ default = self :: $ originalSlugs [ $ args [ 'post_type' ] -> name ] ; } wp_dropdown_pages ( array ( 'post_status' => array ( 'publish' , 'private...
Renders page dropdown selector
4,998
protected function getHtmlFromTemplate ( \ Throwable $ e ) : string { $ suffix = $ this -> getConfigParam ( 'view' ) [ 'templateSuffix' ] ; $ subDir = $ this -> getConfigParam ( 'view' ) [ 'templateErrorSubDirApp' ] ; $ templateErrorGeneric = $ this -> getConfigParam ( 'view' ) [ 'templateErrorGeneric' ] ; if ( $ e ins...
Searches for the most specific template it can find for the given throwable and returns the HTML .
4,999
public function getAllPagetypes ( ) { $ path = config ( 'page.paths.pagetypes' ) ; $ pagetypes = collect ( ) ; foreach ( glob ( $ path . '/*.php' ) as $ filename ) { $ fullClassName = self :: getFullNamespace ( $ filename ) . '\\' . self :: getClassName ( $ filename ) ; $ pagetypes [ ] = new $ fullClassName ; } return ...
Get all pagetypes .