idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
10,700 | private static function loadSerializationType ( $ type ) { $ types = array ( 'default' => \ Redis :: SERIALIZER_NONE , 'none' => \ Redis :: SERIALIZER_NONE , 'php' => \ Redis :: SERIALIZER_PHP ) ; if ( defined ( 'Redis::SERIALIZER_IGBINARY' ) ) { $ types [ 'igbinary' ] = \ Redis :: SERIALIZER_IGBINARY ; } if ( array_ke... | Load the correct serializer for Redis |
10,701 | public function calculateTimings ( $ messages ) { $ timings = [ ] ; $ stack = [ ] ; foreach ( $ messages as $ i => $ log ) { list ( $ token , $ level , $ category , $ timestamp , $ traces ) = $ log ; $ log [ 5 ] = $ i ; if ( $ level == Logger :: LEVEL_PROFILE_BEGIN ) { $ stack [ ] = $ log ; } elseif ( $ level == Logger... | Calculates the elapsed time for the given log messages . |
10,702 | public static function getLevelName ( $ level ) { static $ levels = [ self :: LEVEL_ERROR => 'error' , self :: LEVEL_WARNING => 'warning' , self :: LEVEL_INFO => 'info' , self :: LEVEL_TRACE => 'trace' , self :: LEVEL_PROFILE_BEGIN => 'profile begin' , self :: LEVEL_PROFILE_END => 'profile end' , ] ; return isset ( $ l... | Returns the text display of the specified level . |
10,703 | public function associateAccount ( Users $ user , \ Hybridauth \ User \ Profile $ socialProfile , $ socialNetwork ) { if ( ! $ this -> existSocialProfile ( $ socialProfile , $ socialNetwork ) ) { $ source = Sources :: findFirst ( [ 'title = :title:' , 'bind' => [ 'title' => strtolower ( $ socialNetwork ) ] ] ) ; $ user... | Funcion que registra al user de la red social al sistema . Si ya esta registrado lo logea |
10,704 | public static function alreadyConnected ( Users $ userData , $ socialNetwork ) { $ source = Sources :: findFirst ( [ 'title = :title:' , 'bind' => [ 'title' => $ socialNetwork ] ] ) ; $ bind = [ 'source_id' => $ source -> source_id , 'users_id' => $ userData -> users_id , ] ; if ( $ userSocialLinked = self :: findFirst... | is the user already connecte to the social media site? |
10,705 | public function changeStatusActivity ( string $ status ) { if ( "enabled" === $ status ) { if ( Locale :: enableLocale ( ) ) { return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( "code" => 200 , "msg" => "OK" ) ) ) ; } else { return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( "code" => 500 , "results" => "Loca... | Change the status of locale |
10,706 | public function changeStatusLocalAppActivity ( string $ appname , string $ status ) { if ( "enabled" === $ status ) { $ locale = new AppLocale ( $ appname ) ; $ locale -> setEnabled ( true ) ; $ locale -> apply ( ) ; unset ( $ locale ) ; $ locale = new AppLocale ( $ appname ) ; if ( $ locale -> isEnabled ( ) ) { return... | Change the locale app status |
10,707 | public function getAllActivity ( ) : Renderer { $ locales = [ ] ; $ elems = Locale :: getAll ( ) ; foreach ( $ elems as $ one => $ value ) { if ( null === $ value ) { $ locales [ ] = [ "app" => $ one , "enabled" => false , "values" => [ ] , "prefered" => null , "transtype" => null , "route_status_change" => $ this -> g... | Get all locale |
10,708 | public function getOneLocaleActivity ( string $ appname ) : Renderer { $ locale = new AppLocale ( $ appname ) ; $ localeFormat = [ "app" => $ appname , "enabled" => $ locale -> isEnabled ( ) , "values" => $ locale -> getValues ( ) , "prefered" => $ locale -> getPrefer ( ) , "transtype" => $ locale -> getTranstype ( ) ]... | Get one locale |
10,709 | public function editLocaleActivity ( string $ appname ) : Renderer { $ allowed = [ "json" , "poedit" ] ; $ plocale = trim ( $ this -> get ( "request" ) -> get ( "plocale" ) ) ; $ status = $ this -> get ( "request" ) -> get ( "status" ) ; $ trans_type = trim ( $ this -> get ( "request" ) -> get ( "trans_type" ) ) ; $ va... | edit one locale |
10,710 | public function getData ( ) { if ( ! $ this -> data && $ this -> dataProvider ) { return call_user_func ( $ this -> dataProvider , $ this ) ; } return $ this -> data ; } | Return the assigned data . |
10,711 | protected function buildResult ( ConditionGroup $ conditions , array $ sorting , $ keys = [ ] , $ page = null , $ perPage = null ) { $ matcher = $ this -> createMatcher ( $ conditions ) ; $ shouldBreak = $ page && $ perPage && ! $ sorting ; $ offset = $ shouldBreak ? ( $ page - 1 ) * $ perPage : 0 ; $ limit = $ shouldB... | Build the result array by filtering it and then sorting it . |
10,712 | protected function filterData ( callable $ matcher , $ offset = 0 , $ limit = null ) { $ filtered = [ ] ; $ i = - 1 ; $ added = 0 ; foreach ( $ this -> getData ( ) as $ item ) { if ( ! $ matcher ( $ item ) ) { continue ; } $ i ++ ; if ( $ i < $ offset ) { continue ; } $ filtered [ ] = $ item ; $ added ++ ; if ( $ limit... | Filter the data and optionally slice it . |
10,713 | protected function sortCompareValues ( $ a , $ b ) { if ( is_numeric ( $ a ) && is_numeric ( $ b ) ) { return $ this -> sortCompareNumeric ( ( float ) $ a , ( float ) $ b ) ; } if ( is_string ( $ a ) && is_string ( $ b ) ) { return $ this -> sortCompareStrings ( $ a , $ b ) ; } return ( $ a < $ b ) ? - 1 : ( int ) ( $ ... | Compare arbitrary values for sorting . |
10,714 | protected function getData ( $ id ) { $ data = ( new Query ( ) ) -> select ( [ 'data' ] ) -> from ( $ this -> tableName ) -> where ( [ 'id' => $ id ] ) -> scalar ( ) ; if ( $ data !== false ) { return empty ( $ data ) ? [ ] : unserialize ( $ data ) ; } return false ; } | Get saved profile of the client |
10,715 | protected function save ( ) { $ this -> db -> createCommand ( ) -> update ( $ this -> tableName , [ 'updated_at' => time ( ) , 'data' => [ serialize ( $ this -> _states ) , \ PDO :: PARAM_LOB ] , ] , [ 'id' => $ this -> _id ] ) -> execute ( ) ; } | Save client s profile to database |
10,716 | public function set ( $ name , $ value ) { if ( $ name == 'id' ) { throw new InvalidCallException ( 'Setting read-only property: ' . get_class ( $ this ) . '::' . $ name ) ; } $ this -> _states [ $ name ] = $ value ; $ this -> save ( ) ; } | Set the profile |
10,717 | public function states ( $ states = null ) { if ( $ states === null ) { return $ this -> _states ; } else { unset ( $ states [ 'id' ] ) ; foreach ( $ states as $ key => $ value ) { $ this -> _states [ $ key ] = $ value ; } $ this -> save ( ) ; } } | Get or set profiles |
10,718 | private function deleteCache ( string $ env ) { Output :: displayAsSuccess ( "Hey, I delete cache from $env environment " , "none" ) ; $ this -> callDelCreaServer ( $ env ) ; if ( in_array ( "--noexit" , $ this -> options [ "options" ] ) ) { Output :: displayAsEndSuccess ( "Cache delete for $env environment is successf... | Delete a cache from a specific environment |
10,719 | public function search ( $ query ) { $ this -> logger -> debug ( 'Page:search' ) ; if ( ! Tools :: isGoodString ( $ query ) ) { $ this -> logger -> error ( 'Page::search: invalid query' ) ; return [ ] ; } $ this -> setGeneratorSearch ( $ query , self :: PAGE_NAMESPACE ) ; $ this -> setParam ( 'prop' , 'pageprops' ) ; $... | search for Pages |
10,720 | public function info ( ) { $ this -> logger -> debug ( 'Page:info' ) ; if ( ! $ this -> setIdentifier ( '' , 's' ) ) { return [ ] ; } $ this -> setParam ( 'prop' , 'pageprops' ) ; $ this -> send ( ) ; return Tools :: flatten ( $ this -> getResponse ( [ 'query' , 'pages' ] ) ) ; } | get page information |
10,721 | public function format ( array $ response ) { $ this -> logger -> debug ( 'Page:format' ) ; $ car = '<br />' ; $ format = '' ; foreach ( $ response as $ page ) { $ format .= '<div class="page">' . '<span class="title">' . Tools :: safeString ( Tools :: getFromArray ( $ page , 'title' ) ) . '</span>' . $ car . '<span cl... | format a page response as a simple string |
10,722 | protected function _runCmd ( $ cmd ) { if ( ! empty ( $ cmd ) ) { if ( is_array ( $ cmd ) ) { $ cmd = implode ( ' && ' , $ cmd ) ; } if ( $ this -> _isWindows ( ) ) { if ( function_exists ( 'popen' ) && function_exists ( 'pclose' ) ) { pclose ( popen ( 'start / B ' . $ cmd , 'r' ) ) ; } else { if ( $ this -> messaging ... | Execute predefined non - PHP console command |
10,723 | protected function _makeBackupDirs ( ) { $ this -> _makeDirectory ( $ this -> config [ 'backupDir' ] ) ; if ( $ this -> config [ 'use_date_directory' ] ) { $ this -> _makeDirectory ( $ this -> config [ 'backupDir' ] . $ this -> date ) ; } } | make backup directory structure |
10,724 | public static function simple ( array $ rows = [ ] , array $ totals = [ ] , string $ sheetName = 'worksheet' , string $ path = '' , array $ options = [ ] ) { try { $ spreadsheet = new Spreadsheet ( ) ; $ path = self :: getUniqueFilePath ( $ path ) ; self :: initializeFile ( $ path ) ; self :: setOptions ( $ spreadsheet... | A wrapper around the PhpSpreadsheet library to make consistently formatted spreadsheets . |
10,725 | public static function numLinesInSheet ( $ path , $ sheetIndex = 0 ) : int { $ emptySheetAsArray = [ 0 => [ 0 => NULL , ] , ] ; $ sheetName = Excel :: getSheetName ( $ path , $ sheetIndex ) ; $ sheetAsArray = self :: sheetToArray ( $ path , $ sheetName ) ; if ( $ sheetAsArray == $ emptySheetAsArray ) : return 0 ; endif... | Returns the number of lines in the sheet . |
10,726 | protected static function getUniqueFilePath ( $ startingPath = '' ) { if ( file_exists ( $ startingPath ) ) { $ filename_ext = pathinfo ( $ startingPath , PATHINFO_EXTENSION ) ; $ startingPath = preg_replace ( '/^(.*)\.' . $ filename_ext . '$/' , '$1_' . date ( 'YmdHis' ) . '.' . $ filename_ext , $ startingPath ) ; if ... | Given desired startingPath this method will check if a file already exists at that location . If a file with the same file name exists this method will return a path with a timestamp appended to the end of the intended file name . |
10,727 | public function getSize ( ) { if ( $ this -> size ) { return $ this -> size ; } $ this -> size = new Size ( $ this -> __get ( 'width' ) , $ this -> __get ( 'height' ) ) ; return $ this -> size ; } | Return the size of this attachment . |
10,728 | public function addSize ( $ size , UrlContract $ url ) { $ size = is_array ( $ size ) ? new Size ( $ size [ 0 ] , $ size [ 1 ] ) : $ size ; if ( $ size -> equals ( $ this -> getSize ( ) ) ) { return $ this ; } $ key = "$size" ; $ this -> sizes [ $ key ] = $ size ; $ this -> sizeUrls [ $ key ] = $ url ; return $ this ; ... | Add an url to a different size of this attachment . |
10,729 | public function removeSize ( $ size ) { $ size = is_array ( $ size ) ? new Size ( $ size [ 0 ] , $ size [ 1 ] ) : $ size ; $ key = "$size" ; if ( isset ( $ this -> sizes [ $ key ] ) ) { unset ( $ this -> sizes [ $ key ] ) ; } if ( isset ( $ this -> sizeUrls [ $ key ] ) ) { unset ( $ this -> sizeUrls [ $ key ] ) ; } ret... | Remove a previously added size . |
10,730 | public function installedData ( string $ slug , string $ key , bool $ parent = false ) : string { if ( ! $ slug || ! $ key ) { return '' ; } switch ( $ key ) { case 'name' : $ key = 'Name' ; break ; case 'version' : $ key = 'Version' ; break ; case 'description' : $ key = 'Description' ; break ; case 'url' : $ key = 'T... | Installed theme data from slug . |
10,731 | protected function emitProgress ( $ progress , $ step = 0 , $ totalSteps = 1 , $ stepName = '' ) { if ( ! $ progress instanceof Progress ) { $ progress = new Progress ( $ progress , $ step , $ totalSteps , $ stepName ) ; } foreach ( $ this -> progressListeners as $ listener ) { call_user_func ( $ listener , $ progress ... | Emit a progress object to all listeners . |
10,732 | protected function con ( UrlContract $ url ) { $ con = $ this -> connections -> connection ( $ url ) ; if ( ! $ con instanceof HttpConnection ) { throw new \ UnexpectedValueException ( "The connection returned for $url is no HttpConnection" ) ; } return $ con ; } | Return guaranteed a HttpConnection . |
10,733 | protected function configure ( Response $ response , $ contentType = null ) { if ( ! $ contentType ) { return $ response ; } if ( strtolower ( $ contentType ) == strtolower ( $ this -> serializer -> mimeType ( ) ) ) { $ response -> setSerializer ( $ this -> serializer ) ; } return $ response ; } | Configure the response . Just set the right serializer . |
10,734 | public function inflect ( Route $ route ) { $ file = $ route -> attributes [ 'controller' ] . '/' ; $ file .= $ route -> attributes [ 'action' ] ; $ filtered = self :: camelCaseToSeparator ( $ file , '_' ) ; $ filtered = str_replace ( '_' , '-' , strtolower ( $ filtered ) ) ; return "{$filtered}.{$this->extension}" ; } | Returns the template name for current request |
10,735 | public static function camelCaseToSeparator ( $ text , $ sep = " " ) { if ( ! is_scalar ( $ text ) && ! is_array ( $ text ) ) { return $ text ; } if ( self :: hasPcreUnicodeSupport ( ) ) { $ pattern = array ( '#(?<=(?:\p{Lu}))(\p{Lu}\p{Ll})#' , '#(?<=(?:\p{Ll}|\p{Nd}))(\p{Lu})#' ) ; $ replacement = array ( $ sep . '\1'... | Converts camel case strings to words separated by provided string |
10,736 | public static function hasPcreUnicodeSupport ( ) { if ( self :: $ hasPcreUnicodeSupport === null ) { self :: $ hasPcreUnicodeSupport = defined ( 'PREG_BAD_UTF8_OFFSET_ERROR' ) && @ preg_match ( '/\pL/u' , 'a' ) == 1 ; } return self :: $ hasPcreUnicodeSupport ; } | Is PCRE compiled with Unicode support? |
10,737 | public function create ( $ page_id = null ) { $ page = $ page_id ? Page :: find ( $ page_id ) : null ; $ line = new Line ( ) ; $ available_locales = config ( 'squanto.locales' ) ; return view ( 'squanto::create' , compact ( 'page' , 'line' , 'available_locales' ) ) ; } | Create new line |
10,738 | public static function guessFrom ( $ date ) { if ( $ date instanceof DateTime ) { return ( new static ( ) ) -> setTimestamp ( $ date -> getTimestamp ( ) ) -> setTimezone ( $ date -> getTimezone ( ) ) ; } if ( is_numeric ( $ date ) ) { return ( new static ( ) ) -> setTimestamp ( ( int ) $ date ) ; } if ( is_object ( $ d... | Try to guess the datetime by the passed string . |
10,739 | public function findModel ( $ id ) { if ( ( $ model = Category :: findOne ( $ id ) ) !== null ) { return $ model ; } else { throw new NotFoundHttpException ( Yii :: t ( 'system' , 'The requested page does not exist.' ) ) ; } } | Finds the Category model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown . |
10,740 | public function active ( bool $ slugify = true ) : array { global $ blog_id ; $ cache_key = '_' . ( int ) $ blog_id . ( int ) $ slugify ; if ( isset ( static :: $ cache [ __FUNCTION__ ] [ $ cache_key ] ) ) { return static :: $ cache [ __FUNCTION__ ] [ $ cache_key ] ; } $ active = get_option ( 'active_plugins' ) ; $ act... | Active plugins . |
10,741 | public function networkActive ( bool $ slugify = true ) : array { $ cache_key = '_' . ( int ) $ slugify ; if ( isset ( static :: $ cache [ __FUNCTION__ ] [ $ cache_key ] ) ) { return static :: $ cache [ __FUNCTION__ ] [ $ cache_key ] ; } if ( ! $ this -> Wp -> is_multisite ) { return static :: $ cache [ __FUNCTION__ ] ... | Network - active plugins . |
10,742 | public function allActive ( bool $ slugify = true ) : array { global $ blog_id ; $ cache_key = '_' . ( int ) $ blog_id . ( int ) $ slugify ; if ( isset ( static :: $ cache [ __FUNCTION__ ] [ $ cache_key ] ) ) { return static :: $ cache [ __FUNCTION__ ] [ $ cache_key ] ; } $ active = $ this -> active ( $ slugify ) ; $ n... | All active plugins . |
10,743 | protected function prepareProductSuperLinkAttributes ( ) { return $ this -> initializeEntity ( array ( MemberNames :: PRODUCT_ID => $ this -> childId , MemberNames :: PARENT_ID => $ this -> parentId ) ) ; } | Prepare the product super link attributes that has to be persisted . |
10,744 | public function open ( ) : int { if ( $ this -> resource == null ) { $ this -> resource = ( $ this -> is_base ) ? JL :: open ( $ this -> mercure_path_base ) : JL :: open ( $ this -> mercure_path ) ; } return ( 1 ) ; } | Open JS Routing File |
10,745 | private function write ( string $ file_contains ) : int { $ header = "/*\n * This is an iumio Framework component\n *\n * (c) RAFINA DANY <dany.rafina@iumio.com>" ; $ headersub = "\n *\n * iumio Framework, an iumio component [https://iumio.com]\n *\n" ; $ headersub2 = " * To get more information about licence, please c... | Write in JS routing file |
10,746 | private function buildFile ( ) : int { $ mercure = $ this -> analysis ( ) ; $ mercurefinal = array ( ) ; if ( $ this -> clear ( ) != 1 ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Cannot clear Routing JS File" , "solution" => "Please check the Routing JS file" ) ) ) ; } while ( $ mercure -> valid... | Build JS Routing File with multiple stage |
10,747 | private function getApplist ( ) : \ stdClass { $ apps = ( $ this -> is_base ) ? JL :: open ( $ this -> baseapps_path ) : JL :: open ( $ this -> apps_path ) ; JL :: close ( $ this -> apps_path ) ; return ( $ apps ) ; } | Get app list |
10,748 | private function clear ( ) : int { return ( ( $ this -> is_base ) ? JL :: put ( $ this -> mercure_path_base , "" ) : JL :: put ( $ this -> mercure_path , "" ) ) ; } | Clear routing js file |
10,749 | private function analysis ( ) : \ ArrayIterator { $ apps = $ this -> getApplist ( ) ; $ routing = new \ ArrayIterator ( ) ; foreach ( $ apps as $ one => $ values ) { $ mercure = new Routing ( $ values -> name , ( isset ( $ values -> prefix ) ? $ values -> prefix : "" ) , $ this -> is_base ) ; $ mercure -> routingRegist... | Analysis route visibility |
10,750 | public function close ( $ oneRouter ) : int { if ( $ this -> resource != null ) { JL :: close ( $ this -> mercure_path ) ; } return ( 1 ) ; } | Close the router ressource |
10,751 | public function withoutBOM ( $ string ) { if ( $ bom = $ this -> findBOM ( $ string ) ) { return substr ( $ string , strlen ( $ bom ) ) ; } return $ string ; } | Remove th byte order mark from string if setted |
10,752 | protected function buildDetectOrder ( ) { $ detectOrder = [ ] ; foreach ( $ this -> defaultDetectOrder as $ i => $ charset ) { if ( $ this -> converter -> canConvert ( $ charset ) ) { $ detectOrder [ ] = $ charset ; } } return $ detectOrder ; } | Filters the detect order charsets by the support of the system . |
10,753 | protected function fillByteOrderMarks ( ) { $ this -> byteOrderMarks = [ self :: UTF32_BIG_ENDIAN => chr ( 0x00 ) . chr ( 0x00 ) . chr ( 0xFE ) . chr ( 0xFF ) , self :: UTF32_LITTLE_ENDIAN => chr ( 0xFF ) . chr ( 0xFE ) . chr ( 0x00 ) . chr ( 0x00 ) , self :: UTF16_BIG_ENDIAN => chr ( 0xFE ) . chr ( 0xFF ) , self :: UT... | Fill the boms with known marks |
10,754 | protected function findCharsetByBOM ( $ bom ) { foreach ( $ this -> byteOrderMarks as $ charset => $ knownBom ) { if ( $ knownBom === $ bom ) { return $ charset ; } } return '' ; } | Detect the charset by bom . |
10,755 | protected function createSegments ( array $ tokens ) : array { $ active = new TagStack ( ) ; return array_reduce ( $ tokens , function ( array $ segments , $ token ) use ( $ active ) { if ( $ token instanceof TagToken ) { if ( $ token -> isOpening ( ) ) { $ active -> push ( Tag :: createFromToken ( $ token ) ) ; } else... | Converts array of tokens to the array of text segments with applied tags . |
10,756 | protected function optimizeTree ( array $ nodes ) : array { $ nodes = array_reduce ( $ nodes , function ( array $ nodes , $ current ) { $ last = end ( $ nodes ) ; if ( $ last instanceof TagNode && $ current instanceof TagNode ) { $ lastTag = $ last -> getTag ( ) ; $ currentTag = $ current -> getTag ( ) ; if ( $ lastTag... | Merges sibling tag nodes that are the same . |
10,757 | protected function createTree ( array $ segments ) : array { $ nodes = array_map ( function ( TextSegment $ segment ) { $ text = new TextNode ( $ segment -> getText ( ) ) ; $ tags = array_reverse ( $ segment -> getTags ( ) ) ; return array_reduce ( $ tags , function ( Node $ child , Tag $ tag ) { return new TagNode ( $... | Converts array of text segments to the tree of nodes . |
10,758 | public function parse ( string $ text ) : string { $ tokens = $ this -> tokenizer -> tokenize ( $ text ) ; $ segments = $ this -> createSegments ( $ tokens ) ; $ nodes = $ this -> createTree ( $ segments ) ; return $ this -> generator -> generateMarkup ( $ nodes ) ; } | Parses input string and generates markup . |
10,759 | public static function bindToStatement ( PDOStatement $ statement , array $ bindings = [ ] ) { foreach ( $ bindings as $ key => $ value ) { $ casted = is_bool ( $ value ) ? ( int ) $ value : $ value ; $ statement -> bindValue ( is_string ( $ key ) ? $ key : $ key + 1 , $ casted , is_int ( $ casted ) ? PDO :: PARAM_INT ... | Add bindings to a statement . Cast integers null bool and string . |
10,760 | public function strlen ( $ var ) : int { $ v = '' . $ var ; if ( $ v === '' ) { return 0 ; } if ( static :: $ nativeSupport [ 'mbstring' ] ) { return mb_strlen ( $ v ) ; } $ n = 0 ; $ le = strlen ( $ v ) ; $ leading = false ; for ( $ i = 0 ; $ i < $ le ; $ i ++ ) { if ( ( $ ord = ord ( $ v { $ i } ) ) < 128 ) { ++ $ n ... | Multibyte - safe string length . |
10,761 | public function substr ( $ var , int $ start , $ length = null ) : string { if ( $ start < 0 ) { throw new \ InvalidArgumentException ( 'Arg start is not non-negative integer.' ) ; } if ( $ length !== null && ( ! is_int ( $ length ) || $ length < 0 ) ) { throw new \ InvalidArgumentException ( 'Arg length is not non-neg... | Multibyte - safe sub string . |
10,762 | public function getRelativeUrl ( ) { $ url = $ this -> getResourceUrl ( $ this -> resource , $ this -> idParam ) ; if ( $ this -> subresources && count ( $ this -> subresources ) ) { foreach ( $ this -> subresources as $ subresource ) { if ( $ subresource [ 'name' ] ) { $ url .= $ this -> getResourceUrl ( $ subresource... | Get relative url from request |
10,763 | public function init ( ) : bool { $ this -> _getUrl ( ) ; if ( empty ( $ this -> _url [ 0 ] ) ) { $ this -> _loadDefaultController ( ) ; return false ; } $ this -> _loadExistingController ( ) ; $ this -> _callControllerMethod ( ) ; return true ; } | Starts the Bootstrap . |
10,764 | private function _loadExistingController ( ) { $ file = $ this -> _controllerPath . ucfirst ( $ this -> _url [ 0 ] ) . '.php' ; if ( ! file_exists ( $ file ) ) { $ this -> _error ( ) ; return false ; } require $ file ; $ namespace = str_replace ( '/' , '\\' , APP . '/Controllers/' ) ; $ className = $ namespace . $ this... | Load an existing Controller if there IS a GET parameter passed . |
10,765 | private function _callControllerMethod ( ) { $ length = count ( $ this -> _url ) ; if ( $ length > 1 ) { if ( ! method_exists ( $ this -> _controller , $ this -> _url [ 1 ] ) ) { $ this -> _error ( ) ; } } switch ( $ length ) { case 5 : $ this -> _controller -> { strtolower ( $ this -> _url [ 1 ] ) } ( strtolower ( $ t... | If a method is passed in the GET url paremter . |
10,766 | protected function setValidation ( $ values ) { foreach ( $ values as $ validation ) { $ value = isset ( $ validation -> value ) ? $ validation -> value : true ; $ this -> validation [ $ validation -> rule ] = $ value ; } } | Set the validation rules |
10,767 | protected function flush ( $ message ) { $ this -> socket -> create ( AF_INET , SOCK_DGRAM , SOL_UDP ) ; $ this -> socket -> setNonBlocking ( ) ; $ this -> socket -> sendMessage ( $ message , $ this -> server , $ this -> port ) ; $ this -> socket -> close ( ) ; } | Send the message over UDP |
10,768 | public function detach ( SplObserver $ observer ) { $ key = array_search ( $ observer , $ this -> observers , true ) ; if ( $ key === false ) { throw new Exception ( 'The observer has not been found.' , self :: ERR_OBSERVER_NOT_FOUND ) ; } unset ( $ this -> observers [ $ key ] ) ; } | Detach a observer to the list |
10,769 | public function notify ( ) { \ BFW \ Application :: getInstance ( ) -> getMonolog ( ) -> getLogger ( ) -> debug ( 'Subject notify event' , [ 'action' => $ this -> action ] ) ; foreach ( $ this -> observers as $ observer ) { $ observer -> update ( $ this ) ; } } | Send a notification to all observers |
10,770 | public function readNotifyHeap ( ) : self { foreach ( $ this -> notifyHeap as $ notifyIndex => $ notifyDatas ) { $ this -> action = $ notifyDatas -> action ; $ this -> context = $ notifyDatas -> context ; $ this -> notify ( ) ; unset ( $ this -> notifyHeap [ $ notifyIndex ] ) ; } if ( count ( $ this -> notifyHeap ) > 0... | Read the notify heap list and send each notify into the list . |
10,771 | public function addNotification ( string $ action , $ context = null ) : self { $ this -> notifyHeap [ ] = new class ( $ action , $ context ) { public $ action ; public $ context ; public function __construct ( $ action , $ context ) { $ this -> action = $ action ; $ this -> context = $ context ; } } ; if ( count ( $ t... | Add a new notification to the list of notification to send . If there is only one notification into the list it will be send now . Else a notification is currently sent so we wait it finish and the current notification will be sent . |
10,772 | public static function create ( array $ config = [ ] ) { $ config = self :: mergeDefaults ( $ config ) ; $ metricFactory = new MetricFactory ( $ config [ 'default_tags' ] , $ config [ 'prefix' ] ) ; $ eventFactory = new EventFactory ( $ config [ 'hostname' ] ) ; $ logger = $ config [ 'logger' ] [ 'instance' ] instanceo... | Creates a monitor in a single command by passing a configuration |
10,773 | protected function operatorName ( $ operator ) { if ( isset ( $ this -> _operatorNames [ $ operator ] ) ) { return $ this -> _operatorNames [ $ operator ] ; } return strtolower ( $ operator ) ; } | Try to find a nice operator name . |
10,774 | public static function container ( bool $ skipLocatingExternal = false ) : ContainerInterface { if ( isset ( static :: $ externalContainer ) ) { return static :: $ externalContainer ; } if ( isset ( static :: $ internalContainer ) ) { return static :: $ internalContainer ; } if ( ! $ skipLocatingExternal && ( $ contain... | Get the external or internal dependency injection container . |
10,775 | public static function locateExternalContainer ( ) { if ( ! empty ( $ GLOBALS [ 'app' ] ) ) { $ app = $ GLOBALS [ 'app' ] ; if ( method_exists ( $ app , 'getContainer' ) ) { $ container = $ app -> getContainer ( ) ; if ( $ container instanceof ContainerInterface ) { return $ container ; } } } return null ; } | Try finding an external container . |
10,776 | public static function injectExternalContainer ( ContainerInterface $ container , string $ setMethod = '' ) { if ( static :: $ externalContainer ) { throw new ContainerLogicException ( 'Can\'t inject external container when external container already exists.' ) ; } if ( static :: $ internalContainer ) { throw new Conta... | Inject external dependency injection container and tell that that s the container that ll be used from now on . |
10,777 | public static function genericSetMultiple ( array $ values ) { $ container = static :: container ( ) ; foreach ( $ values as $ id => $ value ) { $ container -> { static :: $ setMethod } ( $ id , $ value ) ; } } | Set multiple items in the container disregarding the name of the setter method . |
10,778 | public static function genericKeys ( ) : array { if ( static :: $ externalContainer ) { $ container = static :: $ externalContainer ; if ( method_exists ( $ container , 'keys' ) ) { return $ container -> keys ( ) ; } if ( method_exists ( $ container , 'getKnownEntryNames' ) ) { return $ container -> getKnownEntryNames ... | Get list of registered IDs . |
10,779 | public function set ( $ id , $ value ) { if ( isset ( $ this -> requested [ $ id ] ) ) { throw new ContainerRuntimeException ( 'Container identifier[' . $ id . '] is already set and has been requested.' ) ; } if ( is_callable ( $ value ) ) { $ this -> callables [ $ id ] = $ value ; } else { $ this -> values [ $ id ] = ... | Beware that arg value as string will be considered a callable if that string value matches a declared function . |
10,780 | public static function postInstall ( Event $ event ) { if ( ! file_exists ( 'build.xml' ) ) { $ event -> getIO ( ) -> write ( 'build.xml does not exist, creating template' ) ; symlink ( 'vendor/3ev/phingy/scripts/build.xml' , 'build.xml' ) ; } else { $ event -> getIO ( ) -> write ( 'build.xml exists, template not neede... | Create template build files if they don t exist . |
10,781 | public function render ( ) { $ flashMessages = $ this -> controllerContext -> getFlashMessageContainer ( ) -> getMessagesAndFlush ( ) ; if ( count ( $ flashMessages ) > 0 ) { $ tagContent = '' ; foreach ( $ flashMessages as $ singleFlashMessage ) { $ severity = 'alert-info' ; switch ( $ singleFlashMessage -> getSeverit... | Render method . |
10,782 | public function columnCount ( ) { $ maxCol = 0 ; foreach ( $ this -> _layout as $ row => $ items ) { foreach ( $ items as $ column => $ item ) { $ maxCol = max ( $ column , $ maxCol ) ; } } return $ maxCol ; } | Returns the amount of columns . |
10,783 | protected function collectItems ( ) { $ items = [ ] ; foreach ( $ this -> _layout as $ row => $ unused ) { foreach ( $ this -> _layout [ $ row ] as $ column => $ item ) { $ items [ ] = $ item ; } } return $ items ; } | Collects all items . |
10,784 | public function pushMessages ( $ targetType , array $ messages , $ requestId = null , $ campaignKey = null ) { $ data = [ 'request_id' => $ requestId , 'campaign_key' => $ campaignKey , 'target_type' => $ targetType , 'messages' => $ messages , ] ; $ options = [ 'auth' => [ $ this -> apiKey , $ this -> apiSecret , ] , ... | Send one or many push notification messages . |
10,785 | public function pushMessage ( $ targetType , array $ message , $ requestId = null , $ campaignKey = null ) { return $ this -> pushMessages ( $ targetType , [ $ message ] , $ requestId , $ campaignKey ) ; } | Send a single push notification message . |
10,786 | public static function run_transaction ( Transaction $ transaction ) { ob_start ( ) ; echo date ( '[r] ' ) . 'Running ' . $ transaction -> classname . ' - ' . $ transaction -> id . "\n" ; $ failed = false ; try { $ transaction -> run ( ) ; } catch ( \ Throwable $ e ) { $ failed = true ; } catch ( \ Exception $ e ) { $ ... | Run transaction acquire one if none set |
10,787 | public function end ( ) { $ endTime = microtime ( true ) ; $ this -> value = ( int ) round ( ( $ endTime - $ this -> startTime ) * self :: MILLISECONDS_IN_A_SECOND ) ; return $ this ; } | Ends the timer |
10,788 | public function setLogFile ( $ logFile ) { if ( strpos ( $ logFile , '://' ) === false ) { if ( ! GeneralUtility :: isAbsPath ( $ logFile ) ) { $ logFile = PATH_site . $ logFile ; } } $ this -> logFile = $ logFile ; $ this -> openLogFile ( ) ; return $ this ; } | Sets the path to the log file . |
10,789 | public function changelog ( $ fromRef , $ toRef = 'HEAD' , $ format = self :: LOG_FORMAT_CHANGELOG ) { $ result = $ this -> command . ' log ' . $ fromRef . '..' . $ toRef . ' ' . $ format ; return $ result ; } | Generate a changelog between two versions |
10,790 | public function setSource ( string $ source ) { if ( ! file_exists ( $ source ) ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "The source $source for the ZIP archive does not exist." , "Please check the source validity." ) ) ) ; } $ this -> source = $ source ; } | Set source path |
10,791 | public function recursiveCompress ( ) : bool { if ( $ this -> source == null ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "The source must be not null." , "Please add source path." ) ) ) ; } if ( $ this -> name == null ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "The archive... | Compress source dir to zip |
10,792 | public static function inContainer ( ) : bool { if ( file_exists ( self :: CGROUP_FILE ) && ( $ content = file_get_contents ( self :: CGROUP_FILE ) ) && preg_match ( self :: CGROUP_PATTERN , $ content ) ) { return true ; } return false ; } | Determine if run in container |
10,793 | final public static function getInfo ( string $ infoname ) : string { $ rs = 'none' ; $ edition = FrameworkTools :: getEditionInfo ( ) ; switch ( $ infoname ) { case 'CORE_VERSION' : $ rs = self :: CORE_VERSION ; break ; case 'CORE_BUILD' : $ rs = self :: CORE_BUILD ; break ; case 'CORE_STAGE' : $ rs = self :: CORE_STA... | Get info about iumio framework |
10,794 | public function getComparisons ( ) { $ comparisons = array ( ) ; foreach ( $ this -> set -> group -> compareWith as $ name ) { $ benchmark = $ this -> set -> benchmarks [ $ name ] ; $ comparisons [ $ name ] = new Comparison ( $ this -> getAverage ( ) , $ benchmark -> getAverage ( ) ) ; } return $ comparisons ; } | Get an array of comparisons with |
10,795 | public function loadFile ( Asset $ asset , ? bool $ mode ) : string { $ filePath = $ this -> getFilePath ( $ asset ) ; if ( ! \ is_file ( $ filePath ) ) { throw new FileNotFoundException ( sprintf ( "Asset '%s' not found at '%s'." , $ asset -> getAssetPath ( ) , $ filePath ) ) ; } $ fileContent = \ file_get_contents ( ... | Loads an asset s file content |
10,796 | private function parse ( array $ data ) { $ schemaId = SchemaId :: fromString ( $ data [ 'id' ] ) ; $ parameters = [ 'deprecated' => isset ( $ data [ 'deprecated' ] ) && $ data [ 'deprecated' ] , ] ; if ( isset ( $ data [ 'extends' ] ) ) { if ( $ data [ 'extends' ] == $ schemaId -> getCurieWithMajorRev ( ) ) { throw ne... | Builds a Schema instance from a given set of data . |
10,797 | public function getConfigByFilename ( string $ filename ) { if ( ! isset ( $ this -> config [ $ filename ] ) ) { throw new Exception ( 'The file ' . $ filename . ' has not been found' , $ this :: ERR_FILE_NOT_FOUND ) ; } return $ this -> config [ $ filename ] ; } | Getter accessor to have all values contain into a config file |
10,798 | public function loadFiles ( ) { $ this -> searchAllConfigFiles ( $ this -> configDir ) ; foreach ( $ this -> configFiles as $ fileKey => $ filePath ) { $ this -> loadConfigFile ( $ fileKey , $ filePath ) ; } } | Search and load all config files which has been found |
10,799 | protected function loadConfigFile ( string $ fileKey , string $ filePath ) { $ fileExtension = pathinfo ( $ filePath , PATHINFO_EXTENSION ) ; if ( $ fileExtension === 'json' ) { $ this -> loadJsonConfigFile ( $ fileKey , $ filePath ) ; return ; } if ( $ fileExtension === 'php' ) { $ this -> loadPhpConfigFile ( $ fileKe... | Load a config file . Find the file s extension and call the method to parse the file |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.