idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
14,900 | public function validateFormData ( WebRequest $ request , Response $ response , callable $ callback = null ) { $ form = $ this -> searchSubmittedForm ( $ request , $ response ) ; if ( $ form === null ) { return Form :: NOT_SUBMITTED ; } $ errors = $ form -> validateFormData ( $ this -> framework ) ; if ( is_callable ( ... | Searches the submitted Form object in the layout and validates the data |
14,901 | protected function searchSubmittedForm ( WebRequest $ request , Response $ response ) { $ this -> verifyLayout ( ) ; $ form = null ; foreach ( $ this -> layout -> getChildrenByType ( '\\Zepi\\Web\\UserInterface\\Form\\Form' , true ) as $ availableForm ) { $ availableForm -> processFormData ( $ request , $ response ) ; ... | Searches the submitted form object in the layout . |
14,902 | protected function updateErrorBox ( Form $ form , $ errors ) { foreach ( $ form -> getChildrenByType ( '\\Zepi\\Web\\UserInterface\\Form\\ErrorBox' , true ) as $ errorBox ) { $ errorBox -> updateErrorBox ( $ form , false , $ errors ) ; } } | Updates all error boxes inside the given form |
14,903 | public function getFormValues ( ) { $ this -> verifyLayout ( ) ; $ values = array ( ) ; foreach ( $ this -> layout -> getChildrenByType ( '\\Zepi\\Web\\UserInterface\\Form\\Form' , true ) as $ form ) { $ values = $ this -> extractFormValues ( $ form ) ; } return $ values ; } | Returns all the values of the form fields |
14,904 | protected function extractFormValues ( Form $ form ) { $ values = array ( ) ; foreach ( $ form -> getChildrenByType ( '\\Zepi\\Web\\UserInterface\\Form\\Field\\FieldAbstract' , true ) as $ field ) { if ( $ field -> getValue ( ) === null ) { continue ; } $ values [ $ field -> getPath ( $ form ) ] = $ field -> getValue (... | Extracts all values from the given form and returns an array with the field path and the field value . |
14,905 | public function error ( $ message = '' , $ title = '' ) { $ this -> dataCollection -> add ( 'message' , $ message ) ; $ this -> dataCollection -> add ( 'title' , $ title ) ; return $ this -> render ( 'Error' ) ; } | Modal error component |
14,906 | protected function log ( $ message , $ source = null , $ level = E_NOTICE , $ data = null ) { if ( ! ( $ this -> evtManager instanceof Manager ) ) { $ e = new ExceptionExtended ( sprintf ( "%s::\$evtManager isn't instance of %s" , get_class ( $ this ) , Manager :: class ) ) ; $ e -> setData ( $ data ) ; throw $ e ; } i... | Fires event to log message . |
14,907 | public function processContent ( Operation $ operation , $ data ) { try { if ( is_array ( $ data ) ) { $ message = $ this -> contentService -> getMessageByOperation ( $ operation ) ; $ message -> setMessage ( $ data [ 'message' ] ) ; } else { $ message = $ data ; } } catch ( \ Exception $ e ) { $ message = $ data ; } r... | Create or modify the Content object from the form data . |
14,908 | public function postPersistNewEvent ( Operation $ operation , $ content = null ) { $ this -> publishNow ( $ operation ) ; $ this -> em -> persist ( $ content ) ; $ this -> em -> flush ( ) ; } | This event is being called after the new Activity and its related content was persisted . |
14,909 | public function i ( $ text , $ context = array ( ) ) { $ this -> log -> info ( $ text , $ context ) ; $ this -> emit ( self :: SIGNAL_INFORMATION_ENTERED ) ; } | Add a information message . |
14,910 | public function w ( $ text , $ context = array ( ) ) { $ this -> log -> warn ( $ text , $ context ) ; $ this -> emit ( self :: SIGNAL_WARNING_ENTERED ) ; } | Add a warning message . |
14,911 | public function e ( $ text , $ context = array ( ) ) { $ this -> log -> error ( $ text , $ context ) ; $ this -> emit ( self :: SIGNAL_ERROR_ENTERED ) ; } | Add a error message . |
14,912 | public static function load ( string $ filename ) : ConfigInterface { if ( ! file_exists ( $ filename ) ) { throw new \ RuntimeException ( sprintf ( 'Expected config in %s, but the file does not exist.' , $ filename ) , 1 ) ; } $ filename = realpath ( $ filename ) ? : $ filename ; try { $ config = require $ filename ; ... | Loads a ConfigInterface from a PHP file . |
14,913 | public function checkIsAliasExistsAlready ( $ alias , $ path , array $ pathParameters = array ( ) , $ locale = null ) { if ( $ alias === null ) { return false ; } $ already = $ this -> findByAlias ( $ alias ) ; if ( $ already ) { $ seo = $ this -> createNewAlias ( $ alias , $ path , $ pathParameters , $ locale ) ; if (... | Returns true if there is already an alias of another path + pathParameters + locale . |
14,914 | protected function _mapIterable ( $ iterable , $ callback , $ start = null , $ count = null , array & $ results = null ) { $ iterable = $ this -> _normalizeIterable ( $ iterable ) ; $ start = is_null ( $ start ) ? 0 : $ this -> _normalizeInt ( $ start ) ; $ count = is_null ( $ count ) ? 0 : $ this -> _normalizeInt ( $ ... | Invokes a callback for each element of the iterable . |
14,915 | protected function getMove ( $ player = self :: PLAYER_X ) { $ move = $ this -> calculateBestMove ( $ player ) ; if ( ! empty ( $ move ) ) { $ this -> board -> setValue ( $ move , $ player ) ; } return $ move ; } | return recommended value |
14,916 | private function winningValues ( ) { return array_merge ( $ this -> board -> getBoard ( ) , $ this -> transpose ( $ this -> board -> getBoard ( ) ) , $ this -> diagonals ( ) ) ; } | Determine winning values |
14,917 | private function calculateBestMove ( $ player , $ stopOpponentPlayer = true , & $ playerMoveScore = 0 ) { $ winningMoves = [ ] ; $ opponentMoveScore = 0 ; $ opponentMove = [ ] ; if ( ! $ this -> checkPlayer ( $ player ) || $ this -> isFinished ( ) ) { return $ winningMoves ; } if ( $ stopOpponentPlayer ) { $ opponentMo... | Get the best move of a player |
14,918 | private function calculateMoveScore ( $ player , array $ position ) { if ( $ this -> board -> getValue ( $ position ) ) { return null ; } $ totalScore = 0 ; foreach ( $ this -> positions as $ row ) { if ( ! in_array ( $ position , $ row ) ) { continue ; } $ countOpponentMoves = 0 ; $ countPlayerMoves = 0 ; foreach ( $ ... | Get the score of a move |
14,919 | public function get ( $ root , $ path ) { $ url = $ root . $ path ; $ response = Http :: get ( $ url . $ this -> countryCode . $ this -> localLang ) ; if ( is_array ( $ response ) ) { return $ response ; } else { return false ; } } | Gets requested data using Http client and returns the json decoded response |
14,920 | public function getAppDetails ( $ id , $ filter = '' ) { if ( ! empty ( $ filter ) ) { $ filter = '&filters=' . $ filter ; } $ app = $ this -> get ( self :: STEAM_STORE_ROOT , self :: APP_DETAILS_PATH . $ id . $ filter ) ; if ( $ app [ $ id ] [ 'success' ] == true ) { return new App ( $ app [ $ id ] [ 'data' ] ) ; } el... | Retrieves App information for a specific AppID |
14,921 | protected function buildQuery ( ) { $ search = $ this -> repository -> createSearch ( ) ; $ search -> setSize ( $ this -> limit ) ; $ search -> addSort ( new Sort ( 'left' , Sort :: ORDER_ASC ) ) ; $ search -> addQuery ( new TermQuery ( 'active' , true ) , 'must' ) ; if ( ! $ this -> loadHiddenCategories ) { $ search -... | Builds a search query . |
14,922 | private function buildChildNode ( $ node , $ references , $ maxLevel ) { if ( isset ( $ references [ $ node -> getParentId ( ) ] ) ) { $ level = $ references [ $ node -> getParentId ( ) ] -> getLevel ( ) + 1 ; if ( $ maxLevel == 0 || $ level <= $ maxLevel ) { $ node -> setLevel ( $ level ) ; $ node -> setParent ( $ ref... | Builds a child node . |
14,923 | private function buildRootNode ( $ node , $ tree , $ level ) { $ node -> setLevel ( $ level ) ; $ tree [ $ node -> getId ( ) ] = $ node ; } | Builds a root node . |
14,924 | private function buildNode ( $ node , $ references , $ tree , $ maxLevel ) { if ( $ node -> getId ( ) == $ this -> getCurrentCategoryId ( ) ) { $ node -> setCurrent ( true ) ; $ this -> currentLeaf = $ node ; } $ references [ $ node -> getId ( ) ] = $ node ; if ( $ node -> getParentId ( ) == $ this -> rootId ) { $ this... | Builds a node . Sets node parameters . |
14,925 | private function expandNodes ( $ references ) { $ id = $ this -> getCurrentCategoryId ( ) ; if ( $ id ) { while ( isset ( $ references [ $ id ] ) ) { $ references [ $ id ] -> setExpanded ( true ) ; $ id = $ references [ $ id ] -> getParentId ( ) ; } } } | Expands nodes . |
14,926 | private function buildTree ( $ dataSet , $ maxLevel = 0 ) { $ tree = new \ ArrayIterator ( ) ; $ references = new \ ArrayIterator ( ) ; foreach ( $ dataSet as $ node ) { if ( $ node -> isActive ( ) ) { $ this -> buildNode ( $ node , $ references , $ tree , $ maxLevel ) ; } } $ this -> expandNodes ( $ references ) ; $ t... | Builds nested tree from single category list . |
14,927 | protected function sortChildTree ( & $ tree ) { if ( is_array ( $ tree ) ) { uasort ( $ tree , [ $ this , 'sortNodes' ] ) ; foreach ( $ tree as $ node ) { $ children = $ node -> getChildren ( ) ; if ( $ children ) { $ this -> sortChildTree ( $ children ) ; $ node -> setChildren ( $ children ) ; } } } else { $ tree -> u... | Sorts category tree by sort field . |
14,928 | public function sortNodes ( $ a , $ b ) { if ( $ a -> getSort ( ) < $ b -> getSort ( ) ) { return - 1 ; } elseif ( $ a -> getSort ( ) > $ b -> getSort ( ) ) { return 1 ; } elseif ( $ a -> getLeft ( ) < $ b -> getLeft ( ) ) { return - 1 ; } elseif ( $ a -> getLeft ( ) > $ b -> getLeft ( ) ) { return 1 ; } return 0 ; } | Sorts nodes by field sort if value equal then by field left . |
14,929 | public function getTree ( $ maxLevel = 0 , $ getHidden = false ) { $ hash = $ maxLevel . $ getHidden ; if ( ! isset ( $ this -> treeCache [ $ hash ] ) ) { $ this -> setLoadHiddenCategories ( $ getHidden ) ; $ query = $ this -> buildQuery ( ) ; $ results = $ this -> repository -> execute ( $ query , Repository :: RESULT... | Returns nested category tree . |
14,930 | protected function findPartialTree ( $ tree , $ categoryId ) { foreach ( $ tree as $ node ) { if ( $ node -> getId ( ) == $ categoryId ) { return [ $ node ] ; } if ( $ node -> getChildren ( ) ) { $ result = $ this -> findPartialTree ( $ node -> getChildren ( ) , $ categoryId ) ; if ( ! empty ( $ result ) ) { return $ r... | Returns partial tree by category ID . |
14,931 | public function getCategoryInsertionPointValueOptions ( ) { $ trees = $ this -> getCategoryService ( ) -> getAllCategoryTreesAsArray ( ) ; $ valueOptions = array ( ) ; foreach ( $ trees as $ rootId => $ tree ) { $ valueOptions [ $ rootId ] = array ( 'label' => 'Label of category ' . $ rootId , 'options' => array ( ) ) ... | Returns all categoies for the category position select box |
14,932 | protected function _getTranslations ( $ domain ) { if ( ! isset ( $ this -> _translations [ $ domain ] ) ) { if ( ! isset ( $ this -> _translationSources [ $ domain ] ) ) { $ msg = sprintf ( 'No translation directory for domain "%1$s" available' , $ domain ) ; throw new MW_Translation_Exception ( $ msg ) ; } $ location... | Returns the initialized Zend translation object which contains the translations . |
14,933 | public static function dispatch ( ) { self :: $ _config = MRest :: getConfig ( 'routing' ) ; $ routeData = self :: _callDispatcher ( self :: $ _config [ 'dispatcher' ] ) ; if ( ! class_exists ( $ routeData [ 'class' ] ) || ! ( new \ ReflectionClass ( $ routeData [ 'class' ] ) ) -> isInstantiable ( ) ) { throw new \ Exc... | Initialization of the Routing class |
14,934 | private static function _callDispatcher ( $ dispatcherCallback ) { $ dispatcherCallback = $ dispatcherCallback [ 0 ] !== '\\' ? __NAMESPACE__ . '\\' . $ dispatcherCallback : $ dispatcherCallback ; if ( ! is_callable ( $ dispatcherCallback ) ) { throw new \ Exception ( 'Routing dispacher [' . $ dispatcherCallback . '] c... | Calls the route dispatcher which is specified in the configuration . |
14,935 | private static function _mainDispatcher ( $ uri , $ config ) { $ uriInfo = self :: analizeUri ( ) ; $ uri = $ uriInfo [ 'uri' ] ; $ uriItems = explode ( '/' , $ uri ) ; $ attributes = [ ] ; foreach ( $ config [ 'routes' ] as $ routePattern => $ className ) { if ( preg_match ( '#' . $ routePattern . '#' , $ uri ) ) { $ ... | Main dispatcher . Looks for patterns from the config . |
14,936 | private static function _getController ( $ uri , $ namespace ) { $ dir = realpath ( APP_PATH . '/../' . $ namespace ) . DIRECTORY_SEPARATOR ; if ( ! is_dir ( $ dir . $ uri ) ) { $ uriParts = explode ( '/' , $ uri , 2 ) ; if ( is_dir ( $ dir . $ uriParts [ 0 ] ) ) { return self :: _getController ( $ uriParts [ 1 ] , $ n... | Returns the controller s data for an URI |
14,937 | public static function getUri ( ) { if ( self :: $ _uri === null ) { $ uri = explode ( '?' , $ _SERVER [ 'REQUEST_URI' ] , 2 ) [ 0 ] ; self :: $ _uri = self :: fixUri ( substr ( $ uri , strlen ( BASE_URI ) ) ) ; } return self :: $ _uri ; } | Get the current URI |
14,938 | public static function analizeUri ( ) { $ uri = self :: getUri ( ) ; $ uriInfo = pathinfo ( $ uri ) ; if ( ! isset ( $ uriInfo [ 'dirname' ] ) || $ uriInfo [ 'dirname' ] == '.' ) { $ uriInfo [ 'dirname' ] = '' ; } return [ 'type' => isset ( $ uriInfo [ 'extension' ] ) ? $ uriInfo [ 'extension' ] : MRest :: getConfig ( ... | Make an analize of the URI . Returns the output content type and the URI |
14,939 | public static function fixUri ( $ url ) { $ url = preg_replace ( '#/+|\\\+#' , '/' , $ url ) ; if ( $ url [ 0 ] == '/' ) { $ url = substr ( $ url , 1 , strlen ( $ url ) ) ; } if ( substr ( $ url , - 1 ) == '/' ) { $ url = substr ( $ url , 0 , strlen ( $ url ) - 1 ) ; } return $ url ; } | Fix the URI . Removes the multiple slashes |
14,940 | private function directoryOperation ( string $ operation , string $ destination ) : void { try { Filesystem :: checkExists ( $ destination ) ; } catch ( FileNotFoundException $ e ) { $ destinationDir = new self ( $ destination ) ; $ destinationDir -> create ( ) ; } $ files = $ this -> getFiles ( ) ; foreach ( $ files a... | Used to perform copies and moves . |
14,941 | public function getSize ( ) : int { $ files = $ this -> getFiles ( ) ; $ size = 0 ; foreach ( $ files as $ file ) { $ size += $ file -> getSize ( ) ; } return $ size ; } | Recursively get the size of all contents in the directory . |
14,942 | public function moveTo ( string $ destination ) : void { $ this -> directoryOperation ( 'moveTo' , $ destination ) ; $ this -> delete ( ) ; $ this -> path = $ destination ; } | Recursively move a directory and its contents to another location . |
14,943 | public function create ( $ permissions = 0755 ) { Filesystem :: checkNotExists ( $ this -> path ) ; Filesystem :: checkWritable ( dirname ( $ this -> path ) ) ; mkdir ( $ this -> path , $ permissions , true ) ; } | Create the directory pointed to by path . |
14,944 | public function delete ( ) : void { $ files = $ this -> getFiles ( ) ; foreach ( $ files as $ file ) { $ file -> delete ( ) ; } rmdir ( $ this -> path ) ; } | Recursively delete the directory and all its contents . |
14,945 | public function getFiles ( ) : array { Filesystem :: checkExists ( $ this -> path ) ; Filesystem :: checkReadable ( $ this -> path ) ; $ contents = [ ] ; $ files = scandir ( $ this -> path ) ; foreach ( $ files as $ file ) { if ( $ file != '.' && $ file != '..' ) { $ contents [ ] = Filesystem :: get ( "$this->path/$fil... | Get the files in the directory . |
14,946 | protected function curl ( $ type , $ endpoint , $ variables ) { $ url = $ this -> baseUrl . '/' . $ endpoint ; $ handle = curl_init ( ) ; curl_setopt ( $ handle , CURLOPT_POST , true ) ; $ fieldsString = "" ; foreach ( $ variables as $ key => $ value ) { $ fieldsString .= $ key . '=' . $ value . '&' ; } $ fieldsString ... | Curls the API with the desired request type . |
14,947 | protected function setOption ( $ key , $ value ) { if ( ! isset ( $ this -> config [ $ key ] ) ) { throw new Exception \ DomainException ( sprintf ( 'Option "%s" does not exist; available options are (%s)' , $ key , implode ( ', ' , array_map ( function ( $ opt ) { return '"' . $ opt . '"' ; } , array_keys ( $ this -> ... | Option setter with validation If option can have the specified value then it is set otherwise this method throws exception |
14,948 | protected function getOption ( $ key ) { if ( ! isset ( $ this -> options [ $ key ] ) ) { throw new Exception \ RuntimeException ( sprintf ( 'Option "%s" not found' , $ key ) ) ; } return $ this -> options [ $ key ] ; } | Option getter with check |
14,949 | public function Start ( $ Force = FALSE ) { if ( function_exists ( 'apc_fetch' ) && C ( 'Garden.Apc' , FALSE ) ) $ this -> Apc = TRUE ; $ this -> AvailableThemes ( $ Force ) ; $ ThemeName = $ this -> CurrentTheme ( ) ; $ ThemeInfo = $ this -> GetThemeInfo ( $ ThemeName ) ; $ ThemeHooks = GetValue ( 'RealHooksFile' , $ ... | Sets up the theme framework |
14,950 | public function AvailableThemes ( $ Force = FALSE ) { if ( is_null ( $ this -> ThemeCache ) || $ Force ) { $ this -> ThemeCache = array ( ) ; foreach ( $ this -> SearchPaths ( ) as $ SearchPath => $ Trash ) { unset ( $ SearchPathCache ) ; $ SearchPathCacheKey = 'Garden.Themes.PathCache.' . $ SearchPath ; if ( $ this ->... | Looks through the themes directory for valid themes and returns them as an associative array of Theme Name = > Theme Info Array . It also adds a Folder definition to the Theme Info Array for each . |
14,951 | public function getBalance ( ) : float { $ this -> authenticator -> authenticate ( ) ; return ( float ) $ this -> soapClient -> __soapCall ( 'GetCreditBalance' , [ ] ) -> GetCreditBalanceResult ; } | Get the balance |
14,952 | private function tryResolveErrorReason ( string $ message ) : string { $ key = $ this -> responseParser -> parse ( $ message ) ; if ( $ key === 'invalid_phone' ) { return ErrorReasons :: INVALID_PHONE_NUMBER ; } return ErrorReasons :: UNKNOWN ; } | Try to resolve error reason |
14,953 | private function processResultMessages ( Message $ message , array $ recipients , $ resultMessages ) : ResultCollection { if ( is_scalar ( $ resultMessages ) ) { $ key = $ this -> responseParser -> parse ( $ resultMessages ) ; if ( $ key === 'signature_not_allowed' ) { throw new SenderNameNotAllowedException ( sprintf ... | Process the response from TurboSMS |
14,954 | public function makeHttpRequest ( ) { $ url = $ this -> addUrlData ( $ this -> Request -> getUrl ( ) , $ this -> Request -> getUrlData ( ) ) ; $ url = $ this -> addGetData ( $ url , $ this -> Request -> getGetData ( ) ) ; $ Resource = curl_init ( $ url ) ; $ options = [ CURLOPT_RETURNTRANSFER => true , CURLOPT_CONNECTT... | Transportation implementation method |
14,955 | private function parseResponseHeaders ( $ string ) { $ parts = explode ( "\n" , $ string ) ; foreach ( $ parts as $ part ) { if ( strpos ( $ part , ':' ) !== false ) { list ( $ name , $ value ) = explode ( ':' , $ part ) ; $ this -> responseHeaders [ trim ( $ name ) ] = trim ( $ value ) ; } } } | Parsing response block for headers |
14,956 | private function addHeaders ( $ Resource , $ headers ) { $ httpHeaders = array ( ) ; foreach ( $ headers as $ header => $ value ) { $ httpHeaders [ ] = $ header . ': ' . $ value ; } curl_setopt ( $ Resource , CURLOPT_HTTPHEADER , $ httpHeaders ) ; } | Add http headers method |
14,957 | private function addGetData ( $ url , $ data ) { $ parts [ ] = $ url ; if ( ! empty ( $ data ) ) { $ parts [ ] = http_build_query ( $ data ) ; } return implode ( '?' , $ parts ) ; } | Add GET data for resource |
14,958 | private function addPostData ( $ Resource , $ data ) { if ( ! empty ( $ data ) ) { switch ( $ this -> Request -> getContentTypeCode ( ) ) { case Request :: CONTENT_TYPE_UNDEFINED : $ string = http_build_query ( $ data ) ; break ; case Request :: CONTENT_TYPE_JSON : $ string = json_encode ( $ data ) ; break ; case Reque... | Add POST data for request |
14,959 | private function addUrlData ( $ url , array $ data ) { if ( empty ( $ data ) ) { return $ url ; } if ( strpos ( $ url , '?' ) !== false ) { throw new \ InvalidArgumentException ( ) ; } $ parts [ ] = trim ( $ url , '/' ) ; foreach ( $ data as $ key => $ value ) { if ( $ value ) { $ parts [ ] = urlencode ( $ key ) . '/' ... | Add url parameters for url |
14,960 | private function setMethod ( $ Resource , $ method ) { switch ( $ method ) { case Request :: METHOD_GET : curl_setopt ( $ Resource , CURLOPT_HTTPGET , true ) ; break ; case Request :: METHOD_POST : curl_setopt ( $ Resource , CURLOPT_POST , true ) ; break ; } } | Set request HTTP method |
14,961 | public function getPageCount ( ) : int { if ( $ this -> lastResponse && $ this -> lastResponse -> getHeaderLine ( 'X-Total-Pages' ) ) { return ( int ) $ this -> lastResponse -> getHeaderLine ( 'X-Total-Pages' ) ; } return 0 ; } | Returns the number of pages in the collection Returns 0 if the header isn t set |
14,962 | public function getItemCount ( ) : int { if ( $ this -> lastResponse && $ this -> lastResponse -> getHeaderLine ( 'X-Total-Count' ) ) { return ( int ) $ this -> lastResponse -> getHeaderLine ( 'X-Total-Count' ) ; } return 0 ; } | Returns the total item count in the collection Returns 0 if the header isn t set |
14,963 | public function setTaxes ( $ value ) { if ( is_array ( $ value ) ) { $ bag = new Bag ( ) ; foreach ( $ value as $ taxParameters ) { $ bag -> add ( new Tax ( $ taxParameters ) ) ; } $ value = $ bag ; } return $ this -> setParameter ( 'taxes' , $ value ) ; } | Set the item taxes |
14,964 | public function withProperty ( string $ name , $ value ) : self { return new self ( $ this -> object , $ this -> properties -> put ( $ name , $ value ) , $ this -> injectionStrategy , $ this -> extractionStrategy ) ; } | Add a property that will be injected |
14,965 | public function build ( ) : object { return $ this -> properties -> reduce ( $ this -> object , function ( object $ object , string $ key , $ value ) : object { return $ this -> inject ( $ object , $ key , $ value ) ; } ) ; } | Return the object with the list of properties set on it |
14,966 | public function extract ( string ... $ properties ) : MapInterface { $ map = new Map ( 'string' , 'mixed' ) ; foreach ( $ properties as $ property ) { $ map = $ map -> put ( $ property , $ this -> extractProperty ( $ property ) ) ; } return $ map ; } | Extract the given list of properties |
14,967 | private function getRedis ( ) { if ( is_null ( $ this -> Redis ) ) { if ( $ this -> isConfigured ( ) ) { $ this -> Redis = new \ Redis ( ) ; $ this -> connect ( ) ; } else { throw new RedisNotConfiguredException ( ) ; } } return $ this -> Redis ; } | Getter of phpredis object |
14,968 | public function incr ( $ key , $ value = 1 ) { $ value = ( int ) $ value ; try { $ result = ( $ value > 1 ) ? $ this -> getRedis ( ) -> incrBy ( $ key , $ value ) : $ this -> getRedis ( ) -> incr ( $ key ) ; if ( $ result !== false ) { return $ result ; } throw new ImpossibleValueException ( ) ; } catch ( RedisExceptio... | Increment key value |
14,969 | public function decr ( $ key , $ value = 1 ) { $ value = ( int ) $ value ; try { $ result = ( $ value > 1 ) ? $ this -> getRedis ( ) -> decrBy ( $ key , $ value ) : $ this -> getRedis ( ) -> decr ( $ key ) ; if ( $ result !== false ) { return $ result ; } throw new ImpossibleValueException ( ) ; } catch ( RedisExceptio... | Decrement key value |
14,970 | public function append ( $ key , $ value ) { try { $ result = $ this -> getRedis ( ) -> append ( $ key , $ value ) ; if ( $ result !== false ) { return $ result ; } throw new ImpossibleValueException ( ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Append string value |
14,971 | public function mget ( array $ keys ) { try { $ result = $ this -> getRedis ( ) -> mGet ( $ keys ) ; if ( $ result !== false ) { return array_combine ( $ keys , $ result ) ; } throw new ImpossibleValueException ( ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Get multiple keys values |
14,972 | public function set ( $ key , $ value , $ timeout = 0 ) { try { $ result = ( $ timeout == 0 ) ? $ this -> getRedis ( ) -> set ( $ key , $ value ) : $ this -> getRedis ( ) -> psetex ( $ key , $ timeout , $ value ) ; if ( $ result !== false ) { return $ result ; } throw new ImpossibleValueException ( ) ; } catch ( RedisE... | Set key value |
14,973 | public function setnx ( $ key , $ value ) { try { return $ this -> getRedis ( ) -> setnx ( $ key , $ value ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Set key value if not exists |
14,974 | public function delete ( $ keys ) { try { $ result = $ this -> getRedis ( ) -> delete ( $ keys ) ; if ( $ result !== false ) { return $ result ; } throw new ImpossibleValueException ( ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Delete key or keys |
14,975 | public function renamenx ( $ source , $ destination ) { try { return $ this -> getRedis ( ) -> renamenx ( $ source , $ destination ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Rename key if needed key name was not |
14,976 | public function strlen ( $ key ) { try { $ result = $ this -> getRedis ( ) -> strlen ( $ key ) ; if ( $ result !== false ) { return $ result ; } throw new ImpossibleValueException ( ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Get string length of a key |
14,977 | public function expire ( $ key , $ timeout ) { try { return $ this -> getRedis ( ) -> pexpire ( $ key , $ timeout ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Set ttl for a key |
14,978 | public function expireat ( $ key , $ timestamp ) { try { return $ this -> getRedis ( ) -> expireat ( $ key , $ timestamp ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Set time of life for the key |
14,979 | public function ttl ( $ key ) { try { $ result = $ this -> getRedis ( ) -> pttl ( $ key ) ; return ( $ result != - 1 ) ? $ result : false ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Get ttl of the key |
14,980 | public function getbit ( $ key , $ offset ) { $ offset = ( int ) $ offset ; try { $ result = $ this -> getRedis ( ) -> getBit ( $ key , $ offset ) ; if ( $ result !== false ) { return $ result ; } throw new ImpossibleValueException ( ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Get key bit |
14,981 | public function setbit ( $ key , $ offset , $ value ) { $ offset = ( int ) $ offset ; $ value = ( int ) ( bool ) $ value ; try { $ result = $ this -> getRedis ( ) -> setBit ( $ key , $ offset , $ value ) ; if ( $ result !== false ) { return $ result ; } throw new ImpossibleValueException ( ) ; } catch ( RedisException ... | Set key bit |
14,982 | public function evaluate ( $ code , array $ arguments = array ( ) ) { try { if ( empty ( $ arguments ) ) { $ result = $ this -> getRedis ( ) -> eval ( $ code ) ; } else { $ result = $ this -> getRedis ( ) -> eval ( $ code , $ arguments , count ( $ arguments ) ) ; } $ lastError = $ this -> getRedis ( ) -> getLastError (... | Evaluate Lua code |
14,983 | public function evalSha ( $ sha , array $ arguments = array ( ) ) { try { if ( empty ( $ arguments ) ) { $ result = $ this -> getRedis ( ) -> evalSha ( $ sha ) ; } else { $ result = $ this -> getRedis ( ) -> evalSha ( $ sha , $ arguments , count ( $ arguments ) ) ; } $ lastError = $ this -> getRedis ( ) -> getLastError... | Evaluate Lua code by hash |
14,984 | public function sadd ( $ key , $ member ) { try { $ result = $ this -> getRedis ( ) -> sAdd ( $ key , $ member ) ; if ( $ result !== false ) { return $ result ; } throw new ImpossibleValueException ( ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Add member to the set |
14,985 | public function sismembers ( $ key , $ member ) { try { return $ this -> getRedis ( ) -> sIsMember ( $ key , $ member ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Check that member is a member of the set |
14,986 | public function srem ( $ key , $ member ) { try { return $ this -> getRedis ( ) -> sRem ( $ key , $ member ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Remove member from the set |
14,987 | public function sdiffstore ( $ destination , array $ sources ) { try { return call_user_func_array ( array ( $ this -> getRedis ( ) , 'sDiffStore' , ) , array_merge ( array ( $ destination ) , $ sources ) ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Create difference set |
14,988 | public function rpush ( $ key , $ member ) { try { return $ this -> getRedis ( ) -> rPush ( $ key , $ member ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Append value to a list |
14,989 | public function llen ( $ key ) { try { $ length = $ this -> getRedis ( ) -> lLen ( $ key ) ; if ( $ length === false ) { throw new ImpossibleValueException ( ) ; } return $ length ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Returns list length |
14,990 | public function publish ( $ channel , $ message ) { try { return $ this -> getRedis ( ) -> publish ( $ channel , $ message ) ; } catch ( RedisException $ ex ) { throw new ConnectException ( ) ; } } | Publish message to channel |
14,991 | public function transaction ( Closure $ Commands , $ mode = Redis :: MULTI ) { try { $ Instance = $ this -> multi ( $ mode ) ; $ result = $ Commands ( $ Instance ) ; if ( $ result == true ) { return $ Instance -> exec ( ) ; } else { $ Instance -> discard ( ) ; return false ; } } catch ( RedisException $ ex ) { throw ne... | Execute transaction method |
14,992 | protected function prepareBody ( ) { $ body = $ this -> body ; $ result = $ body ; if ( $ this -> isJson ( ) && ( is_array ( $ body ) || is_object ( $ body ) ) ) { $ result = json_encode ( \ pwf \ helpers \ ArrayHelper :: toArray ( $ body ) ) ; } return $ result ; } | Prepare response body for sending |
14,993 | private static function padString ( string $ string , int $ left , int $ right , string $ char ) : string { $ leftPadding = str_repeat ( $ char , $ left ) ; $ rightPadding = str_repeat ( $ char , $ right ) ; return $ leftPadding . $ string . $ rightPadding ; } | Applies padding to a string |
14,994 | public static function set ( $ url = null , array $ config = [ ] ) { $ config [ 'class' ] = static :: className ( ) ; return Instance :: ensure ( $ config , static :: className ( ) , [ $ url ] ) ; } | Modify URL . |
14,995 | public function replacePath ( $ value , $ replace ) { $ this -> data [ 'path' ] = str_replace ( $ value , $ replace , $ this -> data [ 'path' ] ) ; return $ this ; } | Replacing path . |
14,996 | public function setQuery ( $ query ) { if ( ! empty ( $ query ) ) { $ this -> data [ 'query' ] = $ this -> _queryToArray ( $ query ) ; } return $ this ; } | Sets a query . |
14,997 | public function addQueryParams ( array $ queryParams ) { $ this -> data [ 'query' ] = array_merge ( Helper :: getValue ( $ this -> data [ 'query' ] , [ ] ) , $ queryParams ) ; $ this -> data [ 'query' ] = array_filter ( $ this -> data [ 'query' ] ) ; return $ this ; } | Adds a query params . |
14,998 | public function removeQueryParams ( array $ queryParams ) { if ( empty ( $ this -> data [ 'query' ] ) ) { return $ this ; } $ this -> data [ 'query' ] = array_diff_key ( $ this -> data [ 'query' ] , array_flip ( $ queryParams ) ) ; return $ this ; } | Removes a query params . |
14,999 | public function replace ( array $ placeholders = [ ] ) { if ( empty ( $ placeholders ) ) { return $ this ; } $ callback = function ( $ value ) use ( $ placeholders ) { return StringHelper :: replace ( $ value , $ placeholders , false ) ; } ; $ this -> data = ArrayHelper :: map ( $ this -> data , $ callback , true ) ; r... | Replacing placeholders to URL - data . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.