idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
233,200 | public static function arrayChangeKeys ( $ data , $ keyName = 'id' ) { $ temp = [ ] ; if ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ row ) { if ( isset ( $ row [ $ keyName ] ) ) { $ temp [ $ row [ $ keyName ] ] = $ row ; } else { $ temp [ ] = $ row ; } } } return $ temp ; } | Rearange array keys to use selected field from row element |
233,201 | public static function elapsedTime ( $ timestamp ) { $ dateDiff = self :: timeDiff ( $ timestamp ) ; unset ( $ dateDiff [ 'month' ] ) ; $ dateDiff [ 'week' ] = floor ( $ dateDiff [ 'days_total' ] / 7 ) ; $ dateDiff [ 'day' ] = $ dateDiff [ 'days_total' ] % 7 ; return $ dateDiff ; } | Calculate time period and return it in separated time segments |
233,202 | public function getRealIP ( $ allowPrivateRange = false , array $ prependHeaders = null ) { $ headers = [ 'HTTP_CF_CONNECTING_IP' , 'CLIENT_IP' , 'FORWARDED' , 'FORWARDED_FOR' , 'FORWARDED_FOR_IP' , 'HTTP_CLIENT_IP' , 'HTTP_FORWARDED' , 'HTTP_FORWARDED_FOR' , 'HTTP_FORWARDED_FOR_IP' , 'HTTP_PC_REMOTE_ADDR' , 'HTTP_PROX... | Return real users IP address even if behind proxy |
233,203 | public static function timeDiff ( $ timestamp ) { $ dateRef = new \ DateTime ( '@' . $ timestamp ) ; $ dateNow = new \ DateTime ( ) ; $ dateDiff = $ dateNow -> diff ( $ dateRef ) ; return [ 'past_time' => $ dateDiff -> invert , 'year' => $ dateDiff -> y , 'month' => $ dateDiff -> m , 'day' => $ dateDiff -> d , 'hour' =... | Calculates time difference between current time and specified timestamp and returns array with human readable properties of time interval |
233,204 | public function verify ( $ assertion ) { $ response = $ this -> _post ( array ( 'audience' => $ this -> audience , 'assertion' => $ assertion ) ) ; if ( $ response -> status !== 'okay' ) { throw new Exception ( 'Invalid assertion - ' . $ response -> reason ) ; } return $ response ; } | Verifies a BrowserID assertion |
233,205 | protected function _post ( $ data ) { $ ch = curl_init ( ) ; curl_setopt_array ( $ ch , array ( CURLOPT_URL => static :: ENDPOINT , CURLOPT_POST => true , CURLOPT_POSTFIELDS => json_encode ( $ data ) , CURLOPT_HEADER => false , CURLOPT_RETURNTRANSFER => true , CURLOPT_SSL_VERIFYPEER => true , CURLOPT_SSL_VERIFYHOST => ... | Makes an HTTP POST request to verification endpoint |
233,206 | public static function parseUserNick ( $ userId = null , $ onEmpty = 'guest' ) : ? string { if ( ! Any :: isInt ( $ userId ) ) { return \ App :: $ Security -> strip_tags ( $ onEmpty ) ; } $ identity = App :: $ User -> identity ( $ userId ) ; if ( ! $ identity ) { return \ App :: $ Security -> strip_tags ( $ onEmpty ) ;... | Get user nickname by user id with predefined value on empty or not exist profile |
233,207 | public function validate ( $ value , $ options ) { $ this -> value = $ value ; $ this -> options = $ options ; $ this -> errors = [ ] ; return $ this -> checkIt ( ) ; } | Main validation function |
233,208 | protected function resolveDependencies ( array $ dependencies , array $ parameters = [ ] ) { $ results = [ ] ; foreach ( $ dependencies as $ dependency ) { if ( array_key_exists ( $ dependency -> name , $ parameters ) ) { $ results [ ] = $ parameters [ $ dependency -> name ] ; } else { $ results [ ] = is_null ( $ class... | Resolves dependencies recursively |
233,209 | public function resolveMethod ( $ instance , string $ method , array $ parameters = [ ] ) { $ name = get_class ( $ instance ) ; $ reflection = new \ ReflectionMethod ( $ name , $ method ) ; $ dependencies = $ reflection -> getParameters ( ) ; $ instances = $ this -> resolveDependencies ( $ dependencies , $ parameters )... | Calls the method of an instance after resolving dependencies |
233,210 | public function resolveClosure ( \ Closure $ closure ) { $ reflection = new \ ReflectionFunction ( $ closure ) ; $ dependencies = $ reflection -> getParameters ( ) ; $ instances = $ this -> resolveDependencies ( $ dependencies ) ; $ o = $ reflection -> invokeArgs ( $ instances ) ; return $ o ; } | Resolves the dependencies of a function |
233,211 | public function setView ( \ Zend \ View \ Renderer \ RendererInterface $ view ) { $ this -> view = $ view ; return $ this ; } | Set the View object |
233,212 | private static function _isResolved ( array $ dependenciesList , array $ resolved ) { foreach ( $ dependenciesList as $ dependency ) { if ( ! array_key_exists ( $ dependency , $ resolved ) ) { return false ; } } return true ; } | Checks whether all items from dependencies list are among keys in resolved |
233,213 | public function setImage ( $ image ) { $ this -> image = base64_encode ( $ image ) ; $ this -> tempPath = sys_get_temp_dir ( ) . '/' . uniqid ( 'ladybug_' ) ; file_put_contents ( $ this -> tempPath , $ image ) ; } | Sets image content |
233,214 | protected function generateCachePath ( string $ resourceId , string $ disk , string $ extension , int $ width = 0 , int $ height = 0 , $ fit = null ) : string { if ( $ this -> isLocalOrPublic ( $ disk ) ) { $ folder = config ( 'filesystems.disks.' . $ disk . '.root' ) . '/cache/' . str_replace ( '-' , '/' , $ resourceI... | Generating resource cache location and name |
233,215 | protected function createImage ( string $ disk , $ source , $ destination , $ width = 0 , $ height = 0 , $ fit = false ) : bool { if ( $ width == 0 ) { $ width = null ; } if ( $ height == 0 ) { $ height = null ; } if ( $ this -> isLocalOrPublic ( $ disk ) ) { $ source = config ( 'filesystems.disks.' . $ disk . '.root' ... | Creating image based on provided data |
233,216 | public function findPostingForId ( $ id ) { $ dql = ' SELECT p FROM %s p WHERE p.id = :id AND p.organization = :organization ' ; return $ this -> em -> createQuery ( sprintf ( $ dql , $ this -> postingFqcn ) ) -> setParameter ( 'id' , $ id ) -> setPar... | Find Posting for id |
233,217 | public function createPosting ( AccountInterface $ account = null , $ amount = null ) { $ posting = new $ this -> postingFqcn ( $ account , $ amount ) ; $ posting -> setOrganization ( $ this -> oh -> getOrganization ( ) ) ; return $ posting ; } | Create new Posting |
233,218 | public function check ( $ driver ) { switch ( $ driver ) { case self :: DRIVER_MEMCACHE : return extension_loaded ( 'memcache' ) ; case self :: DRIVER_MEMCACHED : return extension_loaded ( 'memcached' ) ; } return false ; } | Checks installed extensions |
233,219 | public static function fromNative ( ) { $ codeString = \ func_get_arg ( 0 ) ; $ code = CountryCode :: getByName ( $ codeString ) ; $ country = new self ( $ code ) ; return $ country ; } | Returns a new Country object given a native PHP string country code |
233,220 | public function sameValueAs ( ValueObjectInterface $ country ) { if ( false === Util :: classEquals ( $ this , $ country ) ) { return false ; } return $ this -> getCode ( ) -> sameValueAs ( $ country -> getCode ( ) ) ; } | Tells whether two Country are equal |
233,221 | protected function driverMatcher ( $ tag ) { $ matched = [ ] ; foreach ( $ this -> drivers as $ id => $ driver ) { if ( ! $ driver -> ping ( ) || '' !== $ tag && ( ! $ driver instanceof TaggableInterface || ! $ driver -> hasTag ( $ tag ) ) ) { continue ; } $ f = $ this -> factors [ $ id ] ; for ( $ i = 0 ; $ i < $ f ; ... | Driver tag matcher |
233,222 | public function prependParser ( ValueParserInterface $ parser ) { $ parsers = $ this -> parsers ; if ( array_key_exists ( $ parser -> getName ( ) , $ parsers ) ) { unset ( $ parsers [ $ parser -> getName ( ) ] ) ; } $ this -> parsers = array_merge ( [ $ parser -> getName ( ) => $ parser ] , $ parsers ) ; return $ this ... | Prepend parser to list of parsers HIGH priority . |
233,223 | public static function getSObjectFields ( SObject $ sob ) { if ( ! isset ( $ sob -> fields ) ) return null ; $ fields = $ sob -> fields ; if ( is_object ( $ fields ) ) $ fields = get_object_vars ( $ fields ) ; return $ fields ; } | Gets the Salesforce fields member out of an SObject and guarentees conversion to an associative array . |
233,224 | public static function updateSObjectFields ( SObject $ sob , $ fields ) { if ( ! is_array ( $ fields ) && ! is_object ( $ fields ) ) throw new InvalidArgumentException ( '$fields must be an array or object' ) ; if ( is_object ( $ sob -> fields ) ) $ fields = ( object ) $ fields ; $ sob -> fields = $ fields ; return $ s... | Updates an SObject s fields member using either an object or an associative array . |
233,225 | public static function sendException ( \ Exception $ ex ) { $ class = get_class ( $ ex ) ; switch ( $ class ) { case 'Smalldb\\StateMachine\\TransitionAccessException' : $ http_code = '403' ; break ; case 'Smalldb\\StateMachine\\InstanceDoesNotExistException' : $ http_code = '404' ; break ; default : $ http_code = '500... | Send info about thrown exception and set proper HTTP code . |
233,226 | public static function writeException ( \ Exception $ ex ) { $ response = array ( 'exception' => get_class ( $ ex ) , 'message' => $ ex -> getMessage ( ) , 'code' => $ ex -> getCode ( ) , ) ; static :: writeJson ( $ response ) ; } | Render exception as JSON string |
233,227 | public function string ( $ key , $ language = '' ) { if ( ! $ this -> hasTranslations ( ) ) { return $ this -> container [ 'lang' ] [ $ key ] ; } if ( $ language == '' ) { $ language = I18N :: getCurrent ( ) ; } if ( array_key_exists ( 'lang_' . $ language , $ this -> container ) ) { return $ this -> container [ 'lang_... | Return the textual version of the term |
233,228 | public function translated ( $ language = '' ) { if ( ! $ this -> hasTranslations ( ) ) { return true ; } if ( $ language == '' ) { $ language = I18N :: getCurrent ( ) ; } if ( array_key_exists ( 'lang_' . $ language , $ this -> container ) ) { return $ this -> container [ 'lang_' . $ language ] [ 'translated' ] ; } re... | Is it translated in this language ? |
233,229 | public function editLanguage ( $ language = '' ) { if ( ! array_key_exists ( 'lang_' . $ language , $ this -> container ) ) { throw new UndefinedLanguageException ; } return $ this -> container [ 'lang_' . $ language ] ; } | Retrieve a language for edition |
233,230 | public function load ( $ file ) { $ retVal = array ( ) ; try { $ retVal = SymFonyYaml :: parse ( $ file ) ; } catch ( \ Exception $ e ) { throw new YamlException ( $ e -> getmessage ( ) , $ e -> getCode ( ) , $ e ) ; } return $ this -> filter ( self :: ON_YAML_LOAD_FILTER , $ retVal , $ file ) ; } | Parses yaml file and returns an array . |
233,231 | public function save ( $ array , $ file ) { try { ob_start ( ) ; $ this -> dump ( $ array ) ; $ data = ob_get_clean ( ) ; file_put_contents ( $ file , $ this -> filter ( self :: ON_YAML_SAVE_FILTER , $ data , $ array , $ file ) ) ; } catch ( \ Exception $ e ) { throw new YamlException ( $ e -> getMessage ( ) , $ e -> g... | Save array as yml to file . |
233,232 | public function getEntityName ( ) { $ tags = $ this -> getTags ( ) ; if ( isset ( $ tags [ 'entity-name' ] ) ) { return $ tags [ 'entity-name' ] ; } $ name = ucwords ( $ this -> name ) ; $ name = \ str_replace ( '_' , '' , $ name ) ; return $ name ; } | The name of this relation as per the Bond convention Uppercase first letter . Replace _ with |
233,233 | public function getLinks ( ) { if ( isset ( $ this -> links ) ) { return $ this -> links ; } $ this -> links = array ( ) ; foreach ( $ this -> getAttributes ( ) as $ column ) { if ( $ column -> isUnique ( ) and ( $ references = $ column -> getIsReferencedBy ( ) ) ) { foreach ( $ references as $ reference ) { if ( $ ref... | Get array of links to this table |
233,234 | public function getAttributes ( $ includeParents = true ) { if ( ! $ this -> columns ) { $ this -> columns = $ this -> catalog -> pgAttributes -> findByAttrelid ( $ this -> oid ) -> sortByAttnum ( ) ; } $ output = $ this -> columns -> copy ( ) ; if ( ! $ includeParents ) { $ output -> filter ( function ( $ attribute ) ... | Get all columns on this relation |
233,235 | public function isLogTable ( $ default = false ) { $ tags = $ this -> getTags ( ) ; if ( array_key_exists ( 'isLogTable' , $ tags ) ) { return boolval ( $ tags [ 'isLogTable' ] ) ; } elseif ( array_key_exists ( 'logging' , $ tags ) ) { return true ; } return ( bool ) $ default ; } | Is this relation a logTable ( ie is it tagged logtable |
233,236 | public static function normalizeConfig ( $ config , $ key , $ plural = null ) { if ( null === $ plural ) { $ plural = $ key . 's' ; } if ( isset ( $ config [ $ plural ] ) ) { return $ config [ $ plural ] ; } if ( isset ( $ config [ $ key ] ) ) { if ( is_string ( $ config [ $ key ] ) || ! is_int ( key ( $ config [ $ key... | Normalizes a configuration entry . |
233,237 | public function addProvider ( string $ name , Provider $ provider ) : self { $ this -> providers [ $ name ] = $ provider ; return $ this ; } | Adds a new Provider . |
233,238 | public function eager ( string $ name , string $ type , $ factory ) : self { $ provider = new Provider ( $ type , $ factory ) ; $ this -> eager [ ] = $ name ; return $ this -> addProvider ( $ name , $ provider ) ; } | Adds a singleton component to be instantiated after the container is . |
233,239 | public function lazy ( string $ name , string $ type , $ factory ) : self { return $ this -> addProvider ( $ name , new Provider ( $ type , $ factory ) ) ; } | Adds a singleton component to be instantiated on demand . |
233,240 | public function proto ( string $ name , string $ type , $ factory ) : self { return $ this -> addProvider ( $ name , new Provider ( $ type , $ factory , false ) ) ; } | Adds a component that provides a new instance each time it s instantiated . |
233,241 | public function build ( Container $ parent = null ) : Objects { $ container = new Objects ( $ this -> providers , $ parent ) ; if ( ! empty ( $ this -> eager ) ) { foreach ( $ this -> eager as $ v ) { $ container -> get ( $ v ) ; } } $ this -> providers = [ ] ; $ this -> eager = [ ] ; return $ container ; } | Builds a container using the settings called . |
233,242 | public function setConfig ( $ config ) { if ( is_string ( $ config ) ) { $ this -> config = $ this -> createConfig ( $ config ) ; } elseif ( is_array ( $ config ) ) { $ this -> config = $ this -> createConfig ( $ config ) ; } elseif ( $ config instanceof ConfigInterface ) { $ this -> config = $ config ; } else { throw ... | Sets the object s configuration container . |
233,243 | public function config ( $ key = null , $ default = null ) { if ( $ this -> config === null ) { $ this -> config = $ this -> createConfig ( ) ; } if ( $ key !== null ) { if ( $ this -> config -> has ( $ key ) ) { return $ this -> config -> get ( $ key ) ; } elseif ( ! is_string ( $ default ) && is_callable ( $ default ... | Gets the object s configuration container or a specific key from the container . |
233,244 | protected function getData ( $ key ) { $ cacheKey = $ this -> key ( $ key ) ; return array_key_exists ( $ cacheKey , $ this -> cache ) ? $ this -> cache [ $ this -> key ( $ key ) ] : false ; } | Performs a fetch of our data from the cache without logging in the logger . That allows this method to be used in other functions . |
233,245 | public function getPort ( ) { if ( $ this -> port ) { return $ this -> port ; } elseif ( isset ( self :: $ defaultPorts [ $ this -> scheme ] ) ) { return self :: $ defaultPorts [ $ this -> scheme ] ; } return null ; } | Get the port part of the URl . |
233,246 | public function combine ( $ url ) { $ url = static :: fromString ( $ url ) ; if ( ! $ this -> isAbsolute ( ) && $ url -> isAbsolute ( ) ) { $ url = $ url -> combine ( $ this ) ; } $ parts = $ url -> getParts ( ) ; if ( $ parts [ 'scheme' ] ) { return new static ( $ parts [ 'scheme' ] , $ parts [ 'host' ] , $ parts [ 'u... | Combine the URL with another URL and return a new URL instance . |
233,247 | public static function fromNative ( ) { $ args = func_get_args ( ) ; $ firstName = new StringLiteral ( $ args [ 0 ] ) ; $ middleName = new StringLiteral ( $ args [ 1 ] ) ; $ lastName = new StringLiteral ( $ args [ 2 ] ) ; return new self ( $ firstName , $ middleName , $ lastName ) ; } | Returns a Name objects form PHP native values |
233,248 | public function sameValueAs ( ValueObjectInterface $ name ) { if ( false === Util :: classEquals ( $ this , $ name ) ) { return false ; } return $ this -> getFullName ( ) == $ name -> getFullName ( ) ; } | Tells whether two names are equal by comparing their values |
233,249 | public static function insertElement ( array $ array , $ element , $ position ) { $ res = array_slice ( $ array , 0 , $ position , true ) ; if ( is_array ( $ element ) ) { $ res = array_merge ( $ res , $ element ) ; } else { array_push ( $ res , $ element ) ; } $ res = array_merge ( $ res , array_slice ( $ array , $ po... | Adds a given element into the array on the given position without replacing the old entry |
233,250 | public static function getPrevKey ( $ key , array $ array ) { $ keys = array_keys ( $ array ) ; $ found_index = array_search ( $ key , $ keys ) ; if ( $ found_index === false || $ found_index === 0 ) return false ; return $ keys [ $ found_index - 1 ] ; } | Returns the previous key from an array |
233,251 | public static function getNextKey ( $ key , array $ array ) { $ keys = array_keys ( $ array ) ; $ found_index = array_search ( $ key , $ keys ) ; if ( $ found_index === false || $ found_index + 1 === count ( $ keys ) ) return false ; return $ keys [ $ found_index + 1 ] ; } | Returns the next key from an array |
233,252 | public function lengthGreaterThan ( $ number ) { Argument :: i ( ) -> test ( 1 , 'numeric' ) ; return strlen ( ( string ) $ this -> value ) > ( float ) $ number ; } | Returns true if the value length is greater than the passed argument |
233,253 | protected function isSoftBool ( $ string ) { if ( ! is_scalar ( $ string ) || $ string === null ) { return false ; } $ string = ( string ) $ string ; return $ string == '0' || $ string == '1' ; } | Test if 0 or 1 or string 1 oe 0 |
233,254 | protected function isSoftFloat ( $ number ) { if ( ! is_scalar ( $ number ) || $ number === null ) { return false ; } $ number = ( string ) $ number ; return preg_match ( '/^[-+]?(\d*)?\.\d+$/' , $ number ) ; } | Test if float or string float |
233,255 | protected function isSoftInteger ( $ number ) { if ( ! is_scalar ( $ number ) || $ number === null ) { return false ; } $ number = ( string ) $ number ; return preg_match ( '/^[-+]?\d+$/' , $ number ) ; } | Test if integer or string integer |
233,256 | protected function isSoftSmall ( $ value ) { if ( ! is_scalar ( $ value ) || $ value === null ) { return false ; } $ value = ( float ) $ value ; return $ value >= 0 && $ value <= 9 ; } | Returns true if the value is between 0 and 9 |
233,257 | static function arrayMerge ( ) { $ output = [ ] ; foreach ( func_get_args ( ) as $ array ) { foreach ( $ array as $ key => $ value ) { $ output [ $ key ] = isset ( $ output [ $ key ] ) ? array_merge ( $ output [ $ key ] , $ value ) : $ value ; } } return $ output ; } | Array merge including integers as key |
233,258 | static function arrayGet ( & $ var , $ key , $ default = null ) { $ toks = explode ( '.' , $ key ) ; for ( $ i = 0 ; $ i < count ( $ toks ) ; $ i ++ ) { $ var = & $ var [ $ toks [ $ i ] ] ; } return is_array ( $ var ) || is_object ( $ var ) ? json_decode ( json_encode ( $ var ) ) : ( is_null ( $ var ) && ! is_null ( $ ... | Array get using dots to traverse keys |
233,259 | static function arraySet ( & $ var , $ key , $ val ) { $ toks = explode ( '.' , $ key ) ; for ( $ i = 0 ; $ i < count ( $ toks ) ; $ i ++ ) { $ var = & $ var [ $ toks [ $ i ] ] ; } $ var = $ val ; } | Set array key value using dots to traverse keys |
233,260 | static function arrayUnset ( & $ var , $ key ) { $ toks = explode ( '.' , $ key ) ; $ toks_len = count ( $ toks ) ; $ last = null ; for ( $ i = 0 ; $ i < $ toks_len - 1 ; $ i ++ ) { $ var = & $ var [ $ toks [ $ i ] ] ; } if ( isset ( $ toks [ $ toks_len - 1 ] ) ) { $ last = $ toks [ $ toks_len - 1 ] ; } if ( $ last ) u... | Remove array key using dots to traverse keys |
233,261 | public static function fromOther ( FileViewFinder $ otherFinder ) { $ copy = new static ( $ otherFinder -> getFilesystem ( ) , $ otherFinder -> getPaths ( ) , $ otherFinder -> getExtensions ( ) ) ; if ( $ otherFinder instanceof FallbackFileViewFinder ) { $ copy -> setFallbackDir ( $ otherFinder -> getFallbackDir ( ) ) ... | Copy a FileViewFinder to a FallbackFileViewFinder |
233,262 | public function createFromImportedData ( $ name , $ data ) { $ class = new GroupClass ( $ name ) ; foreach ( $ data as $ parameterName => $ parameterData ) { $ class -> addParameter ( $ this -> getGroupParameterFactory ( ) -> createFromImportedData ( $ parameterName , $ parameterData ) ) ; } return $ class ; } | Create GroupClass instance from imported data . |
233,263 | public function get ( $ id ) { if ( $ id instanceof \ Closure ) { return $ id ( $ this ) ; } if ( ! $ this -> has ( $ id ) ) { $ service = $ this -> factory -> create ( $ id , $ this ) ; $ this -> repository -> set ( $ id , $ service ) ; } return $ this -> repository -> get ( $ id ) ; } | Get a service or params and create it first if it s not already defined . |
233,264 | public function set ( $ id , $ service ) { if ( ! $ this -> has ( $ id ) ) { $ this -> repository -> set ( $ id , $ service ) ; } } | Bypass factory and register a service directly into repository . |
233,265 | public function triggerContextBound ( ExpressContext $ context ) { if ( $ this -> eventDispatcher ) { $ this -> eventDispatcher -> notify ( new ExpressContextBoundEvent ( $ context ) ) ; } } | Trigger the context - bound event for the given context . |
233,266 | public function generateXmlSchemaBuilders ( ) { $ result = [ ] ; foreach ( $ this -> helpers -> findAll ( ) as $ key => $ helper ) { list ( $ namespace , $ name ) = explode ( '>' , $ key , 2 ) ; if ( empty ( $ result [ $ namespace ] ) ) { $ result [ $ namespace ] = new HelperXmlSchemaBuilder ( $ namespace ) ; } $ resul... | Generate XML - schema builders for each registered view helper namespace . |
233,267 | public static function fromQName ( $ name ) { $ types = SchemaTypes :: getInstance ( ) ; if ( $ name instanceof QName ) { if ( empty ( $ name -> prefix ) ) { $ prefix = $ types -> getPrefixForNamespace ( $ name -> namespaceURI ) ; if ( $ prefix ) $ name -> prefix = $ prefix ; } $ qname = "{$name->prefix}:{$name->localN... | The qualified name of the element |
233,268 | public function toString ( ) { if ( $ this -> void ) { return '<' . $ this -> tag . $ this -> createAttributes ( ) . ' />' ; } else { return '<' . $ this -> tag . $ this -> createAttributes ( ) . '>' . $ this -> recursivelyStringify ( $ this -> content ) . '</' . $ this -> tag . '>' ; } } | Generates the HTML and will recursively generate HTML out of inner content . |
233,269 | public function toArray ( ) { return [ 'tag' => $ this -> tag , 'void' => $ this -> void , 'attributes' => $ this -> attributes , 'content' => $ this -> recursivelyArrayify ( $ this -> content ) ] ; } | Return our element as an array . |
233,270 | public function append ( $ content = null ) { if ( null === $ content ) { return ; } else if ( is_array ( $ content ) ) { foreach ( $ content as $ row ) { $ this -> content [ ] = $ row ; } } else { $ this -> content [ ] = $ content ; } return $ this ; } | Append content into an element . |
233,271 | public function attributes ( array $ attributes ) { $ this -> attributes = array_replace ( $ this -> attributes , $ this -> markup -> attributes ( $ this -> tag , $ attributes ) ) ; return $ this ; } | Change attributes of an element . |
233,272 | public function prepend ( $ content = null ) { if ( null === $ content ) { return ; } else if ( is_array ( $ content ) ) { foreach ( array_reverse ( $ content ) as $ row ) { array_unshift ( $ this -> content , $ row ) ; } } else { array_unshift ( $ this -> content , $ content ) ; } return $ this ; } | Prepend content into an element . |
233,273 | public function open ( ) { if ( is_file ( $ this -> filename ) ) { $ fileData = file_get_contents ( $ this -> filename ) ; if ( false === $ fileData ) { throw new IOException ( 'Unable to get the contents of the json file!' ) ; } } else { $ fileData = null ; if ( ! $ this -> createIfNotExists ) { throw new FileNotFound... | Opens the json file . |
233,274 | public function set ( $ key , $ value ) { $ this -> assertOpened ( ) ; $ this -> contents [ ( string ) $ key ] = $ value ; } | Overwrites a record with the key parameter . |
233,275 | public function get ( $ key ) { $ this -> assertOpened ( ) ; $ key = ( string ) $ key ; if ( isset ( $ this -> contents [ $ key ] ) ) { return $ this -> contents [ $ key ] ; } return null ; } | Returns a record that originates from the opened json file . |
233,276 | public function clear ( ) { $ this -> assertOpened ( ) ; foreach ( $ this -> contents as $ key => $ value ) { unset ( $ this -> contents [ $ key ] ) ; } } | Deletes all of the records . |
233,277 | public function close ( ) { if ( null !== $ this -> contents ) { $ result = file_put_contents ( $ this -> filename , json_encode ( $ this -> contents ) ) ; if ( false === $ result ) { throw new IOException ( 'Unable to write to file!' ) ; } $ this -> contents = null ; } } | Writes any pending changes to the opened json file and disposes of the class . |
233,278 | public function _normalizeCallable ( $ callable ) { if ( $ callable instanceof Closure ) { return $ callable ; } if ( ! ( is_object ( $ callable ) && is_callable ( $ callable ) ) ) { try { $ callable = $ this -> _normalizeString ( $ callable ) ; if ( strpos ( $ callable , '::' , 1 ) === false ) { return $ callable ; } ... | Normalizes a callable such that it is possible to distinguish between function and method formats . |
233,279 | public function addValue ( string $ key , $ value ) { if ( $ this -> count === $ this -> maxVars ) { throw new DecodeException ( "max_input_variables exceeded" ) ; } if ( ( $ openPos = strpos ( $ key , "[" ) ) !== false && ( $ closePos = strpos ( $ key , "]" ) ) !== false && $ openPos < $ closePos ) { $ this -> addNest... | Add a value to the collection |
233,280 | protected function addNestedValue ( string $ key , $ value , int $ pos ) { $ levels = ( strpos ( $ key , "][" ) !== false ) ? explode ( "][" , substr ( $ key , $ pos + 1 , - 1 ) ) : [ substr ( $ key , $ pos + 1 , - 1 ) ] ; array_unshift ( $ levels , substr ( $ key , 0 , $ pos ) ) ; $ levelLen = count ( $ levels ) ; if ... | Add a value that has a nested key |
233,281 | private function getUsesDeclarations ( ) { asort ( $ this -> usesDeclarations ) ; $ output = [ ] ; foreach ( $ this -> usesDeclarations as $ namespace ) { $ output [ ] = sprintf ( 'use %s;' , $ namespace ) ; } return new Format ( $ output ) ; } | Get uses declaration |
233,282 | private function getClassDeclaration ( ) { return new Format ( sprintf ( '%sclass %s%s%s' , $ this -> isAbstract ? 'abstract ' : '' , $ this -> class , $ this -> getImplementOrExtendsDeclaration ( 'extends' , $ this -> extends ) , $ this -> getImplementOrExtendsDeclaration ( 'implements' , $ this -> implements ) ) ) ; ... | Get class declaration |
233,283 | private function getClassBody ( ) { $ this -> classComponents -> sort ( function ( PhpClassComponent $ a , PhpClassComponent $ b ) { if ( $ a :: SORT_ORDERING == $ b :: SORT_ORDERING ) { return $ a -> name < $ b -> name ? - 1 : 1 ; } return ( $ a :: SORT_ORDERING < $ b :: SORT_ORDERING ) ? - 1 : 1 ; } ) ; $ output = [ ... | Get class body |
233,284 | public static function get ( ) : array { return [ 'csrf_token' => CSRF :: generate ( ) , 'errors' => Variable :: has ( 'validation.errors' ) ? Variable :: get ( 'validation.errors' ) : ( new ValidatorFactory ( ) ) -> make ( [ ] , [ ] ) -> errors ( ) , 'old' => Variable :: has ( 'form.old' ) ? Variable :: get ( 'form.ol... | Get global variables |
233,285 | private static function loadAssets ( ) { $ am = \ Yii :: app ( ) -> assetManager ; $ cs = \ Yii :: app ( ) -> clientScript ; self :: $ _assetsUrl = $ am -> publish ( realpath ( __DIR__ . '/../assets' ) ) ; $ script = YII_DEBUG ? 'jquery-unveil.js' : 'jquery-unveil.min.js' ; $ cs -> registerScriptFile ( self :: $ _asset... | Publishes the required assets |
233,286 | public function get_default_path ( ) { if ( ! defined ( 'ABSPATH' ) ) { throw \ RuntimeException ( 'ABSPATH constant is not defined. Something is very wrong!' ) ; } $ default_path = $ this -> default_path ; if ( defined ( 'QB_CUSTOM_THEME_PATH' ) ) { $ default_path = QB_CUSTOM_THEME_PATH ; } $ result = ABSPATH . $ def... | Get default path |
233,287 | public function validate_path ( $ path ) { $ result = null ; $ path = ( string ) $ path ; if ( empty ( $ path ) ) { return 'Empty path is not allowed' ; } if ( DIRECTORY_SEPARATOR === substr ( $ path , - 1 , 1 ) ) { return "Path ends in slash [$path]" ; } return $ result ; } | Validate given path |
233,288 | public function register_path ( $ dir = null , $ persistent = true ) { $ result = false ; $ dir = ( string ) $ dir ; $ persistent = ( bool ) $ persistent ; if ( empty ( $ dir ) ) { $ dir = $ this -> get_default_path ( ) ; } $ path_fail_reason = $ this -> validate_path ( $ dir ) ; if ( $ path_fail_reason ) { return new ... | Register custom theme path |
233,289 | public function toString ( ) { $ metaString = '#' ; $ metaString .= $ this -> fields [ 'MetaName' ] ; if ( ! empty ( $ this -> fields [ 'MetaValue' ] ) ) $ metaString .= '="' . $ this -> fields [ 'MetaValue' ] . '"' ; return $ metaString ; } | Returns the string representation of this MetaPartial |
233,290 | static function join ( $ glue , array $ list , callable $ manipulator ) { $ glued = '' ; foreach ( $ list as $ key => $ value ) { $ item = $ manipulator ( $ key , $ value ) ; if ( $ item !== false ) { $ glued .= $ glue . $ item ; } } if ( ! empty ( $ glued ) ) { $ glued = substr ( $ glued , strlen ( $ glue ) ) ; } retu... | PHP join with a callback |
233,291 | public function setAdapter ( $ adapter , $ options = null ) { $ adapter = ucfirst ( strtolower ( $ adapter ) ) ; if ( Zend_Loader :: isReadable ( 'Zend/Validate/Barcode/' . $ adapter . '.php' ) ) { $ adapter = 'Zend_Validate_Barcode_' . $ adapter ; } if ( ! class_exists ( $ adapter ) ) { Zend_Loader :: loadClass ( $ ad... | Sets a new barcode adapter |
233,292 | public function addObserver ( ObserverInterface $ observerObject ) { if ( is_null ( $ observerObject ) ) { throw new ObservableException ( 'Given observer is null.' , E_WARNING ) ; } else { $ this -> getObserverSetObject ( ) -> add ( $ observerObject ) ; } } | add a observer to the observable |
233,293 | public function notifyObservers ( $ arg = null ) { if ( $ this -> hasChanged ( ) ) { foreach ( $ this -> getObserverSetObject ( ) as $ observerObject ) { $ observerObject -> update ( $ this , $ arg ) ; } $ this -> clearChanged ( ) ; } } | notify all observer |
233,294 | private function registerClients ( array $ config , ContainerBuilder $ container ) { foreach ( $ config [ 'clients' ] as $ clientType => $ clients ) { $ clientFQCN = ( $ clientType == 'apns' ) ? 'LinkValue\MobileNotifBundle\Client\ApnsClient' : 'LinkValue\MobileNotifBundle\Client\GcmClient' ; foreach ( $ clients as $ c... | Register each client as service such as link_value_mobile_notif . clients . the_client_type . my_custom_client_name |
233,295 | public static function get_settings ( ) { if ( ! class_exists ( 'GFWebAPI' ) ) { return false ; } $ settings = get_option ( 'gravityformsaddon_gravityformswebapi_settings' ) ; if ( empty ( $ settings ) || ! $ settings [ 'enabled' ] ) { return false ; } $ forms = [ ] ; $ method = 'GET' ; $ expires = strtotime ( self :: ... | Get the settings need to Gravity Forms . |
233,296 | private static function calculate_signature ( $ string , $ private_key ) { $ hash = hash_hmac ( 'sha1' , $ string , $ private_key , true ) ; return rawurlencode ( base64_encode ( $ hash ) ) ; } | Get the signature . |
233,297 | public function display ( $ file , $ directory = null , $ directOutput = false ) { $ output = Factory :: getInstance ( ) -> output ; $ directory = ( is_null ( $ directory ) ? $ this -> directory : $ directory ) ; if ( $ directOutput === true ) { echo $ this -> get ( $ file , $ directory ) ; } else { $ output -> append_... | Retrieve a template file using a string and a directory and immediatly parse it to the output class . |
233,298 | public function get ( $ file , $ directory = null ) : string { $ directory = ( is_null ( $ directory ) ? $ this -> directory : $ directory ) ; Logger :: newLevel ( "Loading template file '" . $ file . "' in '" . $ directory . "'" ) ; $ this -> loadTemplateEngines ( ) ; if ( is_null ( $ this -> current_engine ) ) { $ th... | Retrieve a template file using a string and a directory . |
233,299 | public function getEngineFromExtension ( $ extension ) : TemplateEngine { if ( isset ( $ this -> file_extensions [ strtolower ( $ extension ) ] ) ) { return $ this -> engines [ $ this -> file_extensions [ strtolower ( $ extension ) ] ] ; } throw new LayoutException ( 'Could not get Template Engine. No engine has corres... | Retrieve a Template Engine from a File Extension . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.