idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
55,100 | public function tail ( ) { $ last = count ( $ this -> parts ) - 1 ; if ( $ last < 0 ) { return null ; } return $ this -> parts [ $ last ] ; } | Take a look at the last part of the Message . |
55,101 | public function append ( $ parts ) { if ( $ parts instanceof Message ) { $ parts = $ parts -> toArray ( ) ; } elseif ( ! is_array ( $ parts ) ) { throw new \ Exception ( 'Trying to append non array (' . gettype ( $ parts ) . ').' ) ; } $ this -> parts = array_merge ( $ this -> parts , $ parts ) ; return $ this ; } | Append a the given parts to the Message . |
55,102 | public function prependRoutingInformation ( array $ routing ) { $ count = count ( $ routing ) ; if ( 0 == $ count ) { return ; } $ count -- ; while ( ! $ routing [ $ count ] ) { unset ( $ routing [ $ count ] ) ; $ count -- ; } $ routing [ ] = '' ; $ this -> routing = array_merge ( $ routing , $ this -> routing ) ; } | Prepend the given routing information to the Message . |
55,103 | public function stripRoutingInformation ( ) { if ( ! $ this -> hasRoutingInformation ( ) ) { return $ this ; } while ( true ) { $ part = array_shift ( $ this -> parts ) ; if ( ! $ part ) { break ; } $ this -> routing [ ] = $ part ; } return $ this ; } | Strips first routing headers from this message . This function assumes there is a routing header present results can be unexpected if not . |
55,104 | protected function createProcess ( string $ cmd , string $ cwd ) : Process { $ process = $ this -> processFactory -> getProcess ( $ cmd , $ cwd , $ this -> discoverSystemEnvironment ( ) ) ; $ process -> setTimeout ( null ) ; return $ process ; } | Creates a new process for the execution of a command . |
55,105 | protected function discoverSystemEnvironment ( ) { $ env = [ ] ; $ output = shell_exec ( 'env' ) ; if ( $ output ) { $ lines = explode ( "\n" , $ output ) ; foreach ( $ lines as $ line ) { $ values = explode ( '=' , $ line ) ; if ( ! empty ( $ values [ 0 ] ) && ! empty ( $ values [ 1 ] ) ) { $ env [ $ values [ 0 ] ] = ... | Discovers the current system environment and returns it . |
55,106 | protected function convertToDateTime ( $ date ) { if ( $ date instanceof \ DateTime ) { return $ date ; } if ( is_string ( $ date ) ) { return new \ DateTime ( $ date ) ; } throw new TransformationFailure ( 'YAML Front Matter dates must be quoted.' ) ; } | YAML dates should be quoted . They must be proper iso8601 if they are not quoted . |
55,107 | public function getOption ( $ key = null ) { if ( is_null ( $ key ) ) { return $ this -> defaultParams ; } return $ this -> defaultParams [ $ key ] ; } | return all configuration or only given key value |
55,108 | public function parseControllerString ( $ controllerString ) { $ partsArray = explode ( '@' , $ controllerString ) ; if ( count ( $ partsArray ) > 2 ) { throw new \ Exception ( "Error parsing controller string, too many @'s found. Only use one to destinguish the controller method." , 1 ) ; } else { if ( strpos ( $ part... | Gets parts of route controller string |
55,109 | public function compilePath ( $ path ) { if ( preg_match_all ( '/\{(\w+)\}/' , $ path , $ matches , PREG_SET_ORDER ) == false ) { return $ path ; } else { foreach ( $ matches as $ match ) { $ this -> params [ ] = $ match [ 1 ] ; } $ static = preg_replace ( '/\{(\w+)\}/i' , "" , $ path ) ; $ static = rtrim ( $ static , ... | Compiles route path |
55,110 | public function toArray ( $ filter = ReflectionProperty :: IS_PROTECTED ) { $ objectArray = [ ] ; $ ref = new ReflectionClass ( $ this ) ; $ properties = $ ref -> getProperties ( $ filter ) ; foreach ( $ properties as $ property ) { $ propertyName = $ property -> getName ( ) ; if ( isset ( $ this -> $ propertyName ) ) ... | Convert the current object to array |
55,111 | public function parent ( $ node = null ) { if ( $ node ) { $ parents = $ this -> xpath ( 'ancestor-or-self::' . $ node ) ; } else { $ parents = $ this -> xpath ( 'parent::*' ) ; } return $ parents [ 0 ] ; } | Gets the parent or a preferred ancestor of the current element . |
55,112 | public static function getDependency ( $ locale ) { $ locale = PropelL10n :: normalize ( $ locale ) ; if ( self :: hasDependency ( $ locale ) ) { return self :: $ dependencies [ $ locale ] ; } return null ; } | Returns the dependency for the given locale or null if locale doesn t exist |
55,113 | public static function hasDependency ( $ locale ) { $ locale = PropelL10n :: normalize ( $ locale ) ; return isset ( self :: $ dependencies [ $ locale ] ) ; } | Checks wether there is a dependency registered for the given locale |
55,114 | public static function countDependencies ( $ locale ) { $ locale = PropelL10n :: normalize ( $ locale ) ; $ count = 0 ; while ( isset ( self :: $ dependencies [ $ locale ] ) ) { $ locale = self :: $ dependencies [ $ locale ] ; $ count ++ ; } return $ count ; } | Counts the dependencies a locale may have . |
55,115 | public static function factory ( $ config = array ( ) ) { $ default = array ( 'base_url' => 'https://bitpay.com/api' , ) ; $ required = array ( 'apiKey' ) ; $ config = Collection :: fromConfig ( $ config , $ default , $ required ) ; $ client = new self ( $ config -> get ( 'base_url' ) , $ config ) ; $ client -> setDesc... | Factory method to create a new Bitpay client |
55,116 | public function createInvoice ( $ parameters ) { if ( array_key_exists ( 'posData' , $ parameters ) ) { $ parameters = $ this -> hashPosData ( $ parameters ) ; } return $ this -> getCommand ( 'createInvoice' , $ parameters ) -> getResult ( ) ; } | Create a new BitPay invoice |
55,117 | public function verifyNotification ( $ jsonString ) { if ( ! $ jsonString ) { throw new CallbackJsonMissingException ( ) ; } $ json = json_decode ( $ jsonString , true ) ; if ( ! is_array ( $ json ) ) { throw new CallbackInvalidJsonException ( ) ; } if ( ! array_key_exists ( 'posData' , $ json ) ) { throw new CallbackP... | Call from your notification handler to convert raw post data to an array containing invoice data |
55,118 | private function generateHash ( $ data ) { $ key = $ this -> getConfig ( 'apiKey' ) ; $ hmac = base64_encode ( hash_hmac ( 'sha256' , $ data , $ key , true ) ) ; return strtr ( $ hmac , array ( '+' => '-' , '/' => '_' , '=' => '' ) ) ; } | Generate Callback hash |
55,119 | private function hashPosData ( $ parameters ) { $ hashedPosData = array ( 'posData' => $ parameters [ 'posData' ] ) ; $ hashedPosData [ 'hash' ] = $ this -> generateHash ( serialize ( $ parameters [ 'posData' ] ) ) ; $ parameters [ 'posData' ] = json_encode ( $ hashedPosData ) ; if ( strlen ( $ parameters [ 'posData' ]... | Hash the posData |
55,120 | public function make ( $ module , $ action = "" , $ id = null , $ params = [ ] ) { $ url = URL_ABSOLUTE . $ module ; if ( $ action !== "" ) { $ url .= '-' . $ action ; if ( $ id !== null ) { $ url .= '-' . $ id ; } } $ first = true ; foreach ( $ params as $ i => $ param ) { if ( $ first ) { $ url .= "?" ; $ first = fal... | make an url for page |
55,121 | public function updateInverse ( AbstractModel $ foreign ) { $ rel = $ this -> getRel ( ) -> getInverseOfRel ( ) ; if ( $ rel instanceof UpdateInverseInterface ) { $ rel -> updateInverse ( $ this -> getModel ( ) , $ foreign ) ; } } | Call updateInverse on the rel |
55,122 | public function createGroup ( $ name , $ overwrite = false ) { if ( isset ( $ this -> groups [ $ name ] ) ) { return $ this -> groups [ $ name ] ; } $ assets = $ this -> createAssetArray ( $ name ) ; $ filters = $ this -> createFilterArray ( $ name ) ; $ coll = new AssetCollection ( $ assets , $ filters ) ; if ( $ outp... | Create a new AssetCollection instance for the given group . |
55,123 | public function url ( $ name , array $ options = null ) { $ options = is_null ( $ options ) ? array ( ) : $ options ; $ group = $ this -> createGroup ( $ name ) ; $ cache_buster = '' ; if ( array_get ( $ options , 'md5' , $ this -> md5 ) ) { $ cache_buster = '?' . md5_file ( $ this -> file ( $ name ) ) ; } $ secure = a... | Generate the URL for a given asset group . |
55,124 | protected function createAssetArray ( $ name ) { $ config = $ this -> getConfig ( $ name , 'assets' , array ( ) ) ; $ assets = array ( ) ; foreach ( $ config as $ asset ) { if ( $ this -> assets -> has ( $ asset ) ) { $ assets [ ] = $ this -> assets -> get ( $ asset ) ; } elseif ( str_contains ( $ asset , array ( '/' ,... | Create an array of AssetInterface objects for a group . |
55,125 | protected function createFilterArray ( $ name ) { $ config = $ this -> getConfig ( $ name , 'filters' , array ( ) ) ; $ filters = array ( ) ; foreach ( $ config as $ filter ) { $ filters [ ] = $ this -> filters -> get ( $ filter ) ; } return $ filters ; } | Create an array of FilterInterface objects for a group . |
55,126 | protected function createFilterManager ( ) { $ manager = new FilterManager ( ) ; $ filters = Config :: get ( $ this -> namespace . '::filters' , array ( ) ) ; foreach ( $ filters as $ name => $ filter ) { $ manager -> set ( $ name , $ this -> createFilter ( $ filter ) ) ; } return $ this -> filters = $ manager ; } | Creates the filter manager from the config file s filter array . |
55,127 | protected function createFilter ( $ filter ) { if ( is_callable ( $ filter ) ) { return call_user_func ( $ filter ) ; } elseif ( is_string ( $ filter ) ) { return new $ filter ( ) ; } elseif ( is_object ( $ filter ) ) { return $ filter ; } else { throw new \ InvalidArgumentException ( "Cannot convert $filter to filter"... | Create a filter object from a value in the config file . |
55,128 | protected function parseAssetDefinition ( $ asset ) { if ( starts_with ( $ asset , 'http://' ) ) { return new HttpAsset ( $ asset ) ; } elseif ( str_contains ( $ asset , array ( '*' , '?' ) ) ) { return new GlobAsset ( $ this -> absolutePath ( $ asset ) ) ; } else { return new FileAsset ( $ this -> absolutePath ( $ ass... | Create an asset object from a string definition . |
55,129 | public function getColumns ( ) { $ columns = $ this -> builder ( ) -> queryWithBinding ( Expressions :: getColumns ( $ this -> tableName ) ) -> get ( ) -> all ( ) ; $ _columns = [ ] ; foreach ( $ columns as $ column ) { $ _columns [ ] = Repository :: getPlatformColumn ( $ column ) ; } return $ _columns ; } | Returns columns in a table . |
55,130 | protected function runQueryWithExpression ( String $ expresison , int $ type = 1 ) { $ query = $ this -> builder ( ) -> query ( $ expresison , $ type ) ; Scheme :: destroyColumns ( ) ; return $ query ; } | Processes a raw query . |
55,131 | protected function addForeign ( String $ definition ) { $ this -> runQueryWithExpression ( Expressions :: addForeign ( $ this -> tableName , $ definition ) ) ; } | Add foreign key to table . |
55,132 | public function getAkas ( ) { if ( true === $ this -> isReady ) { $ sCacheFile = $ this -> sRoot . '/cache/' . md5 ( $ this -> iId ) . '_akas.cache' ; $ bUseCache = false ; if ( is_readable ( $ sCacheFile ) ) { $ iDiff = round ( abs ( time ( ) - filemtime ( $ sCacheFile ) ) / 60 ) ; if ( $ iDiff < $ this -> iCache || f... | Returns all local names |
55,133 | private function fetchChildrenResources ( array & $ data , Context $ context ) { $ resourceName = $ this -> config -> getResourceName ( ) ; $ resource = $ context -> getResource ( $ resourceName ) ; $ childrenConfigurations = $ this -> get ( 'ekyna_admin.pool_registry' ) -> getChildren ( $ this -> config ) ; foreach ( ... | Fetches children resources . |
55,134 | protected function createNewResourceForm ( Context $ context , $ footer = true , array $ options = [ ] ) { $ resource = $ context -> getResource ( ) ; $ action = $ this -> generateResourcePath ( $ resource , 'new' ) ; $ form = $ this -> createForm ( $ this -> config -> getFormType ( ) , $ resource , array_merge ( [ 'ac... | Creates the new resource form . |
55,135 | protected function createRemoveResourceForm ( Context $ context , $ message = null , $ footer = true , array $ options = [ ] ) { if ( null === $ message ) { $ message = 'ekyna_core.message.remove_confirm' ; } $ resource = $ context -> getResource ( ) ; $ action = $ this -> generateResourcePath ( $ resource , 'remove' )... | Creates the remove resource form . |
55,136 | protected function appendBreadcrumb ( $ name , $ label , $ route = null , array $ parameters = [ ] ) { $ this -> container -> get ( 'ekyna_admin.menu.builder' ) -> breadcrumbAppend ( $ name , $ label , $ route , $ parameters ) ; } | Appends a link or span to the admin breadcrumb |
55,137 | protected function findResourceOrThrowException ( array $ criteria ) { if ( null === $ resource = $ this -> getRepository ( ) -> findOneBy ( $ criteria ) ) { throw new NotFoundHttpException ( 'Resource not found.' ) ; } return $ resource ; } | Finds a resource or throw a not found exception |
55,138 | protected function isGranted ( $ attributes , $ object = null , $ throwException = true ) { if ( is_null ( $ object ) ) { $ object = $ this -> config -> getObjectIdentity ( ) ; } else { $ object = $ this -> get ( 'ekyna_admin.pool_registry' ) -> getObjectIdentity ( $ object ) ; } if ( ! $ this -> get ( 'security.author... | Checks if the attributes are granted against the current token . |
55,139 | protected function createModal ( $ action ) { $ modal = new Modal ( sprintf ( '%s.header.%s' , $ this -> config -> getId ( ) , $ action ) ) ; $ buttons = [ ] ; if ( in_array ( $ action , [ 'new' , 'edit' , 'remove' ] ) ) { $ submitButton = [ 'id' => 'submit' , 'label' => 'ekyna_core.button.save' , 'icon' => 'glyphicon ... | Creates a modal object . |
55,140 | public static function configure ( EventManagerInterface $ eventManager , ServiceLocatorInterface $ serviceLocator , array $ listeners ) { if ( ! empty ( $ listeners ) ) { foreach ( $ listeners as $ key => $ value ) { if ( $ value instanceof ListenerAggregateInterface ) { $ listener = $ value ; } elseif ( is_string ( $... | Attach listeners from array |
55,141 | public static function run ( App $ cdl , string $ method , Slim $ app , Type $ type , array $ routes ) : void { foreach ( $ routes as $ options ) { if ( isset ( $ options [ 'action' ] ) && $ cdl -> hasRoute ( $ method , $ options [ 'action' ] ) ) { $ route = $ cdl -> getRoute ( $ method , $ options [ 'action' ] ) ; sel... | Dispatches the given data and registers the appropriate route |
55,142 | private static function hookRoute ( App $ cdl , Slim $ app , Route $ route , string $ method ) { $ options = $ route -> getOptions ( ) ; $ routing = $ app -> { $ method } ( $ options [ 'url' ] , System :: jsonResponse ( function ( Request $ request , Response $ response , array $ args ) use ( $ route ) { return $ route... | Hooks a custom route into the slim framework |
55,143 | private static function hookError ( App $ cdl , Slim $ app , string $ method , array $ options ) { $ routing = $ app -> { $ method } ( $ options [ 'url' ] , System :: jsonResponse ( function ( ) { return Route :: noRoute ( ) ; } ) ) ; self :: applyMiddleware ( $ cdl , $ options , $ routing ) ; } | Adds an error Message if this route is defined but contains no action |
55,144 | private static function applyMiddleware ( App $ cdl , array $ settings , \ Slim \ Route $ route ) : void { if ( isset ( $ settings [ 'middleware' ] ) && ! empty ( $ settings [ 'middleware' ] ) ) { foreach ( $ settings [ 'middleware' ] as $ middleware ) { if ( $ cdl -> hasMiddleware ( $ middleware ) ) { $ middleware = $... | Adds all given middleware to the current route if they exist |
55,145 | protected function getContent ( $ contentId ) { $ content = null ; if ( ! is_null ( $ contentId ) ) { $ language = $ this -> currentSiteManager -> getSiteLanguage ( ) ; $ content = $ this -> contentRepository -> findPublishedVersion ( $ contentId , $ language ) ; } if ( is_null ( $ content ) && $ this -> requestStack -... | Get content to display |
55,146 | protected function _normalizeChild ( $ child , $ config = null ) { if ( is_scalar ( $ child ) || is_null ( $ child ) ) { return $ this -> _normalizeSimpleChild ( $ child , $ config ) ; } return $ this -> _normalizeComplexChild ( $ child , $ config ) ; } | Normalizes a map child element . |
55,147 | protected function _createChildInstance ( $ child , $ config = null ) { $ childConfig = $ this -> _getChildConfig ( $ child , $ config ) ; $ factory = $ this -> _getChildFactory ( $ child , $ config ) ; return $ factory -> make ( $ childConfig ) ; } | Creates a new instance of a child element . |
55,148 | public static function normalizeUrl ( $ url ) { if ( substr ( $ url , 0 , 1 ) != '/' ) $ url = '/' . $ url ; if ( substr ( $ url , - 1 ) == '/' ) $ url = substr ( $ url , 0 , - 1 ) ; if ( ! strlen ( $ url ) ) $ url = '/' ; return $ url ; } | Adds leading slash and removes trailing slash from the URL . |
55,149 | public static function segmentizeUrl ( $ url ) { $ url = self :: normalizeUrl ( $ url ) ; $ segments = explode ( '/' , $ url ) ; $ result = array ( ) ; foreach ( $ segments as $ segment ) { if ( strlen ( $ segment ) ) $ result [ ] = $ segment ; } return $ result ; } | Splits an URL by segments separated by the slash symbol . |
55,150 | public static function rebuildUrl ( array $ urlArray ) { $ url = '' ; foreach ( $ urlArray as $ segment ) { if ( strlen ( $ segment ) ) $ url .= '/' . trim ( $ segment ) ; } return self :: normalizeUrl ( $ url ) ; } | Rebuilds a URL from an array of segments . |
55,151 | public static function segmentIsOptional ( $ segment ) { $ name = mb_substr ( $ segment , 1 ) ; $ optMarkerPos = mb_strpos ( $ name , '?' ) ; if ( $ optMarkerPos === false ) return false ; $ regexMarkerPos = mb_strpos ( $ name , '|' ) ; if ( $ regexMarkerPos === false ) return true ; if ( $ optMarkerPos !== false && $ ... | Checks whether an URL pattern segment is optional . |
55,152 | public static function getParameterName ( $ segment ) { $ name = mb_substr ( $ segment , 1 ) ; $ optMarkerPos = mb_strpos ( $ name , '?' ) ; $ regexMarkerPos = mb_strpos ( $ name , '|' ) ; if ( $ optMarkerPos !== false && $ regexMarkerPos !== false ) { if ( $ optMarkerPos < $ regexMarkerPos ) return mb_substr ( $ name ... | Extracts the parameter name from a URL pattern segment definition . |
55,153 | public static function getSegmentRegExp ( $ segment ) { if ( ( $ pos = mb_strpos ( $ segment , '|' ) ) !== false ) { $ regexp = mb_substr ( $ segment , $ pos + 1 ) ; if ( ! mb_strlen ( $ regexp ) ) return false ; return '/' . $ regexp . '/' ; } return false ; } | Extracts the regular expression from a URL pattern segment definition . |
55,154 | public static function getSegmentDefaultValue ( $ segment ) { $ optMarkerPos = mb_strpos ( $ segment , '?' ) ; if ( $ optMarkerPos === false ) return false ; $ regexMarkerPos = mb_strpos ( $ segment , '|' ) ; $ value = false ; if ( $ regexMarkerPos !== false ) $ value = mb_substr ( $ segment , $ optMarkerPos + 1 , $ re... | Extracts the default parameter value from a URL pattern segment definition . |
55,155 | public function uploadAction ( ) { $ authenticationService = $ this -> getServiceLocator ( ) -> get ( 'zfcuser_auth_service' ) ; if ( ! $ authenticationService -> hasIdentity ( ) ) { return $ this -> redirect ( ) -> toRoute ( 'zfcuser' ) ; } $ user = $ this -> getUser ( ) ; if ( ! $ user ) { return $ this -> notFoundAc... | Uploads User Image |
55,156 | public function displayAction ( ) { $ id = $ this -> params ( ) -> fromRoute ( 'id' , null ) ; $ filter = $ this -> params ( ) -> fromRoute ( 'filter' , null ) ; if ( ! $ id ) { return $ this -> notFoundAction ( ) ; } $ user = $ this -> getUserMapper ( ) -> findById ( $ id ) ; if ( ! $ user ) { return $ this -> notFoun... | Displays User Image |
55,157 | function mod ( $ data , $ op = null ) { if ( ! ( $ this -> data instanceof Expr ) ) { $ this -> data = new Expr ( $ this -> name ) ; } if ( $ data instanceof Expr ) { $ this -> data -> add ( $ data ) ; } elseif ( ! isset ( $ op ) && is_numeric ( $ data ) ) { $ this -> data -> add ( new Expr ( "+ $data" ) ) ; } else { $... | Modify the data |
55,158 | public function init ( ) { parent :: init ( ) ; $ defaults = [ self :: TYPE_INFO => [ '{class}' => 'alert alert-info alert-dismissible' , '{icon}' => '<i class="icon fa fa-info-circle"></i>' , '{title}' => Yii :: t ( 'cza' , 'Tips' ) , '{content}' => '' ] , self :: TYPE_DANGER => [ '{class}' => 'alert alert-danger aler... | with outside wrapper or not |
55,159 | public function get ( $ css = null , $ compress = true ) { if ( null === $ css ) { foreach ( ( array ) $ this -> _list as $ src ) { if ( ! file_exists ( $ src ) ) { continue ; } $ css .= file_get_contents ( $ src ) ; } } $ this -> _list = [ ] ; return $ compress ? $ this -> parse ( $ css ) : $ css ; } | Get Packed CSS |
55,160 | public function setPath ( $ path ) { if ( file_exists ( $ path ) ) { $ this -> path = $ path ; } else { throw new NotFoundException ( sprintf ( 'The requested page was not found (searching "%s")!' , $ path ) ) ; } return $ this ; } | Define the path of the document to treat |
55,161 | protected function buildResponse ( $ etag = null , DateTime $ lastModified = null ) { if ( 'POST' === $ this -> getRequest ( ) -> getMethod ( ) ) { $ response = new Response ( ) ; $ response -> setPrivate ( ) ; return $ response ; } else return parent :: buildResponse ( $ etag , $ lastModified ) ; } | Build the response so that depending on settings it s cacheable |
55,162 | public static function morphKeys ( $ originalArray , $ morphTo = 'camel' ) { $ newArray = [ ] ; foreach ( $ originalArray as $ key => $ value ) { if ( is_array ( $ value ) ) { $ value = static :: morphKeys ( $ value , $ morphTo ) ; } $ newKey = '' ; switch ( $ morphTo ) { case 'camel' : $ newKey = StringHelper :: camel... | Will camelize all keys found in a array or multi dimensional array |
55,163 | public static function castValues ( Array $ originalArray ) { foreach ( $ originalArray as $ key => $ value ) { switch ( true ) { case $ value === 'true' : $ originalArray [ $ key ] = true ; break 1 ; case $ value === 'false' : $ originalArray [ $ key ] = false ; break 1 ; case is_numeric ( $ value ) : $ originalArray ... | Will cast 123 as int true as the boolean true etc |
55,164 | public static function sortByPriority ( Array $ originalArray , Array $ priority , $ strictMatch = true ) { $ priorityArray = [ ] ; foreach ( $ priority as $ priorityElement ) { foreach ( $ priorityElement as $ priorityKey => $ priorityValue ) { foreach ( $ originalArray as $ originalElementKey => $ originalElement ) {... | Re - orders an array by moving elements to the top of the array based on a pre - defined array stating which elements to move to top of array |
55,165 | public function checkIsOnAdmin ( MvcEvent $ e ) { $ matches = $ e -> getRouteMatch ( ) ; if ( ! $ matches instanceof Router \ RouteMatch ) { throw new \ Exception ( 'No Route Matched Found, Make sure for the event priority!' ) ; } $ matchedRouteName = $ matches -> getMatchedRouteName ( ) ; if ( ( $ slashOcurr = strpos ... | Check is Matched Route from Admin and Set - Service \ Share flag |
55,166 | public function getPassWordHash ( ) { if ( empty ( $ this -> wpPassWordHash ) ) { $ this -> wpPassWordHash = new PasswordHash ( 8 , true ) ; } return $ this -> wpPassWordHash ; } | Gets the instance of the WP PasswordHash class |
55,167 | public function check ( string $ password , string $ hashedPassword ) : bool { return $ this -> getPassWordHash ( ) -> checkPassword ( $ password , $ hashedPassword ) ; } | Check hash . Generate hash from user provided password string or data array and check against existing hash . |
55,168 | public function check ( $ value ) : bool { try { if ( false == \ DateTime :: createFromFormat ( $ this -> rule , $ value ) ) { return false ; } return true ; } catch ( \ Exception $ e ) { return false ; } } | Check the constraint . Child classes should attempt to report the error to the validator . |
55,169 | public function getHtmlByMarkdown ( $ string ) { if ( false === class_exists ( '\Parsedown' ) ) { throw new \ RuntimeException ( 'Missing Parsedown. Try: composer require "erusev/parsedown" "^1.6.1"' ) ; } $ parse = new Parsedown ( ) ; $ parse -> setBreaksEnabled ( $ this -> isParameterParseDownBreaksEnabled ( ) ) ; re... | Get HTML By Markdown |
55,170 | public function getStringByByte ( $ bytes , $ decimals = 2 , $ decimalPoint = '.' , $ thousandsSeparator = ',' ) { $ size = [ 'B' , 'kB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' , 'ZB' , 'YB' , ] ; $ factor = intval ( floor ( ( strlen ( $ bytes ) - 1 ) / 3 ) ) ; if ( false === isset ( $ size [ $ factor ] ) ) { return $ bytes... | Get Human Readable Bytes |
55,171 | public function getStringByDate ( DateTime $ date ) { $ dateNow = new DateTime ( ) ; if ( $ dateNow < $ date ) { return 'Future date not implemented.' ; } if ( $ date -> format ( 'Ymd' ) === $ dateNow -> format ( 'Ymd' ) ) { return $ this -> getTranslator ( ) -> trans ( 'time.today' ) ; } if ( $ date -> format ( 'Ymd' ... | Get String By Date |
55,172 | public function getResource ( $ name = null ) { if ( null === $ name ) { $ name = $ this -> config -> getResourceName ( ) ; } if ( isset ( $ this -> resources [ $ name ] ) ) { return $ this -> resources [ $ name ] ; } return null ; } | Returns a resource by name . |
55,173 | public function getIdentifiers ( $ with_current = false ) { $ identifiers = [ ] ; foreach ( $ this -> resources as $ name => $ resource ) { if ( ! ( ! $ with_current && $ name === $ this -> config -> getResourceName ( ) ) ) { $ identifiers [ $ name . 'Id' ] = $ resource -> getId ( ) ; } } return $ identifiers ; } | Returns the identifiers . |
55,174 | public function getTemplateVars ( array $ extra = [ ] ) { $ extraKeys = array_keys ( $ extra ) ; if ( 0 < count ( $ extraKeys ) ) { foreach ( array_keys ( $ this -> resources ) as $ key ) { if ( array_key_exists ( $ key , $ extraKeys ) ) { throw new \ RuntimeException ( sprintf ( 'Key "%s" used in extra template vars o... | Returns the template resources vars . |
55,175 | public function getMarkerId ( $ marker , $ prefix = null ) { $ marker = $ this -> pointToIndArray ( $ marker ) ; $ key = substr ( md5 ( $ marker [ 0 ] . $ marker [ 1 ] ) , 0 , 6 ) ; if ( ! isset ( $ this -> _markerId [ $ key ] ) ) { $ this -> _markerId [ $ key ] = 'mk' . $ this -> mapId . static :: $ markerCount ++ ; i... | Generate an ID for marker on a sequential order . |
55,176 | public function attach ( $ service , $ callback , $ priority = 1 ) { $ service = $ this -> normalizeServiceName ( $ service ) ; if ( empty ( $ this -> services [ $ service ] ) ) { $ this -> services [ $ service ] = new PriorityQueue ( ) ; } if ( is_string ( $ callback ) ) { $ id = $ callback ; $ callback = null ; } els... | Attach service listener |
55,177 | public function detach ( LazyCallbackHandler $ listener ) { $ service = $ listener -> getMetadatum ( 'service' ) ; $ service = $ this -> normalizeServiceName ( $ service ) ; if ( ! $ service || empty ( $ this -> services [ $ service ] ) ) { return false ; } $ return = $ this -> services [ $ service ] -> remove ( $ list... | Detach service listener |
55,178 | public function trigger ( CommandInterface $ command , $ callback = null ) { if ( $ callback && ! is_callable ( $ callback ) ) { throw new Exception \ InvalidCallbackException ( 'Invalid callback provided' ) ; } $ service = $ this -> normalizeServiceName ( $ command -> getService ( ) ) ; $ responses = new ResponseColle... | Trigger all listeners for a given command |
55,179 | public function querySelector ( $ selector ) { $ converter = new CssSelectorConverter ( ) ; $ xpathQuery = $ converter -> toXPath ( $ selector ) ; $ result = $ this -> xpath -> query ( $ xpathQuery ) ; if ( ! $ result -> item ( 0 ) ) { return null ; } return new Node ( $ result -> item ( 0 ) ) ; } | select single element from dom using css style selectors |
55,180 | public function querySelectorAll ( $ selector ) { $ converter = new CssSelectorConverter ( ) ; $ xpathQuery = $ converter -> toXPath ( $ selector ) ; $ results = $ this -> xpath -> query ( $ xpathQuery ) ; if ( ! $ results -> item ( 0 ) ) { return [ ] ; } $ return = new NodeCollection ( ) ; for ( $ i = 0 ; $ i < $ resu... | select multiple elements from dom using css style selectors |
55,181 | private function registerData ( $ domain , $ dataset , $ action = 'create' ) { foreach ( $ dataset as $ reference => $ data ) { $ this -> addReference ( $ reference , $ domain -> getAction ( $ action ) -> denormalize ( $ data ) -> resolve ( ) ) ; } } | Register given data set into given domain . |
55,182 | public function query ( $ query , $ bindData = [ ] ) { try { if ( empty ( $ bindData ) ) { $ statement = $ this -> pdo -> query ( $ query ) ; } else { $ statement = $ this -> prepareQuery ( $ query , $ bindData ) ; $ statement -> execute ( ) ; $ statement -> errorCode ( ) ; } } catch ( \ PDOException $ e ) { $ boundDat... | Pepare and execute a query while binding data at the same time . Prevents the writing of repetitive prepare and execute statements . This method returns an array which contains the results of the query that was executed . For queries which do not return any results a null is returned . |
55,183 | private function expand ( $ params ) { unset ( $ params [ 'driver' ] ) ; if ( isset ( $ params [ 'file' ] ) ) { if ( $ params [ 'file' ] != '' ) { return $ params [ 'file' ] ; } } $ equated = [ ] ; foreach ( $ params as $ key => $ value ) { if ( $ value == '' ) { continue ; } else { $ equated [ ] = "$key=$value" ; } } ... | Expands the configuration array into a format that can easily be passed to PDO . |
55,184 | public function describeTable ( $ table ) { $ table = explode ( '.' , $ table ) ; if ( count ( $ table ) > 1 ) { $ schema = $ table [ 0 ] ; $ table = $ table [ 1 ] ; } else { $ schema = $ this -> getDefaultSchema ( ) ; $ table = $ table [ 0 ] ; } return $ this -> getDescriptor ( ) -> describeTables ( $ schema , [ $ tab... | Returns the description of a database table as an associative array . |
55,185 | private function getDescriptor ( ) { if ( ! is_object ( $ this -> descriptor ) ) { $ descriptorClass = '\\ntentan\\atiaa\\descriptors\\' . ucfirst ( $ this -> config [ 'driver' ] ) . 'Descriptor' ; $ this -> descriptor = new $ descriptorClass ( $ this ) ; } return $ this -> descriptor ; } | Returns an instance of a descriptor for a given driver . |
55,186 | public function getIndex ( ) { if ( ! $ this -> index ) { $ this -> index = $ this -> entityManager -> createIndex ( $ this -> class ) ; $ this -> index -> save ( ) ; } return $ this -> index ; } | Gets the index object for the class this repository applies to . |
55,187 | public function findAll ( ) { $ collection = new ArrayCollection ( ) ; if ( $ this -> meta instanceof Node ) { foreach ( $ this -> getIndex ( ) -> query ( 'id:*' ) as $ node ) { $ collection -> add ( $ this -> entityManager -> loadNode ( $ node ) ) ; } } elseif ( $ this -> meta instanceof Relation ) { foreach ( $ this ... | Gets all nodes or relations . |
55,188 | public function findOneBy ( array $ criteria ) { if ( count ( $ criteria ) == 0 ) { throw new Exception ( "Please supply at least one criteria to findOneBy()." ) ; } if ( $ this -> meta instanceof Node ) { $ query = $ this -> createIndexQuery ( $ criteria ) ; if ( $ node = $ this -> getIndex ( ) -> queryOne ( $ query )... | Finds one node or relation by search criteria . |
55,189 | public function findBy ( array $ criteria ) { if ( count ( $ criteria ) == 0 ) { throw new Exception ( "Please supply at least one criteria to findBy()." ) ; } $ collection = new ArrayCollection ( ) ; if ( $ this -> meta instanceof Node ) { $ query = $ this -> createIndexQuery ( $ criteria ) ; foreach ( $ this -> getIn... | Finds all nodes an relations by search criteria . |
55,190 | private function createIndexQuery ( array $ criteria ) { $ query = new IndexQuery ( ) ; foreach ( $ criteria as $ key => $ value ) { $ query -> addAndTerm ( $ key , $ value ) ; } return $ query -> getQuery ( ) ; } | Creates an index query out of the supplied criteria . |
55,191 | private function getSearchableProperty ( $ property ) { $ property = Meta \ Reflection :: normalizeProperty ( $ property ) ; foreach ( $ this -> meta -> getIndexedProperties ( ) as $ p ) { if ( Meta \ Reflection :: normalizeProperty ( $ p -> getName ( ) ) == $ property ) { return $ property ; } } if ( $ this -> meta in... | Gets a indexed property name after doing required string manipulations . |
55,192 | public function registerTwig ( ) { \ Twig_Autoloader :: register ( ) ; $ loader = new \ Twig_Loader_Filesystem ( $ _SERVER [ 'DOCUMENT_ROOT' ] . '/../src/' . $ this -> app -> getProjectName ( ) . '/View' ) ; $ twig = new \ Twig_Environment ( $ loader , array ( 'cache' => $ _SERVER [ 'DOCUMENT_ROOT' ] . '/../app/cache/t... | Register new Twig_Environment |
55,193 | public function createValidator ( ) { $ sv = Validation :: createValidatorBuilder ( ) -> enableAnnotationMapping ( ) -> getValidator ( ) ; $ validator = new Validator ( $ sv ) ; return $ validator ; } | Creates an instance of the Symfony Validator |
55,194 | protected function newPath ( $ path ) { list ( $ mnt , $ remain ) = $ this -> splitPath ( $ path ) ; return new Path ( $ path , $ remain , $ this -> getFilesystemAt ( $ mnt ) ) ; } | Generate Path object . Override this method if you want to |
55,195 | protected function splitPath ( $ path ) { $ pref = $ this -> getMountPoint ( $ path ) ; $ remain = ltrim ( substr ( $ path , strlen ( $ pref ) ) , '/' ) ; return [ $ pref , $ remain ] ; } | Split into mount point and the remain |
55,196 | protected function saveToCache ( $ key , $ obj ) { if ( isset ( $ this -> path_cache [ $ key [ 0 ] ] ) && sizeof ( $ this -> path_cache [ $ key [ 0 ] ] ) > 1 ) { $ this -> path_cache [ $ key [ 0 ] ] = [ ] ; } $ this -> path_cache [ $ key [ 0 ] ] [ $ key ] = $ obj ; } | Save Path object to local cache |
55,197 | public function getInstance ( ) { if ( ! $ this -> isInstanceLoaded ( ) ) { $ inst = $ this -> loadInstance ( ) ; if ( ! $ this -> instance ) $ this -> instance = $ inst ; } return $ this -> instance ; } | The default implementation checks if the instance already was loaded if not it will load it store it and return . |
55,198 | protected function encode ( $ value ) { $ key = ( string ) $ value ; if ( ! isset ( static :: $ cacheEncode [ $ key ] ) ) { $ isAngularVar = false ; if ( \ mb_substr ( $ value , 0 , 2 ) == '{{' && \ mb_substr ( $ value , - 2 ) == '}}' ) { $ isAngularVar = true ; $ value = \ trim ( \ mb_substr ( $ value , 2 , - 2 ) ) ; ... | Encode a path segment . |
55,199 | public function encode ( $ number ) { $ number = ( int ) $ number ; $ result = array ( ) ; if ( 0 === $ number ) { $ result [ ] = $ this -> dictionary [ 0 ] ; } while ( $ number > 0 ) { $ result [ ] = $ this -> dictionary [ ( $ number % $ this -> radix ) ] ; $ number = floor ( $ number / $ this -> radix ) ; } return im... | Base 62 encodes a number . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.