idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
48,300 | 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 |
48,301 | 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 |
48,302 | 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 . |
48,303 | 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 . |
48,304 | 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 . |
48,305 | 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 . |
48,306 | 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 . |
48,307 | 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 . |
48,308 | 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 . |
48,309 | 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 . |
48,310 | public function setWorkingDays ( array $ days , $ format = null ) { $ this -> workingDays = $ days ; if ( $ format ) { $ this -> formatWorkingDays = $ format ; } return $ this ; } | Set working days as exclusion . |
48,311 | 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 . |
48,312 | 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 . |
48,313 | 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 . |
48,314 | 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 . |
48,315 | 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 . |
48,316 | protected function hydrateWidgets ( $ widgets ) { $ isWidgetsStringBased = static :: isWidgetsStringBased ( $ widgets ) ; $ isWidgetsIntBased = static :: isWidgetsIntBased ( $ widgets ) ; $ field = $ isWidgetsStringBased ? 'id' : 'id' ; $ className = static :: getWidgetClassName ( ) ; return $ isWidgetsStringBased || $... | Hydrate widgets . |
48,317 | 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 |
48,318 | public function setPlot ( \ Librinfo \ SeedBatchBundle \ Entity \ Plot $ plot = null ) { $ this -> plot = $ plot ; return $ this ; } | Set plot . |
48,319 | public function setCertifyingBody ( \ Librinfo \ SeedBatchBundle \ Entity \ CertifyingBody $ certifyingBody = null ) { $ this -> certifyingBody = $ certifyingBody ; return $ this ; } | Set certifyingBody . |
48,320 | 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 . |
48,321 | 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 . |
48,322 | 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 |
48,323 | 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 . |
48,324 | 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 |
48,325 | 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 . |
48,326 | 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 . |
48,327 | 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 . |
48,328 | 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 . |
48,329 | 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 . |
48,330 | 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 . |
48,331 | 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 . |
48,332 | 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 . |
48,333 | 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 . |
48,334 | 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 . |
48,335 | 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 . |
48,336 | public function resolveMany ( array $ references ) { $ convertedParameters = array ( ) ; foreach ( $ references as $ reference ) { $ convertedValue = $ this -> resolve ( $ reference ) ; $ convertedParameters [ ] = $ convertedValue ; } return $ convertedParameters ; } | Resolves an array of references |
48,337 | 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 |
48,338 | 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 |
48,339 | 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 |
48,340 | 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 |
48,341 | 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 |
48,342 | 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 |
48,343 | 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 . |
48,344 | 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 . |
48,345 | 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 . |
48,346 | 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 |
48,347 | 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 |
48,348 | 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 |
48,349 | 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 |
48,350 | 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 |
48,351 | 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 |
48,352 | 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 |
48,353 | 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 . |
48,354 | protected static function getLanguageService ( ) : LanguageService { $ objectManager = GeneralUtility :: makeInstance ( ObjectManager :: class ) ; $ languageService = $ objectManager -> get ( LanguageService :: class ) ; return $ languageService ; } | Gets the language service . |
48,355 | protected static function getPageService ( ) : PageService { $ objectManager = GeneralUtility :: makeInstance ( ObjectManager :: class ) ; $ pageService = $ objectManager -> get ( PageService :: class ) ; return $ pageService ; } | Gets the page service . |
48,356 | 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 . |
48,357 | 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 . |
48,358 | 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 . |
48,359 | 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 . |
48,360 | 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 . |
48,361 | 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 |
48,362 | 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 |
48,363 | 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 |
48,364 | 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 |
48,365 | 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 |
48,366 | 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 |
48,367 | 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 . |
48,368 | 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 . |
48,369 | 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 . |
48,370 | public function onKernelException ( GetResponseForExceptionEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ exception = $ event -> getException ( ) ; if ( ! $ this -> supports ( $ request ) ) { return ; } $ statusCode = $ exception instanceof HttpException ? $ exception -> getStatusCode ( ) : 500 ; $ errors ... | Exception event handler |
48,371 | protected function transformWords ( array $ words ) { $ text = implode ( " {$this->determine} " , $ words ) ; $ text = $ this -> pinyin -> sentence ( $ text ) ; return explode ( " {$this->determine} " , $ text ) ; } | Transform words to pinyin . |
48,372 | protected function prepareRatios ( Collection $ tags ) { $ ratios = $ tags -> filter ( function ( Tag $ tag ) { return $ tag -> hasPosts ( ) ; } ) -> transform ( function ( Tag $ tag ) { return [ 'label' => $ tag -> name , 'posts' => $ tag -> posts -> count ( ) , ] ; } ) -> sortByDesc ( 'posts' ) ; $ chunk = $ ratios -... | Prepare the tags ratios . |
48,373 | private function colorizeRatios ( Collection $ ratios ) { $ colors = [ '#F56954' , '#00A65A' , '#F39C12' , '#00C0EF' , '#3C8DBC' ] ; return $ ratios -> values ( ) -> transform ( function ( array $ values , $ key ) use ( $ colors ) { return $ values + [ 'color' => $ colors [ $ key ] ] ; } ) ; } | Colorize the ratios . |
48,374 | public function searchTable ( string $ databaseName , string $ tableName , string $ searchTerm ) : \ Generator { return $ this -> search -> searchTable ( $ this -> connection , $ databaseName , $ tableName , $ searchTerm ) ; } | Performs search on the specified database and table . |
48,375 | public function searchDatabase ( string $ databaseName , string $ searchTerm ) : \ Generator { return $ this -> search -> searchDatabase ( $ this -> connection , $ databaseName , $ searchTerm ) ; } | Performs search on all tables in the specified database . |
48,376 | public function searchServer ( string $ searchTerm ) : \ Generator { return $ this -> search -> searchServer ( $ this -> connection , $ searchTerm ) ; } | Performs search on all available databases . |
48,377 | public function replaceTable ( string $ databaseName , string $ tableName , string $ searchTerm , string $ replaceTerm ) : \ Generator { return $ this -> replace -> replaceTable ( $ this -> connection , $ databaseName , $ tableName , $ searchTerm , $ replaceTerm ) ; } | Performs search and replacement on the specified database and table . |
48,378 | public function replaceDatabase ( string $ databaseName , string $ searchTerm , string $ replaceTerm ) : \ Generator { return $ this -> replace -> replaceDatabase ( $ this -> connection , $ databaseName , $ searchTerm , $ replaceTerm ) ; } | Performs search and replacement on all tables in the specified database . |
48,379 | public function getCacheService ( ) { $ memcached = $ this -> memcached ; if ( empty ( $ memcached ) ) { $ memcached = $ this -> getServiceLocator ( ) -> get ( 'memcached' ) ; } return $ memcached ; } | Get memcached service |
48,380 | static function NextStep ( $ step ) { $ keys = array_keys ( self :: Steps ( ) ) ; $ index = array_search ( $ step , $ keys ) ; if ( $ index !== false && $ index < count ( $ keys ) - 1 ) { return $ keys [ $ index + 1 ] ; } return null ; } | Gets the next step name |
48,381 | public static function fixUTF8 ( $ text , $ option = self :: WITHOUT_ICONV ) { if ( is_array ( $ text ) ) { foreach ( $ text as $ k => $ v ) $ text [ $ k ] = self :: fixUTF8 ( $ v , $ option ) ; return $ text ; } $ last = "" ; while ( $ last <> $ text ) { $ last = $ text ; $ text = self :: toUTF8 ( static :: utf8_decod... | Fix broken UTF - 8 text . |
48,382 | public static function encode ( $ encodingLabel , $ text ) { $ encodingLabel = self :: normalizeEncoding ( $ encodingLabel ) ; if ( $ encodingLabel == 'ISO-8859-1' ) return self :: toWin1252 ( $ text ) ; return self :: toUTF8 ( $ text ) ; } | Convert the text to either UTF - 8 or ISO - 85591 - 1 . |
48,383 | public static function getBOM ( string $ which ) { $ cname = self :: class . '::' . strtoupper ( $ which ) . '_BOM' ; if ( ! defined ( $ cname ) ) return null ; $ bytes = constant ( $ cname ) ; $ bom = '' ; foreach ( $ bytes as $ ord ) $ bom .= chr ( $ ord ) ; return $ bom ; } | Get a BOM for a supported encoding |
48,384 | public function orderBy ( $ column , string $ direction = 'asc' ) : self { $ column = $ this -> checkStringValue ( 'Argument $column' , $ column ) ; $ this -> order [ ] = new Order ( $ column , strtolower ( $ direction ) === 'desc' ) ; return $ this ; } | Adds a simple order to the orders list . |
48,385 | public function orderByNullLast ( $ column , bool $ doReverse = false ) : self { $ column = $ this -> checkStringValue ( 'Argument $column' , $ column ) ; $ this -> order [ ] = new OrderByIsNull ( $ column , $ doReverse ) ; return $ this ; } | Adds such order that the null column values go last . |
48,386 | public function inExplicitOrder ( $ column , array $ order , bool $ areOtherFirst = false ) : self { $ column = $ this -> checkStringValue ( 'Argument $column' , $ column ) ; foreach ( $ order as $ index => & $ value ) { $ value = $ this -> checkScalarOrNullValue ( 'Argument $order[' . $ index . ']' , $ value ) ; } $ t... | Adds such order that makes a column values follow the explicitly given order . |
48,387 | public function delete ( ) { if ( ! $ this -> isNewRecord ) { $ item = Yii :: $ app -> authManager -> getRole ( $ this -> name ) ; if ( $ item ) { Yii :: $ app -> authManager -> remove ( $ item ) ; } } } | Delete current item |
48,388 | static public function getRolesList ( $ except = null ) { $ res = ArrayHelper :: map ( Yii :: $ app -> authManager -> getRoles ( ) , 'name' , 'description' ) ; if ( $ except !== null ) { unset ( $ res [ $ except ] ) ; } asort ( $ res ) ; return $ res ; } | Returns roles list description by name as key |
48,389 | static public function getPermissionsList ( $ except = null ) { $ res = ArrayHelper :: map ( Yii :: $ app -> authManager -> getPermissions ( ) , 'name' , 'description' ) ; if ( $ except !== null ) { unset ( $ res [ $ except ] ) ; } ksort ( $ res ) ; return $ res ; } | Returns permissions list description by name as key |
48,390 | public function query ( $ param , $ handler ) { $ param = new QueryParam ( $ param , $ handler ) ; $ this -> middleware [ ] = $ param ; } | Adds query handlers to a queue . The queue is processed at invocation by RelayPHP . |
48,391 | public function param ( $ param , $ handler ) { $ param = new RouteParam ( $ param , $ handler ) ; $ this -> middleware [ ] = $ param ; } | Adds param handlers to a queue . The queue is processed at invocation by RelayPHP . |
48,392 | protected function manageMediaDetectionAndStoreInSession ( ) { $ detect = new \ Mobile_Detect ( ) ; if ( array_key_exists ( Routers \ IMedia :: MEDIA_VERSION_MOBILE , $ this -> allowedMediaVersionsAndUrlValues ) && $ detect -> isMobile ( ) ) { $ this -> mediaSiteVersion = Routers \ IMedia :: MEDIA_VERSION_MOBILE ; } el... | Detect media site version by sent user agent string by third party \ Mobile_Detect library and store detected result in session namespace for next requests . |
48,393 | protected function setUpMediaSiteVersionToContextAndSession ( $ targetMediaSiteVersion ) { $ this -> session -> { static :: URL_PARAM_MEDIA_VERSION } = $ targetMediaSiteVersion ; $ this -> mediaSiteVersion = $ targetMediaSiteVersion ; return [ \ MvcCore \ Ext \ Routers \ IMedia :: URL_PARAM_MEDIA_VERSION => $ targetMed... | Set up media site version string into current context and into session and return it . |
48,394 | public function getLpPath ( NestedSetRoutingPageInterface $ page , $ action , $ parameters = array ( ) , $ relative = false ) { $ configuration = $ this -> routeConfiguration -> get ( $ action ) ; return $ this -> opGenerator -> generate ( $ configuration -> getPageRouteName ( $ page ) , $ parameters , $ relative ? Url... | Build nested set page route |
48,395 | public function saveMessage ( $ msg ) { $ messages = $ this -> session -> get ( "FlashInSession" , [ ] ) ; $ messages [ ] = $ msg ; $ this -> session -> set ( "FlashInSession" , $ messages ) ; } | Save a message to the session |
48,396 | public function getMessages ( $ removeOnGet = false ) { $ messages = $ this -> session -> get ( "FlashInSession" , [ ] ) ; if ( $ removeOnGet ) { $ this -> clear ( ) ; } return $ messages ; } | Retrievs all stored messages . |
48,397 | private function _setParams ( $ params , $ keys , $ required = true ) { foreach ( $ keys as $ key ) { if ( ! array_key_exists ( $ key , $ params ) ) { if ( $ required == true ) { throw new EmailException ( "Required configuration key '{$key}' was not found." ) ; } else { continue ; } } switch ( strtolower ( $ key ) ) {... | Sets various parameters on our mailer object . |
48,398 | public function subject ( $ subject ) { try { $ this -> mailer -> Subject = $ subject ; } catch ( phpmailerException $ e ) { throw new EmailException ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } return $ this ; } | Sets the subject for your email . |
48,399 | public function body ( $ text ) { try { $ this -> mailer -> MsgHTML ( $ text ) ; } catch ( phpmailerException $ e ) { throw new EmailException ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } return $ this ; } | Sets the email message body |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.