idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
229,200 | protected function buildStatusCodes ( array $ data ) { if ( isset ( $ data [ 'statusCodes' ] ) ) { $ this -> initializeStatusCodes ( ) ; foreach ( $ data [ 'statusCodes' ] as $ key => $ element ) { if ( ( int ) $ key < 200 ) { $ this -> statusCodes ( $ element ) ; } else { $ this -> statusCodes ( $ key , $ element ) ; ... | Loads data given status codes . |
229,201 | protected function statusCodes ( $ statusCode , $ customDescription = null ) { if ( $ customDescription ) { $ description = $ customDescription ; } if ( $ customDescription !== null || array_key_exists ( $ statusCode , $ this -> defaultStatusCodes ) ) { if ( ! isset ( $ description ) ) { $ description = $ this -> defau... | Method that allows to choose between status code passing the code and optional description . |
229,202 | protected function initializeStatusCodes ( ) { $ annotationReflection = new \ ReflectionClass ( 'Nelmio\ApiDocBundle\Annotation\ApiDoc' ) ; $ statusCodesReflection = $ annotationReflection -> getProperty ( 'statusCodes' ) ; $ statusCodesReflection -> setAccessible ( true ) ; $ statusCodesReflection -> setValue ( $ this... | Purges the statusCodes array to populate with the new way . |
229,203 | public function setCentrifuge ( $ centrifuge = array ( ) ) { if ( is_array ( $ centrifuge ) && $ centrifuge ) { $ this -> centrifuge = $ centrifuge ; return true ; } throw new InvalidArgumentException ( 'Invalid argument given' ) ; } | This method sets the centrifuge property |
229,204 | public function put ( $ data ) { if ( ! $ data instanceof DataTransferObject ) { throw new Exception ( 'You are trying to put invalid object to trunk.' ) ; } if ( ! array_key_exists ( $ data -> getType ( ) , $ this -> storage ) ) { $ this -> storage [ $ data -> getType ( ) ] = [ ] ; } $ storageKey = $ this -> storageKe... | Add item or collection to trunk |
229,205 | public function has ( $ key , $ type ) { if ( is_array ( $ key ) ) { return $ this -> hasItem ( $ this -> storageKey ( $ key ) , $ type ) ; } if ( is_string ( $ key ) ) { return $ this -> hasItem ( $ key , $ type ) ; } if ( is_int ( $ key ) ) { return $ this -> hasItem ( $ this -> storageKey ( [ $ key ] ) , $ type ) ; ... | Check cache for item or collection |
229,206 | protected function hasItem ( $ key , $ type ) { if ( array_key_exists ( $ type , $ this -> storage ) && array_key_exists ( $ key , $ this -> storage [ $ type ] ) ) { return true ; } return false ; } | Check if item exists in cache |
229,207 | public function get ( $ key , $ type ) { if ( is_array ( $ key ) ) { return $ this -> getItem ( $ this -> storageKey ( $ key ) , $ type ) ; } if ( is_string ( $ key ) ) { return $ this -> getItem ( $ key , $ type ) ; } if ( is_int ( $ key ) ) { return $ this -> getItem ( $ this -> storageKey ( [ $ key ] ) , $ type ) ; ... | Get item or collection from cache |
229,208 | protected function getItem ( $ key , $ type ) { if ( array_key_exists ( $ type , $ this -> storage ) && array_key_exists ( $ key , $ this -> storage [ $ type ] ) ) { return $ this -> storage [ $ type ] [ $ key ] ; } return null ; } | Get item by id and type |
229,209 | protected function getRoutedParameter ( $ parameter , $ default = null ) { $ output = $ default ; $ parameters = $ this -> route -> getParameters ( ) ; if ( ! empty ( $ parameters -> $ parameter ) ) { $ output = $ parameters -> $ parameter ; } $ validatedData = $ this -> route -> getValidatedData ( ) ; if ( ! empty ( $... | Function for retrieving routed parameter data from the stored Route reference |
229,210 | public function exists ( $ key ) { $ key = $ this -> secureKey ( $ key ) ; if ( isset ( $ _SESSION [ $ key ] ) ) return true ; return false ; } | Checks if a session variable exists |
229,211 | public function set ( $ key , $ value ) { $ key = $ this -> secureKey ( $ key ) ; $ _SESSION [ $ key ] = $ this -> secureValue ( $ value ) ; return $ key ; } | Creates a new session or sets an existing sesssion |
229,212 | public function get ( $ key ) { $ key = $ this -> secureKey ( $ key ) ; if ( isset ( $ _SESSION [ $ key ] ) ) { return trim ( Text :: unlock ( $ _SESSION [ $ key ] , $ this -> sugar ( ) ) ) ; } else { return '' ; } } | Gets session variable s value |
229,213 | protected function appendSingleFormFields ( FormBuilderInterface $ formBuilder ) { $ defaultOptions = [ 'label' => $ this -> getTitle ( ) , 'required' => false , ] ; $ userOptions = array_key_exists ( 'single' , $ this -> getFormOptions ( ) ) ? $ this -> getFormOptions ( ) [ 'single' ] : [ ] ; if ( count ( $ userOption... | Appends form fields for single mode . |
229,214 | protected function appendRangedFormFields ( FormBuilderInterface $ formBuilder ) { $ fromDefaultOptions = [ 'label' => 'da2e.filtration.number_filter.ranged.from.label' , 'required' => false , ] ; $ fromUserOptions = array_key_exists ( 'ranged_from' , $ this -> getFormOptions ( ) ) ? $ this -> getFormOptions ( ) [ 'ran... | Appends form fields for range mode . |
229,215 | public function addSitemapItem ( $ postValues ) { $ sitemapObject = SitemapItemFactory :: createSitemapItemFromPostValues ( $ postValues ) ; $ sitemap = $ this -> repository -> sitemap ; $ sitemap [ ] = $ sitemapObject ; $ this -> repository -> sitemap = $ sitemap ; $ this -> save ( ) ; } | Add a sitemap item |
229,216 | public function getSitemapItemBySlug ( $ slug ) { $ sitemap = $ this -> repository -> sitemap ; foreach ( $ sitemap as $ sitemapItem ) { if ( $ sitemapItem -> slug == $ slug ) { return $ sitemapItem ; } } return null ; } | Get a sitemap item by its slug |
229,217 | private function addRoute ( $ types = '' , $ uri , $ action = [ ] ) { if ( is_string ( $ action ) ) { $ action = [ '_controller' => $ action ] ; } if ( is_array ( $ action ) ) { if ( isset ( $ action [ 'as' ] ) ) { AsCollector :: addAs ( $ action [ 'as' ] , $ uri ) ; } } $ types = ( array ) $ types ; foreach ( $ types ... | Add a route with type uri and action parameters |
229,218 | protected function createWhenUri ( $ uri ) { $ when = static :: $ firing [ 'when' ] ; if ( substr ( $ when , - 1 ) !== '/' ) { $ when .= '/' ; } if ( substr ( $ uri , 0 , 1 ) === '/' ) { $ uri = substr ( $ uri , 1 , strlen ( $ uri ) ) ; } return $ when . $ uri ; } | prapare uri to merge with when url and return it . |
229,219 | public function group ( $ name , $ action , Closure $ callback ) { static :: $ groups [ $ name ] = [ 'action' => $ action , 'callback' => $ callback ] ; return $ this ; } | register a new group collection |
229,220 | public function triggerEvent ( string $ event ) : void { if ( $ this -> file instanceof ICacheStateful ) { switch ( $ event ) { case self :: EVENT_CACHED : $ this -> file -> setCachedAt ( $ this -> name , time ( ) ) ; break ; case self :: EVENT_EMPTY : case self :: EVENT_ERROR : case self :: EVENT_NOT_FOUND : $ this ->... | Call user function after saving cached file |
229,221 | private function doXssClean ( $ data ) { if ( is_array ( $ data ) && count ( $ data ) ) { foreach ( $ data as $ k => & $ v ) { $ v = $ this -> doXssClean ( $ data [ $ k ] ) ; } return $ data ; } if ( trim ( $ data ) === '' ) { return $ data ; } $ data = str_replace ( [ '&' , '<' , '>' ] , [ '&amp;' , '&am... | Do XSS Clean |
229,222 | public function getConfig ( ) { return array ( 'baseUrl' => Yii :: app ( ) -> getBaseUrl ( true ) , 'base_url' => Yii :: app ( ) -> getBaseUrl ( true ) . '/hybridauth/callback' , 'debug_mode' => YII_DEBUG , 'debug_file' => Yii :: getPathOfAlias ( 'application.runtime.hybridauth' ) . '.log' , 'providers' => CMap :: merg... | Convert configuration to an array for Hybrid_Auth rather than object properties as supplied by Yii |
229,223 | public static function db ( ) { self :: $ conn -> setAttribute ( PDO :: ATTR_ERRMODE , PDO :: ERRMODE_EXCEPTION ) ; return self :: $ conn ; } | Get an instance of the db connection |
229,224 | public function fields ( array $ fields ) { $ newFields = array ( ) ; $ this -> fields = '' ; $ this -> fieldsArguments = array ( ) ; foreach ( $ fields as $ field ) { if ( is_scalar ( $ field ) ) { $ newFields [ ] = '?f:alias:.?f' ; $ this -> fieldsArguments [ ] = $ field ; } else { if ( ! isset ( $ field [ 0 ] ) or !... | Sets fields statement |
229,225 | public function join ( $ tableName , $ alias = null ) { $ this -> joins [ ] = ' LEFT JOIN ?f as ?f' ; $ this -> lastJoinAlias = $ alias ; $ this -> joinArguments [ ] = $ tableName ; $ this -> joinArguments [ ] = $ alias ; return $ this ; } | Sets one field in fields statement |
229,226 | protected function orderByDirection ( $ field , $ direction , $ prefixWithTableAlias = true ) { $ aliasInsert = $ prefixWithTableAlias ? '?f:alias:.' : '' ; if ( $ this -> orderSql == '' ) { $ this -> orderSql = " ORDER BY {$aliasInsert}?f {$direction}" ; } else { $ this -> orderSql .= ", {$aliasInsert}?f {$direction}"... | Sets order by statement |
229,227 | protected function importItems ( \ DOMDocument $ xml ) { foreach ( $ xml -> documentElement -> getElementsByTagName ( 'item' ) as $ item ) { $ dom = simplexml_import_dom ( $ item ) ; $ this -> addMenuItem ( $ dom ) ; } } | Parses DOM element and adds it as an admin menu item |
229,228 | protected function addMenuItem ( \ SimpleXMLElement $ item ) { $ em = $ this -> doctrineHelper -> getEntityManager ( ) ; $ adminMenuItem = $ this -> adminMenuRepository -> findOneBy ( [ 'identifier' => ( string ) $ item -> identifier ] ) ; $ parent = $ this -> adminMenuRepository -> findOneBy ( [ 'identifier' => ( stri... | Creates new admin menu item |
229,229 | private function resolveRulePrototype ( ) { if ( ! isset ( $ this -> routeTypeRulePrototypeMap [ $ this -> routeType ] ) ) { throw new RuntimeException ( "Unable to resolve rule for route type '$this->routeType'. Route type is not supported." ) ; } $ prototypeClass = $ this -> routeTypeRulePrototypeMap [ $ this -> rout... | Resolve the rule prototype object for the current routeType |
229,230 | public function define ( $ pattern , $ controller , $ filters = array ( ) ) { $ rule = clone $ this -> rulePrototype ; $ rule -> setPattern ( $ pattern ) -> setController ( $ controller ) -> setFilters ( $ filters ) ; array_push ( $ this -> rules , $ rule ) ; return $ this ; } | Define a routing rule with corresponding controller |
229,231 | protected static function parseClass ( $ class ) { static $ cache = array ( ) ; if ( array_key_exists ( $ class , $ cache ) === false ) { $ string = $ class ; if ( $ string [ 0 ] === '\\' ) { $ string = substr ( $ string , 1 ) ; } if ( preg_match ( '/^(?<namespace>.*)\\\\(?<className>.+?)$/' , $ string , $ matches ) ) ... | Parse the class to a namespace and className part |
229,232 | public static function requestHandler ( $ type ) { if ( ! self :: validateRequest ( $ type ) ) { return false ; } App :: setCurrentID ( self :: $ config [ 'app' ] ) ; self :: loadRemoteComplements ( ) ; switch ( self :: $ config [ 'request' ] ) { case 'load-complements' : self :: complementsLoadRequest ( ) ; break ; ca... | HTTP request handler . |
229,233 | public static function sanitizeParams ( ) { self :: $ config [ 'remote' ] = [ ] ; $ remote = is_array ( $ _POST [ 'remote' ] ) ? $ _POST [ 'remote' ] : [ ] ; foreach ( $ remote as $ complement => $ url ) { $ url = filter_var ( $ url , FILTER_VALIDATE_URL ) ; if ( $ url === false ) { return false ; } self :: $ config [ ... | Sanitize request parameters . |
229,234 | private static function loadRemoteComplements ( ) { $ currentID = App :: getCurrentID ( ) ; $ complement = self :: getType ( ) ; $ remote = self :: $ config [ 'remote' ] ; $ complements = array_keys ( self :: $ instances [ $ currentID ] [ $ complement ] ) ; foreach ( $ remote as $ complement => $ url ) { if ( ! in_arra... | Load remote complements . |
229,235 | private static function complementsLoadRequest ( ) { $ complements = self :: getList ( self :: $ config [ 'filter' ] , self :: $ config [ 'sort' ] ) ; $ response = [ 'complements' => array_values ( $ complements ) , 'errors' => self :: $ errors , ] ; echo json_encode ( $ response ) ; } | Complements load request . |
229,236 | private static function changeStateRequest ( ) { self :: $ id = self :: $ config [ 'id' ] ; $ that = self :: getInstance ( ) ; $ state = $ that -> changeState ( ) ; $ response = [ 'state' => $ state , 'errors' => self :: $ errors , ] ; echo json_encode ( $ response ) ; } | Change state request . |
229,237 | private static function installRequest ( $ isUpdate = false ) { self :: $ id = self :: $ config [ 'id' ] ; $ that = self :: getInstance ( ) ; $ that -> install ( ) ; $ that -> setState ( $ isUpdate ? 'active' : 'inactive' ) ; $ complements = self :: getList ( self :: $ config [ 'filter' ] , self :: $ config [ 'sort' ] ... | Install request . |
229,238 | private static function uninstallRequest ( ) { self :: $ id = self :: $ config [ 'id' ] ; $ that = self :: getInstance ( ) ; $ that -> remove ( ) ; $ state = 'uninstalled' ; $ response = [ 'state' => $ state , 'errors' => self :: $ errors , ] ; echo json_encode ( $ response ) ; } | Uninstall request . |
229,239 | public function setNoWorkingDays ( array $ days , $ format = null ) { $ this -> noWorkingDays = $ days ; if ( $ format ) { $ this -> formatNoWorkingDays = $ format ; } return $ this ; } | Set official no working days for your country . |
229,240 | public function setWorkingDays ( array $ days , $ format = null ) { $ this -> workingDays = $ days ; if ( $ format ) { $ this -> formatWorkingDays = $ format ; } return $ this ; } | Set working days as exclusion . |
229,241 | public static function bootHasWidgets ( ) { static :: created ( function ( Model $ widgetableModel ) { if ( $ widgetableModel -> queuedWidgets ) { $ widgetableModel -> attachWidgets ( $ widgetableModel -> queuedWidgets ) ; $ widgetableModel -> queuedWidgets = [ ] ; } } ) ; static :: deleted ( function ( Model $ widgeta... | Boot the widgetable trait for a model . |
229,242 | public function scopeWithAllWidgets ( Builder $ query , $ widgets , string $ column = 'id' ) : Builder { $ widgets = static :: isWidgetsStringBased ( $ widgets ) ? $ widgets : static :: hydrateWidgets ( $ widgets ) -> pluck ( $ column ) ; collect ( $ widgets ) -> each ( function ( $ widget ) use ( $ query , $ column ) ... | Scope query with all the given widgets . |
229,243 | public function scopeWithoutWidgets ( Builder $ query , $ widgets , string $ column = 'id' ) : Builder { $ widgets = static :: isWidgetsStringBased ( $ widgets ) ? $ widgets : static :: hydrateWidgets ( $ widgets ) -> pluck ( $ column ) ; return $ query -> whereDoesntHave ( 'widgets' , function ( Builder $ query ) use ... | Scope query without the given widgets . |
229,244 | public function hasWidget ( $ widgets ) : bool { if ( is_string ( $ widgets ) ) { return $ this -> widgets -> contains ( 'id' , $ widgets ) ; } if ( is_int ( $ widgets ) ) { return $ this -> widgets -> contains ( 'id' , $ widgets ) ; } if ( $ widgets instanceof WidgetModelContract ) { return $ this -> widgets -> contai... | Determine if the model has any the given widgets . |
229,245 | public function hasAllWidgets ( $ widgets ) : bool { if ( is_string ( $ widgets ) ) { return $ this -> widgets -> contains ( 'id' , $ widgets ) ; } if ( is_int ( $ widgets ) ) { return $ this -> widgets -> contains ( 'id' , $ widgets ) ; } if ( $ widgets instanceof WidgetModelContract ) { return $ this -> widgets -> co... | Determine if the model has all of the given widgets . |
229,246 | protected function hydrateWidgets ( $ widgets ) { $ isWidgetsStringBased = static :: isWidgetsStringBased ( $ widgets ) ; $ isWidgetsIntBased = static :: isWidgetsIntBased ( $ widgets ) ; $ field = $ isWidgetsStringBased ? 'id' : 'id' ; $ className = static :: getWidgetClassName ( ) ; return $ isWidgetsStringBased || $... | Hydrate widgets . |
229,247 | public function isHaveValue ( $ checkValue ) { $ this -> checkFunctions [ ] = function ( $ value ) use ( $ checkValue ) { if ( ! is_array ( $ value ) ) { return false ; } return in_array ( $ checkValue , $ value ) ; } ; return $ this ; } | Use it if verifiable value is array For more correction |
229,248 | public function setPlot ( \ Librinfo \ SeedBatchBundle \ Entity \ Plot $ plot = null ) { $ this -> plot = $ plot ; return $ this ; } | Set plot . |
229,249 | public function setCertifyingBody ( \ Librinfo \ SeedBatchBundle \ Entity \ CertifyingBody $ certifyingBody = null ) { $ this -> certifyingBody = $ certifyingBody ; return $ this ; } | Set certifyingBody . |
229,250 | protected function writeFile ( EntityMetadata $ metadata , $ contents ) { $ file = $ this -> getCacheFile ( $ metadata -> type ) ; $ tmpFile = tempnam ( $ this -> dir , 'metadata-cache' ) ; file_put_contents ( $ tmpFile , $ contents ) ; chmod ( $ tmpFile , 0666 & ~ umask ( ) ) ; $ this -> renameFile ( $ tmpFile , $ fil... | Writes the cache file . |
229,251 | private function getCacheFile ( $ type ) { $ type = str_replace ( EntityMetadata :: NAMESPACE_DELIM , '_' , $ type ) ; return $ this -> dir . '/ModlrData.' . $ this -> cachePrefix . '.' . $ type . '.' . $ this -> extension ; } | Gets the cache file from the entity type . |
229,252 | private function renameFile ( $ source , $ target ) { if ( false === @ rename ( $ source , $ target ) ) { throw new RuntimeException ( sprintf ( 'Could not write new cache file to %s.' , $ target ) ) ; } } | Renames a file |
229,253 | private function doDump ( OutputInterface $ output ) { if ( ! is_dir ( $ dir = dirname ( $ this -> targetPath ) ) ) { $ output -> writeln ( '<info>[dir+]</info> ' . $ dir ) ; if ( false === @ mkdir ( $ dir , 0777 , true ) ) { throw new \ RuntimeException ( 'Unable to create directory ' . $ dir ) ; } } $ output -> writ... | Performs the routes dump . |
229,254 | private static function PrepareRegexFlags ( $ flagString ) { $ result = preg_match ( "/[^smix]+/" , $ flagString ) ; if ( $ result ) { throw XPath2Exception :: withErrorCodeAndParam ( "FORX0001" , Resources :: InvalidRegularExpr , "$flagString" ) ; } return $ flagString ; } | Check the flag string contents |
229,255 | final public static function names ( ) { $ result = [ ] ; $ classes = self :: hierarchy ( \ get_called_class ( ) ) ; foreach ( $ classes as $ class ) { $ result = \ array_merge ( self :: namesFor ( $ class -> name ) , $ result ) ; } return $ result ; } | Returns an array containing the names of the enumeration constants of this enumeration type in the order they are declared . |
229,256 | private static function namesFor ( $ enumType ) { $ result = [ ] ; $ methods = ReflectionUtils :: methodsForClassWithoutInheritedMethods ( $ enumType , [ ReflectionMethod :: IS_FINAL , ReflectionMethod :: IS_STATIC , ReflectionMethod :: IS_PUBLIC ] ) ; foreach ( $ methods as $ method ) { if ( $ method -> name === \ str... | Returns an array containing the names of the enumeration constants of the specified enumeration type . |
229,257 | final public static function values ( ) { $ names = self :: names ( ) ; $ result = [ ] ; foreach ( $ names as $ name ) { $ result [ ] = static :: $ name ( ) ; } return $ result ; } | Returns an array containing the enumeration constants of this enumeration type in the order they are declared . |
229,258 | final public static function valueOf ( $ name ) { $ result = null ; try { foreach ( self :: values ( ) as $ constant ) { if ( $ constant -> name === $ name ) { $ result = $ constant ; break ; } } } catch ( InvalidArgumentException $ ex ) { } return $ result ; } | Returns the enumeration constant with the specified name from this enumeration type . |
229,259 | final protected static function getInstance ( ) { $ backtrace = \ debug_backtrace ( \ DEBUG_BACKTRACE_IGNORE_ARGS ) ; $ className = self :: retrieveNameOfSuperclassFor ( $ backtrace [ 1 ] [ 'class' ] ) ; $ constantName = $ backtrace [ 1 ] [ 'function' ] ; $ constantOrdinal = self :: retrieveOrdinalFor ( $ constantName ... | Creates and returns an enumeration constant for the specified enumeration type with the specified name . |
229,260 | private static function retrieveNameOfSuperclassFor ( $ className ) { $ parents = self :: hierarchy ( $ className ) ; return ( true === empty ( $ parents ) ) ? $ className : $ parents [ count ( $ parents ) - 1 ] -> name ; } | Returns the superclass name for the specified classname . |
229,261 | private static function retrieveOrdinalFor ( $ name ) { $ result = null ; foreach ( self :: names ( ) as $ key => $ value ) { if ( $ name === $ value ) { $ result = $ key ; break ; } } return $ result ; } | Returns the ordinal of the enumeration constant with the specified name in this enumeration type . |
229,262 | private function invokeConstructorIfDeclared ( array $ arguments ) { $ methodName = 'construct' ; try { $ method = new ReflectionMethod ( $ this , $ methodName ) ; if ( true === $ method -> isPublic ( ) ) { throw new RuntimeException ( 'The constructor of an enumeration type may not be public.' ) ; } $ method -> setAcc... | Invokes the constructor of this enumeration constant with the specified arguments . |
229,263 | final public function compareTo ( ComparableInterface $ other ) { if ( false === ( $ other instanceof self ) ) { throw new ClassCastException ( 'The specified object\'s type is not an instance of ' . __CLASS__ . '.' ) ; } if ( false === ( $ this instanceof $ other ) ) { throw new ClassCastException ( 'The specified obj... | Compares this enumeration constant with the specified enumeration constant for order . |
229,264 | public function render ( $ name , $ content ) { list ( $ data , $ content ) = ( array ) Matter :: parse ( $ content ) ; $ data = array_merge ( $ data , ( array ) $ this -> data ) ; $ data [ 'title' ] = isset ( $ data [ 'title' ] ) ? $ data [ 'title' ] : '' ; $ output = $ this -> website -> content ( ) -> make ( $ conte... | Renders the specified HTML content with a template . |
229,265 | public function resolve ( $ reference ) { if ( empty ( $ reference ) ) { return $ reference ; } if ( $ this -> isResolvableAnonymousReference ( $ reference ) ) { return $ this -> resolveAnonymousReference ( $ reference ) ; } return $ this -> resolveInternal ( $ reference ) ; } | Return the resolved value of the given reference . |
229,266 | public function resolveMany ( array $ references ) { $ convertedParameters = array ( ) ; foreach ( $ references as $ reference ) { $ convertedValue = $ this -> resolve ( $ reference ) ; $ convertedParameters [ ] = $ convertedValue ; } return $ convertedParameters ; } | Resolves an array of references |
229,267 | public static function call ( $ function , \ Closure $ callback = null ) { $ result = null ; if ( is_array ( $ function ) ) { $ result = self :: methodDI ( $ function , $ callback ) ; } elseif ( is_callable ( $ function , true ) ) { $ result = self :: functionDI ( $ function , $ callback ) ; } return $ result ; } | Call function with dependency injection |
229,268 | public static function functionDI ( \ Closure $ function , \ Closure $ callback = null ) { $ reflection = new \ ReflectionFunction ( $ function ) ; $ functionParams = $ reflection -> getParameters ( ) ; $ inputParams = [ ] ; if ( $ callback !== null ) { foreach ( $ functionParams as $ functionParam ) { $ param = $ call... | Call closure with dependency injection |
229,269 | public static function methodDI ( array $ objectInfo , \ Closure $ callback = null ) { $ reflection = new \ ReflectionObject ( $ objectInfo [ 0 ] ) ; $ methods = $ reflection -> getMethods ( ) ; $ inputParams = [ ] ; $ functionParams = [ ] ; foreach ( $ methods as $ method ) { if ( $ objectInfo [ 1 ] == $ method -> nam... | Call method with dependency injection |
229,270 | public static function createObject ( $ className , array $ params = [ ] ) { $ result = new $ className ; foreach ( $ params as $ key => $ val ) { $ methodName = 'set' . ucfirst ( $ key ) ; if ( method_exists ( $ result , $ methodName ) ) { $ result -> $ methodName ( $ val ) ; } } return $ result ; } | Create object and set params |
229,271 | public function setHeader ( string $ header , $ value ) { if ( ! is_scalar ( $ value ) ) throw new \ InvalidArgumentException ( "Value should be a scalar" ) ; $ header = static :: normalizeHeader ( $ header ) ; $ this -> headers [ $ header ] = $ value ; return $ this ; } | Set a header on the result |
229,272 | public function unsetHeader ( string $ header ) { $ header = static :: normalizeHeader ( $ header ) ; unset ( $ this -> headers [ $ header ] ) ; return $ this ; } | Remove a header from the list of headers to send to the client |
229,273 | public function getCachePolicy ( ) { if ( ! empty ( $ this -> response ) ) { $ policy = $ this -> response -> getCachePolicy ( ) ; if ( ! empty ( $ policy ) ) return $ policy ; } return $ this -> cache_policy ; } | Returns the cache policy for this result . If the response has a cache policy it is used . Otherwise any cache policy set on the result itself is used . |
229,274 | public function set ( $ where , $ andOr = null ) { if ( $ where instanceof Where ) { if ( $ where -> countCriteria ( ) > 1 ) { $ where -> parenthesis ( ) ; } $ where -> setParent ( $ this ) ; return $ this -> where ( '' , false , $ where , $ andOr ) ; } return $ this -> where ( '' , false , Sql :: raw ( $ where ) , $ a... | set the where string as is . |
229,275 | public static function timeFunc ( $ iterations , $ function , & $ output = null ) { $ time = 0 ; for ( $ i = 0 ; $ i < $ iterations ; $ i ++ ) { $ start = microtime ( true ) ; $ output = call_user_func ( $ function ) ; $ time += microtime ( true ) - $ start ; } return round ( $ time , 4 ) ; } | Executes a function the given number of times and returns the elapsed time . |
229,276 | public static function config ( $ key , $ value = null ) { if ( ! array_key_exists ( $ key , static :: $ config ) ) throw new \ Exception ( sprintf ( 'Unrecognized option: "%s". Valid options are: %s' , $ key , implode ( ', ' , array_keys ( static :: $ config ) ) ) ) ; if ( $ value === null ) return static :: $ config ... | Set or get configuration options |
229,277 | protected function linkify ( \ Reflector $ reflector , $ constant = null ) { static $ docRefRoot = null , $ docRefExt = null ; if ( ! $ docRefRoot ) $ docRefRoot = ( $ docRefRoot = rtrim ( ini_get ( 'docref_root' ) , '/' ) ) ? $ docRefRoot : 'http://php.net/manual/en' ; if ( ! $ docRefExt ) $ docRefExt = ( $ docRefExt ... | Generates an URL that points to the documentation page relevant for the requested context |
229,278 | protected static function strLen ( $ string ) { $ encoding = function_exists ( 'mb_detect_encoding' ) ? mb_detect_encoding ( $ string ) : false ; return $ encoding ? mb_strlen ( $ string , $ encoding ) : strlen ( $ string ) ; } | Calculates real string length |
229,279 | protected static function strPad ( $ input , $ padLen , $ padStr = ' ' , $ padType = STR_PAD_RIGHT ) { $ diff = strlen ( $ input ) - static :: strLen ( $ input ) ; return str_pad ( $ input , $ padLen + $ diff , $ padStr , $ padType ) ; } | Safe str_pad alternative |
229,280 | public static function flatten ( array $ array , $ depth = INF ) : array { $ depth = is_int ( $ depth ) ? max ( $ depth , 0 ) : INF ; return array_reduce ( $ array , function ( $ result , $ item ) use ( $ depth ) { if ( ! is_array ( $ item ) || $ depth === 0 ) { return array_merge ( $ result , [ $ item ] ) ; } elseif (... | Flatten a multi - dimensional array into a single level |
229,281 | public static function flattenAssoc ( array $ array , $ depth = INF ) : array { $ result = [ ] ; $ depth = is_int ( $ depth ) ? max ( $ depth , 0 ) : INF ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) && $ depth >= 1 ) { $ result = self :: flattenAssoc ( $ value , $ depth - 1 ) + $ result ; } els... | Flatten a multi - dimensional array into a single level with saving keys |
229,282 | public static function depth ( array $ array ) : int { $ maxDepth = 1 ; foreach ( $ array as $ value ) { if ( is_array ( $ value ) ) { $ depth = self :: depth ( $ value ) + 1 ; if ( $ depth > $ maxDepth ) { $ maxDepth = $ depth ; } } } return $ maxDepth ; } | Get depth of array |
229,283 | protected static function evaluateCondition ( $ arguments = null ) : bool { $ uid = intval ( $ arguments [ 'uid' ] ) ; $ languageUid = isset ( $ arguments [ 'languageUid' ] ) ? intval ( $ arguments [ 'languageUid' ] ) : self :: getLanguageService ( ) -> getLanguageUid ( ) ; $ page = self :: getPageService ( ) -> getPag... | Evaluates the condition . |
229,284 | protected static function getLanguageService ( ) : LanguageService { $ objectManager = GeneralUtility :: makeInstance ( ObjectManager :: class ) ; $ languageService = $ objectManager -> get ( LanguageService :: class ) ; return $ languageService ; } | Gets the language service . |
229,285 | protected static function getPageService ( ) : PageService { $ objectManager = GeneralUtility :: makeInstance ( ObjectManager :: class ) ; $ pageService = $ objectManager -> get ( PageService :: class ) ; return $ pageService ; } | Gets the page service . |
229,286 | public function processResponse ( $ requestId = null ) { $ this -> _errors = array ( ) ; $ this -> _errorReason = null ; if ( isset ( $ _POST ) && isset ( $ _POST [ 'SAMLResponse' ] ) ) { $ response = new OneLogin_Saml2_Response ( $ this -> _settings , $ _POST [ 'SAMLResponse' ] ) ; $ this -> _lastResponse = $ response... | Process the SAML Response sent by the IdP . |
229,287 | public function login ( $ indexAcs , $ returnTo = null , $ parameters = array ( ) , $ forceAuthn = false , $ isPassive = false , $ stay = false , $ setNameIdPolicy = true ) { assert ( 'is_array($parameters)' ) ; $ authnRequest = new OneLogin_Saml2_AuthnRequest ( $ indexAcs , $ this -> _settings , $ forceAuthn , $ isPas... | Initiates the SSO process . |
229,288 | public function logout ( $ application_index = null , $ returnTo = null , $ parameters = array ( ) , $ nameId = null , $ sessionIndex = null , $ stay = false , $ nameIdFormat = null , $ nameIdNameQualifier = null ) { assert ( 'is_array($parameters)' ) ; $ sloUrl = $ this -> getSLOurl ( $ application_index ) ; if ( empt... | Initiates the SLO process . |
229,289 | public static function validateType ( $ type ) { if ( ! in_array ( $ type , [ self :: TYPE_INFO , self :: TYPE_SUCCESS , self :: TYPE_WARNING , self :: TYPE_ERROR ] ) ) { throw new \ InvalidArgumentException ( 'Invalid resource message type "%s".' , $ type ) ; } } | Validates the type . |
229,290 | public function __isset ( $ name ) { $ dtp = new \ stdClass ( ) ; $ dtp -> propertyName = $ name ; $ dtp -> continue = TRUE ; $ dtp -> results = FALSE ; $ this -> triggerEvent ( self :: EVENT_ON_BEFORE_ISSET_PROPERTY , $ dtp ) ; if ( $ dtp -> continue == TRUE ) { $ getter = $ this -> public_function_prefix . 'get' . $ ... | Checks if a property is set i . e . defined and not NULL . |
229,291 | public function setNameAttribute ( string $ name ) { $ this -> attributes [ 'name' ] = $ name ; $ this -> slug = $ slug = str_slug ( $ name ) ; if ( $ this instanceof Model && self :: sameSlugs ( $ this , $ slug ) -> exists ( ) ) { $ similarSlugs = self :: similarSlugs ( $ this , $ slug ) ; $ postfix = 1 ; $ this -> sl... | Override set name - also updates slug |
229,292 | public function send ( $ template = false ) { if ( $ template !== false ) { $ this -> setContent ( new Content ( $ template ) ) ; } $ this -> renderer -> render ( $ template ) ; } | Send output to use with template path optional |
229,293 | public function redirect ( $ to , int $ delay = 0 ) { $ host = $ this -> server ( ) -> get ( 'HTTP_HOST' ) ; $ protocol = 'http' ; if ( $ this -> server ( ) -> get ( 'HTTPS' ) ) { $ protocol = 'https' ; } $ domain = $ protocol . '://' . $ host ; if ( $ delay !== 0 ) { header ( 'Refresh: ' . $ delay . '; url=' . $ domai... | Redirect to another page with additional delay |
229,294 | private function resolvePreparedStatement ( $ query = '' , array $ parameters = [ ] ) { $ connection = $ this -> getConnection ( ) ; $ prepare = $ connection -> prepare ( $ query ) ; if ( $ prepare instanceof PDOStatement ) { $ resolved = $ this -> resolvePdoPreparedStatement ( $ prepare , $ parameters ) ; } elseif ( $... | resolve the query |
229,295 | private function resolveMysqliPreparedStatement ( mysqli_stmt $ prepare , array $ parameters = [ ] ) { $ s = "" ; foreach ( $ parameters as $ param ) { if ( is_string ( $ param ) ) { $ s .= "s" ; } elseif ( is_integer ( $ param ) ) { $ s .= "i" ; } } if ( count ( $ parameters ) < 1 ) { $ paramArray = [ ] ; } else { $ p... | resolve the mysql prepared statement |
229,296 | public function get ( $ request , $ match ) { $ model = $ this -> internalGet ( $ request , $ match ) ; if ( ! isset ( $ model ) ) { throw new Pluf_Exception_DoesNotExist ( 'Setting not found' ) ; } return $ model ; } | Getting system setting |
229,297 | public static function make ( array $ data ) { foreach ( $ data as & $ value ) { if ( is_array ( $ value ) ) { $ value = static :: make ( $ value ) ; } } unset ( $ value ) ; return new self ( $ data , \ ArrayObject :: ARRAY_AS_PROPS ) ; } | Create a new instance from a basic array . |
229,298 | public function asArray ( ) { $ array = [ ] ; foreach ( $ this as $ key => $ val ) { if ( $ val instanceof self ) { $ val = $ val -> asArray ( ) ; } $ array [ $ key ] = $ val ; } return $ array ; } | Convert the current instance to a basic array . |
229,299 | public function validateSpeciesCode ( ErrorElement $ errorElement , $ object ) { $ generator = $ this -> getConfigurationPool ( ) -> getContainer ( ) -> get ( 'librinfo_varieties.code_generator.species' ) ; if ( ! $ generator -> validate ( $ object -> getCode ( ) ) ) { $ errorElement -> with ( 'code' ) -> addViolation ... | Species code validator . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.