idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
234,900 | public function trnRequest ( $ token , $ redirect = true ) { if ( $ redirect ) { header ( "Location:" . $ this -> hostLive . "trnRequest/" . $ token ) ; return "" ; } else { return $ this -> hostLive . "trnRequest/" . $ token ; } } | Redirects or returns URL to a P24 payment screen |
234,901 | public function apply ( Builder $ builder , Model $ model ) : void { $ builder -> orderBy ( self :: NAME_ATTRIBUTE ) ; } | Apply the sort by name scope to a given Eloquent query builder . |
234,902 | public function setValue ( $ key , $ value ) { $ this -> startSession ( ) ; $ _SESSION [ $ key ] = $ value ; $ this -> sessionData = null ; session_write_close ( ) ; } | Set a session value by key and invalidate the session data |
234,903 | public function getValue ( $ key , $ lockSession = false ) { $ allValues = $ this -> getAllValues ( $ lockSession ) ; if ( isset ( $ allValues [ $ key ] ) ) { return $ allValues [ $ key ] ; } else { return null ; } } | Get a session value by key |
234,904 | public function getAllValues ( $ lockSession = false ) { if ( ! $ this -> sessionData || $ lockSession ) { $ this -> startSession ( ) ; $ this -> sessionData = isset ( $ _SESSION ) ? $ _SESSION : array ( ) ; if ( ! $ lockSession ) session_write_close ( ) ; } return $ this -> sessionData ; } | Get all values - return as array and close session to prevent threading locks . |
234,905 | public function assertFieldSetName ( string ... $ name ) { if ( ! \ in_array ( $ providedName = $ this -> fieldSet -> getSetName ( ) , $ name , true ) ) { throw new UnsupportedFieldSetException ( $ name , $ providedName ) ; } } | Checks that the FieldSet of this condition is supported by the contexts it s used in . |
234,906 | final public function create ( $ type , array $ args = null , callable $ cb = null ) { if ( ! is_string ( $ type ) ) { throw new InvalidArgumentException ( sprintf ( '%s: Type must be a string.' , get_called_class ( ) ) ) ; } if ( ! isset ( $ args ) ) { $ args = $ this -> arguments ( ) ; } $ pool = get_called_class ( )... | Create a new instance of a class by type . |
234,907 | public function setBaseClass ( $ type ) { if ( ! is_string ( $ type ) || empty ( $ type ) ) { throw new InvalidArgumentException ( 'Class name or type must be a non-empty string.' ) ; } $ exists = ( class_exists ( $ type ) || interface_exists ( $ type ) ) ; if ( $ exists ) { $ className = $ type ; } else { $ className ... | If a base class is set then it must be ensured that the created objects are instanceof this base class . |
234,908 | public function resolve ( $ type ) { if ( ! is_string ( $ type ) ) { throw new InvalidArgumentException ( 'Can not resolve class ident: type must be a string' ) ; } $ map = $ this -> map ( ) ; if ( isset ( $ map [ $ type ] ) ) { $ type = $ map [ $ type ] ; } if ( class_exists ( $ type ) ) { return $ type ; } $ resolver... | The Generic factory resolves the class name from an exact FQN . |
234,909 | public function isResolvable ( $ type ) { if ( ! is_string ( $ type ) ) { throw new InvalidArgumentException ( 'Can not check resolvable: type must be a string' ) ; } $ map = $ this -> map ( ) ; if ( isset ( $ map [ $ type ] ) ) { $ type = $ map [ $ type ] ; } if ( class_exists ( $ type ) ) { return true ; } $ resolver... | Whether a type is resolvable . The Generic Factory simply checks if the _FQN_ type class exists . |
234,910 | protected function createClass ( $ className , $ args ) { if ( $ args === null ) { return new $ className ; } if ( ! is_array ( $ args ) ) { return new $ className ( $ args ) ; } if ( count ( array_filter ( array_keys ( $ args ) , 'is_string' ) ) > 0 ) { return new $ className ( $ args ) ; } else { $ reflection = new R... | Create a class instance with given arguments . |
234,911 | protected function addClassToMap ( $ type , $ className ) { if ( ! is_string ( $ type ) ) { throw new InvalidArgumentException ( 'Type (class key) must be a string' ) ; } $ this -> map [ $ type ] = $ className ; return $ this ; } | Add a class name to the available types _map_ . |
234,912 | private function setMap ( array $ map ) { $ this -> map = [ ] ; foreach ( $ map as $ type => $ className ) { $ this -> addClassToMap ( $ type , $ className ) ; } return $ this ; } | Add multiple types in a an array of type = > className . |
234,913 | public function validate ( $ value ) { return is_array ( $ value ) ? $ this -> valueSchema -> validate ( $ value ) : Error :: unit ( [ Error :: NON_ARRAY ] ) ; } | Tells if a given value adhere s to the property s value schema . |
234,914 | protected function createValueSchema ( array $ definition ) { if ( ! isset ( $ definition [ 'properties' ] ) ) { throw new Exception ( "Missing required key 'properties' within assoc definition." ) ; } return $ this -> getSchema ( ) -> getFactory ( ) -> createSchema ( $ this -> getName ( ) . '_type' , [ 'type' => 'asso... | Creates a schema instance that will be used to proxy the property s validation to . |
234,915 | public function toArray ( ) : array { $ array = [ 'id' => $ this -> getId ( ) , ] ; foreach ( get_object_vars ( $ this ) as $ prop => $ value ) { $ array [ $ prop ] = is_callable ( [ $ this -> $ prop , 'toArray' ] ) ? $ this -> $ prop -> toArray ( ) : $ this -> $ prop ; } return $ array ; } | Convert Interoperable Model to an array |
234,916 | public function findCacheByString ( string $ string ) { if ( ! $ this -> isCachedByString ( $ string ) ) { return null ; } return $ this -> cacheByString [ $ string ] ; } | Find an existing cache by string |
234,917 | public static function real ( $ input , $ separator = self :: SEPARATOR_BOTH ) { $ parsed = self :: parse ( $ input , $ separator ) ; if ( ! self :: validate ( $ parsed [ "path" ] ) ) throw new \ Exception ( "Path is invalid" ) ; $ elements_in = self :: explode ( $ parsed [ "path" ] , $ separator ) ; $ elements_out = a... | Resolve a path and return a cleaned real path without checking physical files on any device |
234,918 | public static function validate ( $ input , $ separator = self :: SEPARATOR_BOTH ) { $ pattern = addcslashes ( self :: ALLOWED_CHARS . $ separator , "[].-_/\\" ) ; $ invalid = preg_match ( "/[^" . $ pattern . "]+/" , $ input ) ; return $ invalid ? false : true ; } | Check if a path contains valid characters |
234,919 | public static function extension ( $ file , $ separator = self :: SEPARATOR_BOTH ) { return self :: validate ( $ file , $ separator ) ? substr ( $ file , strrpos ( $ file , '.' ) + 1 ) : false ; } | Return the extension of a file or false on invalid filenames |
234,920 | public static function createFromMutable ( \ ArrayObject $ arrayObject ) : ImmutableArrayObject { return new static ( $ arrayObject -> getArrayCopy ( ) , $ arrayObject -> getFlags ( ) , $ arrayObject -> getIteratorClass ( ) ) ; } | Creates a new ImmutableArrayObject from the given mutable ArrayObject instance . |
234,921 | public function connect ( $ host = '127.0.0.1' , $ port = 11211 ) { if ( ! isset ( $ this -> servers [ $ host . ':' . $ port ] ) ) { $ this -> server = new \ Memcache ( ) ; $ this -> server -> connect ( $ host , $ port ) ; $ this -> servers [ $ host . ':' . $ port ] = $ this -> server ; } else { $ this -> server = $ th... | Connect and use specified server . |
234,922 | public function addUser ( $ name , $ userName , $ email , $ password ) { $ model = $ this -> getUserDefinition ( ) -> modelInstance ( ) ; $ model -> setName ( $ name ) ; $ model -> setEmail ( $ email ) ; $ model -> setUsername ( $ userName ) ; $ model -> setPassword ( $ password ) ; $ this -> save ( $ model ) ; } | Add new user in database |
234,923 | public function getByEmail ( $ email ) { $ filter = new IteratorFilter ( ) ; $ filter -> addRelation ( $ this -> getUserDefinition ( ) -> getEmail ( ) , Relation :: EQUAL , strtolower ( $ email ) ) ; return $ this -> getUser ( $ filter ) ; } | Get the user based on his email . Return Row if user was found ; null otherwise |
234,924 | public function getByUsername ( $ username ) { $ filter = new IteratorFilter ( ) ; $ filter -> addRelation ( $ this -> getUserDefinition ( ) -> getUsername ( ) , Relation :: EQUAL , $ username ) ; return $ this -> getUser ( $ filter ) ; } | Get the user based on his username . Return Row if user was found ; null otherwise |
234,925 | public function getById ( $ userid ) { $ filter = new IteratorFilter ( ) ; $ filter -> addRelation ( $ this -> getUserDefinition ( ) -> getUserid ( ) , Relation :: EQUAL , $ userid ) ; return $ this -> getUser ( $ filter ) ; } | Get the user based on his id . Return Row if user was found ; null otherwise |
234,926 | public function isValidUser ( $ userName , $ password ) { $ filter = new IteratorFilter ( ) ; $ passwordGenerator = $ this -> getUserDefinition ( ) -> getClosureForUpdate ( 'password' ) ; $ filter -> addRelation ( $ this -> getUserDefinition ( ) -> loginField ( ) , Relation :: EQUAL , strtolower ( $ userName ) ) ; $ fi... | Validate if the user and password exists in the file Return Row if user exists ; null otherwise |
234,927 | public function hasProperty ( $ userId , $ propertyName , $ value = null ) { $ user = $ this -> getById ( $ userId ) ; if ( empty ( $ user ) ) { return false ; } if ( $ this -> isAdmin ( $ userId ) ) { return true ; } $ values = $ user -> get ( $ propertyName ) ; return ( $ values !== null ? in_array ( $ value , ( arra... | Check if the user have a property and it have a specific value . Return True if have rights ; false otherwise |
234,928 | public function getProperty ( $ userId , $ propertyName ) { $ user = $ this -> getById ( $ userId ) ; if ( $ user !== null ) { $ values = $ user -> get ( $ propertyName ) ; if ( $ this -> isAdmin ( $ userId ) ) { return array ( "admin" => "admin" ) ; } return $ values ; } return null ; } | Return all sites from a specific user Return String vector with all sites |
234,929 | public function createAuthToken ( $ login , $ password , $ jwtWrapper , $ expires = 1200 , $ updateUserInfo = [ ] , $ updateTokenInfo = [ ] ) { if ( ! isset ( $ login ) || ! isset ( $ password ) ) { throw new InvalidArgumentException ( 'Neither username or password can be empty!' ) ; } $ user = $ this -> isValidUser ( ... | Authenticate a user and create a token if it is valid |
234,930 | public function isValidToken ( $ login , $ jwtWrapper , $ token ) { $ user = $ this -> getByLoginField ( $ login ) ; if ( is_null ( $ user ) ) { throw new UserNotFoundException ( 'User not found!' ) ; } if ( $ user -> get ( 'TOKEN_HASH' ) !== sha1 ( $ token ) ) { throw new NotAuthenticatedException ( 'Token does not ma... | Check if the Auth Token is valid |
234,931 | public function __async_save ( ) { if ( isset ( $ _POST ) ) { $ db_user = null ; if ( ! dbQuery ( 'user' ) -> UserID ( $ _POST [ 'UserID' ] ) -> Active ( 1 ) -> first ( $ db_user ) ) { $ db_user = new \ samson \ activerecord \ user ( false ) ; } $ db_user -> Created = ( $ _POST [ 'Created' ] == 0 ) ? date ( 'Y-m-d H:i:... | Save user data |
234,932 | public function __async_table ( ) { $ query = dbQuery ( 'user' ) -> Active ( 1 ) -> order_by ( 'UserID' ) ; $ table = new Table ( $ query ) ; return array ( 'status' => 1 , 'table' => $ table -> render ( ) ) ; } | Method for rendering table |
234,933 | public static function createTableColumnForSchemaColumn ( Column $ column , $ label ) { if ( $ column instanceof TimeColumn ) { new \ Rhubarb \ Leaf \ Table \ Leaves \ Columns \ TimeColumn ( $ column -> columnName , $ label ) ; } if ( $ column instanceof DateColumn || $ column instanceof MySqlDateTimeColumn ) { return ... | Creates the correct type of table column for the supplied model column . |
234,934 | function getOption ( string $ name , $ defaultValue = false ) { if ( ! $ this -> hasOption ( $ name ) ) { if ( \ is_null ( $ defaultValue ) ) { return $ defaultValue ; } $ this -> _options [ $ name ] = $ defaultValue ; } return $ this -> _options [ $ name ] ; } | Gets the option value of option with defined name or FALSE if the option is unknown . |
234,935 | public function getMethod ( $ allowOverride = true ) { if ( $ allowOverride && $ this -> methodOverride !== NULL && $ this -> method == Http :: METHOD_POST ) { return $ this -> methodOverride ; } return $ this -> method ; } | Get the HTTP request method . |
234,936 | public function setMethod ( $ method ) { $ method = strtoupper ( $ method ) ; if ( ! preg_match ( "'^[A-Z]{2,}$'" , $ method ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid HTTP request method: "%s"' , $ method ) ) ; } $ this -> method = $ method ; return $ this ; } | Set the HTTP request method . |
234,937 | public function setMethodOverride ( $ method = NULL ) { if ( $ method === NULL ) { $ this -> methodOverride = NULL ; } else { $ method = strtoupper ( $ method ) ; if ( ! preg_match ( "'^[A-Z]{2,}$'" , $ method ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid HTTP request method: "%s"' , $ method ) ) ; } ... | Set method override for a POST request . |
234,938 | public function setCookie ( $ name , $ value ) { if ( ! preg_match ( "'^[a-z_0-9\-\.]+$'i" , $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Invalid cookie name: "%s"' , $ name ) ) ; } $ this -> cookies [ $ name ] = $ value ; return $ this ; } | Set a cookie value in the request . |
234,939 | public function setCookies ( array $ cookies ) { $ this -> cookies = [ ] ; foreach ( $ cookies as $ name => $ value ) { $ this -> setCookie ( $ name , $ value ) ; } return $ this ; } | Set all cookies found in the given array . |
234,940 | public static function merge ( array $ array1 , array $ array2 , $ overwrite = true ) { foreach ( $ array2 as $ key => $ value ) { if ( isset ( $ array1 [ $ key ] ) ) { if ( self :: isArray ( $ array1 [ $ key ] ) && self :: isArray ( $ value ) ) { $ array1 [ $ key ] = self :: merge ( $ array1 [ $ key ] , $ value , $ ov... | Merge two arrays recursively . |
234,941 | public function cmdGetOrder ( ) { $ result = $ this -> getListOrder ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableOrder ( $ result ) ; $ this -> output ( ) ; } | Callback for order - get command |
234,942 | public function cmdAddOrder ( ) { $ submitted = $ this -> getParam ( ) ; $ this -> setSubmitted ( null , $ submitted ) ; $ this -> setSubmittedJson ( 'data' ) ; $ this -> validateComponent ( 'order' ) ; if ( $ this -> isError ( ) ) { $ this -> output ( ) ; } $ id = $ this -> order -> add ( $ this -> getSubmitted ( ) ) ... | Callback for order - add command |
234,943 | public function cmdUpdateOrder ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this ->... | Callback for order - update command |
234,944 | public function set ( $ key , $ value ) { $ this -> validateValue ( $ value ) ; $ this -> variables [ $ key ] = $ value ; } | Set a given key to a view value |
234,945 | public function add ( $ key , $ value ) { $ this -> validateValue ( $ value ) ; if ( ! isset ( $ this -> variables [ $ key ] ) ) { $ this -> variables [ $ key ] = [ ] ; } if ( ! is_array ( $ this -> variables [ $ key ] ) ) { $ this -> variables [ $ key ] = [ $ this -> variables [ $ key ] ] ; } $ this -> variables [ $ k... | Adds a value to a collection collection will be created if it does not already exist |
234,946 | public function getMethodAnnotationsForMatchingTag ( $ tag , $ methodName = null ) { if ( $ methodName ) { return isset ( $ this -> methodAnnotations [ $ methodName ] [ $ tag ] ) ? $ this -> methodAnnotations [ $ methodName ] [ $ tag ] : array ( ) ; } else { $ matchingAnnotations = array ( ) ; foreach ( $ this -> getMe... | Get any method annotations with a matching tag . Return these indexed by field name . |
234,947 | public function getFieldAnnotationsForMatchingTag ( $ tag , $ fieldName = null ) { if ( $ fieldName ) { return isset ( $ this -> fieldAnnotations [ $ fieldName ] [ $ tag ] ) ? $ this -> fieldAnnotations [ $ fieldName ] [ $ tag ] : array ( ) ; } else { $ matchingAnnotations = array ( ) ; foreach ( $ this -> getFieldAnno... | Get any field annotations with a matching tag . Return these indexed by field name . |
234,948 | public function getFieldAnnotationsContainingMatchingTag ( $ tag ) { $ matchingAnnotations = array ( ) ; foreach ( $ this -> getFieldAnnotations ( ) as $ field => $ fieldAnnotations ) { if ( isset ( $ fieldAnnotations [ $ tag ] ) ) { $ matchingAnnotations [ $ field ] = $ fieldAnnotations ; } } return $ matchingAnnotati... | Get the full set of field annotations for any fields containing a tag . |
234,949 | public function getFieldAnnotationsNotContainingTags ( $ tags = array ( ) ) { $ matchingAnnotations = array ( ) ; foreach ( $ this -> getFieldAnnotations ( ) as $ field => $ fieldAnnotations ) { $ fieldAnnotationKeys = array_keys ( $ fieldAnnotations ) ; if ( ! array_intersect ( $ fieldAnnotationKeys , $ tags ) ) { $ m... | Get all field annotations not containing passed tags . |
234,950 | public static function invalidEntityType ( $ expected , $ actual ) { return new self ( sprintf ( 'Entity must be an instance of "%s"; got "%s".' , $ expected , is_object ( $ actual ) ? get_class ( $ actual ) : gettype ( $ actual ) ) ) ; } | Entity must be an instance of %s ; got %s . |
234,951 | public static function createDocumentFolderFromPostValues ( $ postValues ) { if ( isset ( $ postValues [ 'title' ] , $ postValues [ 'path' ] , $ postValues [ 'content' ] ) ) { $ documentFolderObject = new Document ( ) ; $ documentFolderObject -> title = $ postValues [ 'title' ] ; $ documentFolderObject -> slug = String... | Create folder from post values |
234,952 | final public function property ( $ name , $ value ) { $ this -> definition -> setProperty ( $ name , static :: processValue ( $ value , true ) ) ; return $ this ; } | Sets a specific property . |
234,953 | protected function assignValue ( FieldInterface $ field ) { $ value = $ this -> accessor -> getPropertyValue ( $ this -> instance , $ field -> name ( ) ) ; if ( $ value === null && $ field -> attribute ( 'autoincrement' ) ) { return ; } if ( $ value === null ) { $ this -> getValueFromReferencedEntity ( $ field ) ; } $ ... | Assigns value to query |
234,954 | public function execute ( IDS_Report $ data ) { if ( ! isset ( $ _SERVER [ 'REQUEST_URI' ] ) ) { $ _SERVER [ 'REQUEST_URI' ] = substr ( $ _SERVER [ 'PHP_SELF' ] , 1 ) ; if ( isset ( $ _SERVER [ 'QUERY_STRING' ] ) && $ _SERVER [ 'QUERY_STRING' ] ) { $ _SERVER [ 'REQUEST_URI' ] .= '?' . $ _SERVER [ 'QUERY_STRING' ] ; } }... | Iterates through registered loggers and executes them |
234,955 | public function addLogger ( ) { $ args = func_get_args ( ) ; foreach ( $ args as $ class ) { if ( ! in_array ( $ class , $ this -> loggers ) && ( $ class instanceof IDS_Log_Interface ) ) { $ this -> loggers [ ] = $ class ; } } } | Registers a new logging wrapper |
234,956 | public function removeLogger ( IDS_Log_Interface $ logger ) { $ key = array_search ( $ logger , $ this -> loggers ) ; if ( isset ( $ this -> loggers [ $ key ] ) ) { unset ( $ this -> loggers [ $ key ] ) ; return true ; } return false ; } | Removes a logger |
234,957 | public function parse ( $ rules ) : Rule \ Set { $ isArray = is_array ( $ rules ) ; $ isAssoc = $ isArray && self :: isAssociative ( $ rules ) ; $ set = null ; if ( is_string ( $ rules ) || is_object ( $ rules ) || $ isAssoc ) { $ set = $ this -> getRule ( $ rules ) ; } elseif ( $ isArray ) { foreach ( $ rules as $ v )... | Turns a number of rule definitions into an actual Rule Set . |
234,958 | public function getRule ( $ rule , $ arg = null ) : Rule \ Set { $ rules = new Rule \ Set ( ) ; if ( is_string ( $ rule ) ) { $ vrule = $ this -> registry -> factory ( $ rule , $ arg ) ; if ( $ vrule instanceof Draft ) { $ vrule = $ vrule -> finish ( $ this -> registry ) ; } $ rules -> add ( $ vrule ) ; } elseif ( is_o... | Parses rule definitions . |
234,959 | public function parseTemplateText ( $ viewText , & $ model ) { extract ( $ model ) ; $ preVariables = get_defined_vars ( ) ? get_defined_vars ( ) : array ( ) ; unset ( $ preVariables [ "model" ] ) ; ob_start ( ) ; include $ viewText ; $ result = ob_get_contents ( ) ; ob_end_clean ( ) ; $ postVariables = get_defined_var... | Parse the view as PHP . This also allows for new variables to be defined within a view and as such these will be merged into the model for use in a parent view if required . |
234,960 | public static function random ( int $ length = 10 , string $ keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ) : string { $ pieces = [ ] ; $ max = mb_strlen ( $ keyspace , '8bit' ) - 1 ; for ( $ i = 0 ; $ i < $ length ; ++ $ i ) { $ pieces [ ] = $ keyspace [ random_int ( 0 , $ max ) ] ; } re... | Creating a random string |
234,961 | public static function safe ( string $ string ) : string { $ split = str_split ( $ string ) ; foreach ( $ split as $ k => $ char ) { if ( str_contains ( '~!@#$%^&*()_-=+<>/\?;:{}[]|,.' , $ char ) ) { unset ( $ split [ $ k ] ) ; } } return implode ( '' , $ split ) ; } | Remove special char s from string |
234,962 | public static function range ( $ max , $ start = 1 , $ step = 1 ) { if ( $ step < 1 ) { return [ ] ; } $ array = [ ] ; for ( $ i = $ start ; $ i <= $ max ; $ i += $ step ) { $ array [ ] = $ i ; } return $ array ; } | Fill an array with a range of numbers . |
234,963 | public static function fetch ( $ array , $ path , $ default = null ) { if ( ! is_array ( $ array ) ) { return $ default ; } if ( $ path === '' ) { return $ array ; } $ path = is_array ( $ path ) ? $ path : explode ( '.' , $ path ) ; $ levels = count ( $ path ) ; if ( $ levels === 0 ) { return $ array ; } $ ret = $ defa... | Fetch nested array value by dot notation path . |
234,964 | public function setTranslatable ( TranslatableInterface $ translatable = null ) { if ( $ translatable === $ this -> translatable ) { return $ this ; } $ previousTranslatable = $ this -> translatable ; $ this -> translatable = $ translatable ; if ( null !== $ previousTranslatable ) { $ previousTranslatable -> removeTran... | Sets the translatable . |
234,965 | protected function escapeParameters ( ) { $ parameters = $ this -> parameters ; foreach ( $ parameters as $ k => $ v ) { switch ( gettype ( $ v ) ) { case 'string' : $ parameters [ $ k ] = $ this -> stringEscape ( $ v ) ; break ; case 'boolean' : $ parameters [ $ k ] = ( $ v === true ) ? 1 : 0 ; break ; case 'object' :... | Escape the parameters and return them . |
234,966 | protected function compileQuery ( ) { $ query = $ this -> sql ; if ( strncasecmp ( $ query , 'INSERT' , 6 ) === 0 || strncasecmp ( $ query , 'UPDATE' , 6 ) === 0 ) { $ query = str_replace ( '%s' , '%p' , $ query ) ; } $ chunks = preg_split ( "/('[^']*')/" , $ query , - 1 , ( PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMP... | Compile the query into a string . |
234,967 | public function matches ( $ sqlQuery ) { if ( empty ( $ this -> compiledQuery ) ) { $ this -> compileQuery ( ) ; } return $ sqlQuery === $ this -> compiledQuery ; } | Check if the query matches against the query and parameters . |
234,968 | public function receive_message ( $ client , $ timeout ) { $ decodedClient = is_object ( $ client ) ? $ client : json_decode ( $ client ) ; $ queue = $ decodedClient -> { 'queues' } -> { 'output' } ; if ( $ this -> debug ) $ this -> log_out ( "DEBUG" , "Polling from '$queue' ..." ) ; $ result = $ this -> sqs -> receive... | Poll for incoming SQS messages using this method . |
234,969 | public function delete_message ( $ client , $ msg ) { $ decodedClient = is_object ( $ client ) ? $ client : json_decode ( $ client ) ; $ this -> sqs -> deleteMessage ( array ( 'QueueUrl' => $ decodedClient -> { 'queues' } -> { 'output' } , 'ReceiptHandle' => $ msg [ 'ReceiptHandle' ] ) ) ; return true ; } | Delete the provided message from the SQS queue |
234,970 | public function start_job ( $ client , $ input , $ jobId = null ) { $ decodedClient = is_object ( $ client ) ? $ client : json_decode ( $ client ) ; $ decodedInput = is_object ( $ input ) ? $ input : json_decode ( $ input ) ; if ( ! $ decodedClient ) { throw new \ InvalidArgumentException ( "Invalid JSON 'client' to st... | Send a start_job command to CPE |
234,971 | private function craft_new_msg ( $ type , $ jobId , $ client , $ data ) { $ data -> { 'client' } = $ client ; $ msg = array ( 'time' => microtime ( true ) , 'type' => $ type , 'jobId' => $ jobId , 'data' => $ data ) ; return $ msg ; } | Craft the object to be sent out to SQS |
234,972 | private function validate_client ( $ client ) { if ( ! isset ( $ client -> { "name" } ) ) throw new \ Exception ( "'client' has no 'name'!" ) ; if ( ! isset ( $ client -> { "queues" } ) ) throw new \ Exception ( "'client' has no 'queues'!" ) ; if ( ! isset ( $ client -> { "queues" } -> { 'input' } ) ) throw new \ Excep... | Validate Client object structure |
234,973 | public static function Color2Rgb ( $ colorDefinition ) { if ( \ is_array ( $ colorDefinition ) ) { if ( \ count ( $ colorDefinition ) > 2 && \ count ( $ colorDefinition ) < 5 ) { return $ colorDefinition ; } throw new ArgumentError ( 'colorDefinition' , $ colorDefinition , 'Drawing' , 'A (a)rgb(a) array with 3-4 Elemen... | Converts the defined color into a RGB color definition ( a numeric indicated array 0 = R 1 = G 2 = B |
234,974 | public static function Color2Hex ( $ colorDefinition ) { if ( \ is_array ( $ colorDefinition ) ) { if ( \ count ( $ colorDefinition ) != 3 ) { throw new ArgumentError ( 'colorDefinition' , $ colorDefinition , 'Drawing' , 'A rgb array with 3 Elements is required!' ) ; } return static :: Rgb2Hex ( $ colorDefinition ) ; }... | Converts the defined Color definition into hexadecimal representation . |
234,975 | public static function Hex2Rgb ( string $ color ) { if ( $ color [ 0 ] == '#' ) { $ color = \ substr ( $ color , 1 ) ; } if ( \ strlen ( $ color ) == 8 ) { $ color = \ substr ( $ color , 2 ) ; } if ( \ strlen ( $ color ) == 6 ) { $ r = $ color [ 0 ] . $ color [ 1 ] ; $ g = $ color [ 2 ] . $ color [ 3 ] ; $ b = $ color ... | Convert a color from hexadecimal notation to RGB array . |
234,976 | public static function Rgb2Hex ( $ r , int $ g = - 1 , int $ b = - 1 ) { if ( \ is_array ( $ r ) ) { if ( \ count ( $ r ) != 3 ) { return false ; } \ array_change_key_case ( $ r , \ CASE_LOWER ) ; if ( isset ( $ r [ 'r' ] ) && isset ( $ r [ 'g' ] ) && isset ( $ r [ 'b' ] ) ) { $ g = $ r [ 'g' ] ; $ b = $ r [ 'b' ] ; $ ... | Converts a RGB array or the 3 r g b values into a hexadecimal color representation . |
234,977 | public function onKernelController ( ) { $ themeContext = $ this -> container -> get ( 'theme.context.front' ) ; $ themeContext -> setCurrentTheme ( $ this -> getShopStorage ( ) -> getCurrentShop ( ) -> getTheme ( ) ) ; } | Sets shop context related session variables |
234,978 | public function getStateOnDate ( $ datestamp , $ addCountryCode = false ) { $ result = [ ] ; $ bind = [ ] ; $ bind [ QBldMax :: BND_ON_DATE ] = $ datestamp ; $ query = $ this -> qbuildSnapOnDate -> build ( ) ; if ( $ addCountryCode ) { $ as = self :: AS_TBL_DWNL ; $ tbl = $ this -> resource -> getTableName ( ECustomer ... | Select downline tree state on the given datestamp . |
234,979 | protected static function sortByOrder ( $ a , $ b ) { if ( ! isset ( $ a [ 'link_order' ] ) && isset ( $ b [ 'link_order' ] ) ) { $ a [ 'link_order' ] = ( $ b [ 'link_order' ] + 1 ) ; } if ( ! isset ( $ b [ 'link_order' ] ) && isset ( $ a [ 'link_order' ] ) ) { $ b [ 'link_order' ] = ( $ a [ 'link_order' ] + 1 ) ; } if... | Comparison for the uasort method |
234,980 | protected static function sortChildElements ( $ array ) { foreach ( $ array as $ i => $ item ) { if ( isset ( $ item [ 'children' ] ) && is_array ( $ item [ 'children' ] ) ) { uasort ( $ array [ $ i ] [ 'children' ] , 'self::sortByOrder' ) ; $ array [ $ i ] [ 'children' ] = array_values ( self :: sortChildElements ( $ ... | Sort child elements from the menu array |
234,981 | public function setAction ( $ action ) { if ( false === is_string ( $ action ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ action ) ) , E_USER_ERROR ) ; } $ this -> action = $ action ; } | Set the action |
234,982 | public function bindParameters ( ContainerBuilder $ container , $ name , $ config ) { $ container -> setParameter ( 'alpixel_user.role_descriptions' , $ config [ 'role_descriptions' ] ) ; $ container -> setParameter ( 'alpixel_user.firewall_templates' , $ config [ 'firewall_templates' ] ) ; $ container -> setParameter ... | Binds the params from config . |
234,983 | public function addConfigVars ( $ path = 'config.ini' ) { if ( $ path === 'config.php' ) { $ arrayIniParams = parse_ini_file ( dirname ( __FILE__ ) . '/' . $ path , true ) ; } else { $ arrayIniParams = parse_ini_file ( $ path , true ) ; } foreach ( $ arrayIniParams as $ key => $ iniParam ) { $ this -> storage [ $ key ]... | Add Config Vars from a new . ini file |
234,984 | public function dispatchEvent ( $ eventName , Event $ event = null ) { if ( $ this -> eventDispatcher instanceof EventDispatcherInterface ) { $ this -> eventDispatcher -> dispatch ( $ eventName , $ event ) ; } } | Dispatches an event to the event dispatcher if one has been configured . |
234,985 | public function quartile ( int $ index ) : Quartile { switch ( $ index ) { case 0 : return $ this -> min ; case 1 : return $ this -> firstQuartile ; case 2 : return $ this -> median ; case 3 : return $ this -> thirdQuartile ; case 4 : return $ this -> max ; } throw new OutOfRangeException ; } | Return the quartile at the wished index |
234,986 | private function buildMin ( Dataset $ dataset ) : self { $ this -> min = new Quartile ( min ( ... $ dataset -> ordinates ( ) ) ) ; return $ this ; } | Extract the minimum value from the dataset |
234,987 | private function buildMax ( Dataset $ dataset ) : self { $ this -> max = new Quartile ( max ( ... $ dataset -> ordinates ( ) ) ) ; return $ this ; } | Extract the maximum value from the dataset |
234,988 | private function buildMean ( Dataset $ dataset ) : self { $ this -> mean = mean ( ... $ dataset -> ordinates ( ) ) ; return $ this ; } | Build the mean value from the dataset |
234,989 | private function buildMedian ( Dataset $ dataset ) : self { $ this -> median = new Quartile ( median ( ... $ dataset -> ordinates ( ) ) ) ; return $ this ; } | Extract the median from the dataset |
234,990 | private function buildQuartile ( Number $ percentage , ColumnVector $ dataset ) : Number { $ dimension = $ dataset -> dimension ( ) ; if ( $ dimension -> value ( ) === 2 ) { return divide ( add ( $ dataset -> get ( 0 ) , $ dataset -> get ( 1 ) ) , 2 ) ; } else if ( $ dimension -> value ( ) === 1 ) { return $ dataset ->... | Return the value describing the the quartile at the given percentage |
234,991 | public function routeParams ( $ params = '' ) { if ( ! empty ( $ params ) ) { if ( is_a ( $ params , 'stdClass' ) ) { $ this -> routeParams = $ params ; } else { return false ; } } else { return $ this -> routeParams ; } } | Get or set the routeParams property . |
234,992 | protected function checkBlank ( $ object , string $ fieldName ) { if ( $ object === null || strlen ( trim ( $ object ) ) === 0 ) { throw new \ InvalidArgumentException ( "The \"$fieldName\" argument is required; it cannot be null, empty, nor containing only whitespace" ) ; } return $ object ; } | Checks that a string argument isn t null empty or just whitespace . |
234,993 | protected function ensure ( array & $ source , string $ key ) { if ( ! isset ( $ source [ $ key ] ) || ! $ source [ $ key ] ) { throw new \ Caridea \ Auth \ Exception \ MissingCredentials ( ) ; } return $ source [ $ key ] ; } | Throws a MissingCredentials if the value is empty . |
234,994 | protected function verify ( string $ input , string $ hash ) { if ( ! password_verify ( $ input , $ hash ) ) { throw new \ Caridea \ Auth \ Exception \ InvalidPassword ( ) ; } } | Verifies a user - provided password against a hash . |
234,995 | public function register ( $ command ) { $ classexp = explode ( '/' , $ command ) ; for ( $ i = 0 ; $ i < count ( $ classexp ) ; $ i ++ ) { $ classexp [ $ i ] = ucwords ( $ classexp [ $ i ] ) ; } $ class = __NAMESPACE__ . '\\' . implode ( '\\' , $ classexp ) ; return new $ class ( ) ; } | Register console command class . |
234,996 | public function getCurrent ( ) { if ( ! $ this -> iterationStarted || is_null ( $ this -> current ) ) throw new InvalidOperationException ( ) ; return $ this -> current -> Current ; } | Get the current value of the iterator |
234,997 | protected function getValidExecProfiles ( string $ profileName = null ) { $ validProfs = [ 'production' => 'production' , 'dev' => 'dev' , 'staging' => 'staging' , 'sandbox' => 'sandbox' , 'demo' => 'demo' , 'debug' => 'debug' ] ; if ( $ profileName ) { if ( ! isset ( $ validProfs [ $ profileName ] ) ) { throw new \ Ru... | Get this config s list of known profiles . |
234,998 | protected function get ( string $ key ) { if ( ! array_key_exists ( $ key , $ this -> config ) ) throw new InvalidConfigException ( "Your configuration doesn't have a value for the key `$key`" ) ; return $ this -> config [ $ key ] ; } | An internal method that ensures an error is thrown if the given key is not found in the configuration . |
234,999 | public static function link ( $ name , $ url , array $ attributes = [ ] ) { return static :: openTag ( 'link' , array_merge ( $ attributes , [ 'href' => $ url ] ) ) . $ name . static :: closeTag ( 'link' ) ; } | Render link tag |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.