idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
16,000 | public function withPort ( $ port ) { $ url = clone $ this ; $ url -> port = $ port ; $ url -> hash = null ; return $ url ; } | Create a new instance with the specified port . |
16,001 | public function withQuery ( $ query ) { $ url = clone $ this ; $ url -> query = $ query ; $ url -> hash = null ; return $ url ; } | Create a new instance with the specified query string . |
16,002 | public static function registerApplicationPlugin ( ApplicationPlugin $ plugin , $ priority = self :: PRIORITY_NORMAL ) { if ( $ priority != self :: PRIORITY_HIGH && $ priority != self :: PRIORITY_NORMAL && $ priority != self :: PRIORITY_LOW ) { throw new ArchException ( 'Bad plugin priority' ) ; } $ pluginClass = get_c... | Register a MVC plugin |
16,003 | public static function getApplicationPlugin ( $ pluginClass ) { return isset ( self :: $ plugins [ $ pluginClass ] ) ? self :: $ plugins [ $ pluginClass ] : null ; } | Get a registered plugin by class name |
16,004 | public static function handleApplicationPlugins ( $ step ) { foreach ( self :: $ pluginsOrder as $ plugins ) { foreach ( $ plugins as $ pluginClass ) { self :: $ plugins [ $ pluginClass ] -> $ step ( ) ; } } } | Used in Application core please do not touch |
16,005 | public function findLimited ( $ limit = 0 ) { $ queryBuilder = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.enabled = :enabled' ) -> orderBy ( 'c.position' ) -> setParameters ( array ( 'enabled' => true , ) ) ; if ( $ limit != 0 ) { $ queryBuilder -> setMaxResults ( $ limit ) ; } return $ queryBuilder -> getQuery... | Return a list of carousel items |
16,006 | public function codeString ( array $ task , $ full = true ) { return $ this -> _isCli || ( ! $ task [ 'code_string' ] ) ? $ task [ 'code_string' ] : $ this -> Html -> tag ( 'span' , $ this -> _text ( $ task [ 'code_string' ] , $ full ? 0 : Configure :: read ( 'Task.truncateCode' ) , true ) , array ( 'class' => 'label l... | String return code |
16,007 | public function waiting ( array $ tasks , $ full = true ) { $ formattedTasks = $ this -> _formatWaiting ( $ tasks , true ) ; $ tasksCount = count ( $ formattedTasks ) ; if ( $ tasksCount === 0 ) { return $ this -> _none ( ) ; } if ( $ this -> _isCli ) { return implode ( ', ' , $ formattedTasks ) ; } elseif ( $ full ) {... | Waiting for tasks |
16,008 | public function statistics ( array $ statistics ) { if ( $ this -> _isCli ) { return $ this -> _none ( 'Not allowed in cli' ) ; } if ( ! $ this -> settings [ 'chartEnabled' ] ) { return $ this -> _none ( 'Please install <b>imsamurai/cakephp-google-chart</b> plugin to view graph' ) ; } if ( empty ( $ statistics ) ) { re... | Make statistics graph |
16,009 | protected function _formatWaiting ( array $ tasks , $ plain ) { $ dependsOnTaskFormatted = array ( ) ; foreach ( $ tasks as $ task ) { if ( ! in_array ( ( int ) $ task [ 'status' ] , array ( TaskType :: DEFFERED , TaskType :: RUNNING , TaskType :: STOPPING , TaskType :: UNSTARTED ) ) ) { continue ; } $ dependsOnTaskFor... | Waiting tasks formatter |
16,010 | protected function _dateDiff ( $ start = null , $ stop = null ) { if ( $ start ) { $ endDate = $ stop instanceof DateTime ? $ stop : new DateTime ( $ stop ? $ stop : 'now' ) ; $ startDate = $ start instanceof DateTime ? $ start : new DateTime ( $ start ) ; $ diff = $ startDate -> diff ( $ endDate ) -> format ( Configur... | Date diff formatter |
16,011 | public static function get ( $ uri , $ callback , $ params = [ ] ) { if ( is_string ( $ callback ) ) { $ callback = self :: str2closure ( $ callback ) ; } $ middlewares = array_merge ( self :: middlewaresByParams ( $ params ) , self :: middlewaresByParams ( self :: $ group_params ) ) ; self :: $ routes [ ] = new Route ... | set get route |
16,012 | private static function str2closure ( $ controllerAction ) { list ( $ controller , $ action ) = explode ( '@' , $ controllerAction ) ; return function ( $ request ) use ( $ controller , $ action ) { $ c = new $ controller ; return call_user_func ( [ $ c , $ action ] , $ request ) ; } ; } | convert string to closure |
16,013 | public function get ( $ key , $ default = null ) { if ( isset ( $ this -> data [ $ key ] ) ) { return $ this -> data [ $ key ] ; } return isset ( $ this -> session [ $ key ] ) ? $ this -> session [ $ key ] : $ default ; } | Retrive a value |
16,014 | public function load ( $ key , Clovers $ callback ) { if ( ! $ this -> has ( $ key ) ) { $ this -> set ( $ key , $ callback ( $ key ) ) ; } return $ this -> get ( $ key ) ; } | Retrive the value associated with the specified key or associate the specified key with the value returned by invoking the callback . |
16,015 | public function handle ( $ framework_file , ImageConfiguration $ config , array $ optional_data = [ ] ) { $ image_file = $ this -> prepareImageFile ( $ framework_file ) ; $ response = $ this -> validator -> validate ( $ image_file , $ config -> rules ) ; if ( $ response -> success ( ) ) { if ( $ record = $ this -> imag... | Handle Image Upload |
16,016 | protected function createChild ( $ key ) { $ relation = $ this -> getValueOrRelationForKey ( $ key ) ; if ( ! $ relation instanceof Relation ) { return $ relation ; } $ this -> supportedRelationOrThrow ( $ key , $ relation ) ; $ model = Rel :: make ( $ relation ) -> getChild ( ) ; if ( ! $ this -> isEloquentObject ( $ ... | Caches a relation for later use . Creates a new model in case of empty values . |
16,017 | public function clans ( $ param , $ members = false ) { if ( is_array ( $ param ) ) { return $ this -> _clansByFilter ( $ param ) ; } else if ( $ members ) { return $ this -> _clansMembersOnly ( $ param ) ; } return $ this -> _clanById ( $ param ) ; } | Search for clans by different approaches . |
16,018 | private function _clansMembersOnly ( string $ param ) : array { $ curlClient = curl_init ( self :: BASE_URL . self :: CLANS_URL . '/' . \ urlencode ( $ param ) . '/members' ) ; curl_setopt ( $ curlClient , CURLOPT_HTTPHEADER , $ this -> _curlHeader ) ; curl_setopt ( $ curlClient , CURLOPT_RETURNTRANSFER , true ) ; $ re... | Search for clan members only of a specific clan |
16,019 | private function _clanById ( string $ param ) : Clan { $ curlClient = curl_init ( self :: BASE_URL . self :: CLANS_URL . '/' . \ urlencode ( $ param ) ) ; curl_setopt ( $ curlClient , CURLOPT_HTTPHEADER , $ this -> _curlHeader ) ; curl_setopt ( $ curlClient , CURLOPT_RETURNTRANSFER , true ) ; $ result = json_decode ( c... | Retrieves the clan who matches the given id |
16,020 | private function _clansByFilter ( array $ params ) : array { $ url = self :: BASE_URL . self :: CLANS_URL . '?' ; $ url .= http_build_query ( $ params ) ; $ curlClient = curl_init ( $ url ) ; curl_setopt ( $ curlClient , CURLOPT_HTTPHEADER , $ this -> _curlHeader ) ; curl_setopt ( $ curlClient , CURLOPT_RETURNTRANSFER ... | Retrieves a list of clans who matches a set of filters |
16,021 | private function _locationsById ( int $ id ) : Location { $ curlClient = curl_init ( self :: BASE_URL . self :: LOCATIONS_URL . '/' . $ id ) ; curl_setopt ( $ curlClient , CURLOPT_HTTPHEADER , $ this -> _curlHeader ) ; curl_setopt ( $ curlClient , CURLOPT_RETURNTRANSFER , true ) ; $ result = json_decode ( curl_exec ( $... | Returns a location with the given id |
16,022 | private function _locationsByIdAndRank ( int $ id , $ rank ) { $ curlClient = curl_init ( self :: BASE_URL . self :: LOCATIONS_URL . '/' . $ id . '/rankings/' . $ rank ) ; curl_setopt ( $ curlClient , CURLOPT_HTTPHEADER , $ this -> _curlHeader ) ; curl_setopt ( $ curlClient , CURLOPT_RETURNTRANSFER , true ) ; $ results... | Based on a Location retrieve the local rankings |
16,023 | public function load ( $ resource , $ type = null ) { $ path = $ this -> locator -> locate ( $ resource ) ; if ( ! stream_is_local ( $ path ) ) { throw new \ InvalidArgumentException ( sprintf ( 'This is not a local file "%s".' , $ path ) ) ; } if ( ! file_exists ( $ path ) ) { throw new \ InvalidArgumentException ( sp... | Loads and parses the given Yaml file into a PHP array . |
16,024 | public function getResponse ( ) { $ response = redirect ( ) -> to ( $ this -> getRedirectUrl ( ) ) ; $ response -> withInput ( $ this -> request -> input ( ) ) ; $ response -> withErrors ( $ this -> getErrors ( ) , 'default' ) ; $ response -> setCharset ( config ( 'app.charset' , 'UTF-8' ) ) ; return $ response ; } | Get the underlying response instance . |
16,025 | protected function getErrors ( ) { $ arr = [ 'error' => $ this -> getMessage ( ) ] ; if ( count ( $ this -> attrs ) > 0 ) { $ arr [ 'attrs' ] = $ this -> getAttrs ( ) ; } if ( count ( $ this -> attrsCustom ) > 0 ) { $ arr [ 'attrscustom' ] = $ this -> getAttrsCustom ( ) ; } return $ arr ; } | Array de erros . |
16,026 | public function GetSolutionDirectoryList ( \ Puzzlout \ Framework \ Core \ Application $ app ) { $ Cacher = \ Puzzlout \ Framework \ Core \ Cache \ BaseCache :: Init ( $ app -> config ) ; if ( ! $ Cacher -> KeyExists ( CacheKeys :: SOLUTION_FOLDERS ) ) { $ SolutionPathListArray = ArrayFilterDirectorySearch :: Init ( $ ... | Retrieves the solution directory list . It caches the result if not already done so that it retrieves it faster the next occurrences . |
16,027 | public function IsFolderMatchingFilter ( $ path , $ regexFilter ) { return \ Puzzlout \ Framework \ Helpers \ RegexHelper :: Init ( $ path ) -> IsMatch ( $ regexFilter ) ; } | Test to the path against the filter . |
16,028 | public function AddFolderPathToListItems ( $ key , $ path ) { array_push ( $ this -> ListItemArray , \ Puzzlout \ Framework \ BO \ ListItem :: Init ( $ key , $ path ) ) ; } | Add a ListItem object to the field ListItemArray . |
16,029 | protected function fixCommandDefinition ( BaseCommand $ command ) { $ definition = $ command -> getDefinition ( ) ; if ( ! $ definition -> hasOption ( 'verbose' ) ) { $ definition -> addOption ( new InputOption ( 'verbose' , 'v|vv|vvv' , InputOption :: VALUE_NONE , 'Shows more details including new commits pulled in wh... | Add missing definition options to the command usually defined by the application . |
16,030 | protected function attachComposerFactory ( BaseCommand $ command ) { if ( ! method_exists ( $ command , 'setComposerFactory' ) ) { throw new \ InvalidArgumentException ( 'The passed command does not implement method setComposerFactory()' ) ; } $ command -> setComposerFactory ( function ( ) { return Factory :: create ( ... | Attach the composer factory to the command . |
16,031 | protected function executeCommand ( BaseCommand $ command , InputInterface $ input , OutputInterface $ output ) { try { if ( 0 !== ( $ statusCode = $ command -> run ( $ input , $ output ) ) ) { throw new \ RuntimeException ( 'Error: command exit code was ' . $ statusCode ) ; } } catch ( \ Exception $ exception ) { thro... | Execute the command and throw exceptions on errors . |
16,032 | public function register ( string $ eventCode , callable $ listener ) { $ this -> assertValidEventCode ( $ eventCode ) ; if ( false === isset ( $ this -> eventListeners [ $ eventCode ] ) ) { $ this -> eventListeners [ $ eventCode ] = [ ] ; } $ this -> eventListeners [ $ eventCode ] [ ] = $ listener ; return $ this ; } | Register a listener for the given event code |
16,033 | public function dispatch ( string $ eventCode , EventInterface $ event ) { $ this -> assertValidEventCode ( $ eventCode ) ; if ( true === isset ( $ this -> eventListeners [ $ eventCode ] ) ) { foreach ( $ this -> eventListeners [ $ eventCode ] as $ listener ) { $ listener ( $ event ) ; } } return $ this ; } | Invoke all event listeners for the given event code |
16,034 | public function setStrictVariables ( bool $ isEnabled = true ) : self { if ( $ isEnabled ) { $ this -> twigEnvironment -> enableStrictVariables ( ) ; } else { $ this -> twigEnvironment -> disableStrictVariables ( ) ; } return $ this ; } | Sets whether strict variables should be enabled . |
16,035 | public function remove ( $ key ) { if ( ! is_string ( $ key ) && ! is_numeric ( $ key ) ) { throw new InvalidArgumentException ( 'Invalid key name given! Key config to remove must be as a string!' ) ; } if ( ! $ this -> exist ( $ key ) ) { return ; } if ( ( $ count = preg_match_all ( '/(?:^[^\[]+)|\[[^]]*\]/' , $ key ,... | Remove Key from nested selector |
16,036 | public function ready ( ) { if ( $ this -> ready ) { return $ this ; } $ this -> raw = @ file_get_contents ( $ this -> pathname ) ; if ( ! $ this -> raw ) { throw new AccessFileException ( $ this -> pathname , "Cannot ready resource '{$this->name}'" ) ; } try { $ data = Json :: parse ( $ this -> raw , true ) ; if ( ! i... | Load resource content data |
16,037 | public function hasType ( string $ type ) : bool { if ( substr ( $ type , 0 , 2 ) !== "#/" ) { $ type = "#/{$type}" ; } return $ this -> getType ( ) === $ type ; } | Compare resource type |
16,038 | public function sync ( ) { $ actionMap = $ this -> Guardian -> getActionMap ( ) ; $ groups = $ this -> GroupPermissions -> Groups -> find ( 'all' ) -> where ( [ 'Groups.id <>' => 1 ] ) ; $ connection = $ this -> GroupPermissions -> connection ( ) ; $ connection -> begin ( ) ; $ this -> GroupPermissions -> deleteAll ( [... | Sync action GET |
16,039 | public function update ( ) { if ( ! $ this -> request -> is ( 'post' ) ) { if ( $ this -> request -> is ( 'ajax' ) ) { throw new MethodNotAllowedException ( ) ; } else { $ this -> Flash -> error ( $ this -> invalidRequestMessage ) ; $ this -> redirect ( [ 'action' => 'index' ] ) ; return ; } } if ( empty ( $ this -> re... | Update action POST | AJAX |
16,040 | public static function run ( ) { $ run_migration = \ Cli :: option ( 'migrate' , \ Cli :: option ( 'm' , false ) ) ; $ run_validation = $ run_migration ? true : \ Cli :: option ( 'validate' , \ Cli :: option ( 'v' , false ) ) ; if ( ! $ run_migration and ! $ run_validation ) { return static :: help ( ) ; } $ validated ... | Show help . |
16,041 | public function type ( $ mapping_type ) { $ args = func_get_args ( ) ; $ mapping_type = array_shift ( $ args ) ; if ( empty ( $ args ) ) return $ this -> merge ( [ 'map.type' => $ mapping_type ] ) ; return $ this -> merge ( [ 'map.type' => $ mapping_type , 'map.params' => $ args ] ) ; } | Sets result mapping options |
16,042 | public function resultMap ( $ result_map ) { if ( ! is_string ( $ result_map ) ) { if ( is_object ( $ result_map ) ) $ result_map = get_class ( $ result_map ) ; else throw new \ InvalidArgumentException ( "Method 'resultMap' expects a string or valid a result map instance." ) ; } return $ this -> merge ( [ 'map.result'... | Sets the result map class to apply to obtained result |
16,043 | public function cache ( $ cache_key , $ cache_ttl = 0 ) { if ( ! is_string ( $ cache_key ) || empty ( $ cache_key ) ) throw new \ InvalidArgumentException ( "Cache key is not a valid string." ) ; if ( ! is_integer ( $ cache_ttl ) || $ cache_ttl < 0 ) throw new \ InvalidArgumentException ( "Cache TTL is not a valid inte... | Sets cache key and ttl |
16,044 | public static function get_by_name_short ( $ name ) { $ db = Database :: Get ( ) ; $ id = $ db -> get_one ( 'SELECT id FROM language WHERE name_short=?' , [ $ name ] ) ; if ( $ id === null ) { throw new \ Exception ( 'No such language' ) ; } $ language = self :: get_by_id ( $ id ) ; return $ language ; } | Get by name_short |
16,045 | protected function registerClassMap ( array $ classMap ) { foreach ( $ classMap as $ file ) { $ arrClasses = require $ file ; if ( ! ArrayUtils :: isHashTable ( $ arrClasses , true ) ) { throw new Exception \ RuntimeException ( 'Config autoload for classmap is invalid' ) ; } if ( ! empty ( $ arrClasses ) ) { $ this -> ... | Register class map |
16,046 | public function register ( ) { $ moduleHandler = $ this -> diFactory -> get ( 'moduleHandler' ) ; $ autoloadConf = $ moduleHandler -> getModulesAutoloadConfig ( ) ; if ( isset ( $ autoloadConf [ 'namespaces' ] ) ) { if ( ! ArrayUtils :: isHashTable ( $ autoloadConf [ 'namespaces' ] ) ) { throw new Exception \ RuntimeEx... | Auto register namespace and class map |
16,047 | public function header ( $ header = null ) { if ( $ this -> _status != null ) { array_push ( $ this -> _headers , $ header ) ; return true ; } else { return $ this -> _headers ; } } | add header to the stack get headers |
16,048 | public function status ( $ status = null ) { if ( $ status != null ) { if ( array_key_exists ( $ status , $ this -> _statusCode ) ) { $ this -> _status = $ status ; } return true ; } else { return $ this -> _status ; } } | set the status code . If you use 404 403 or 500 the framework will display an error page get the status code |
16,049 | public function contentType ( $ contentType = null ) { if ( $ contentType != null ) { $ this -> _contentType = $ contentType ; return true ; } else { return $ this -> _contentType ; } } | set Content - Type without Content - Type get Content - Type |
16,050 | public function run ( ) { header ( 'Content-Type: ' . $ this -> _contentType ) ; if ( $ this -> _status != 200 ) { http_response_code ( $ this -> _status ) ; } if ( array_key_exists ( $ this -> _status , $ this -> _statusErrorPage ) ) { $ tpl = new Template ( $ this -> _statusErrorPage [ $ this -> _status ] , $ this ->... | execute all the headers |
16,051 | public function page ( $ page = null ) { if ( $ page != null ) { $ this -> _page = $ page ; return true ; } else { return $ this -> _page ; } } | return the page content |
16,052 | private function register ( EntityFactoryInterface $ factory ) : self { $ this -> mapping = $ this -> mapping -> put ( get_class ( $ factory ) , $ factory ) ; return $ this ; } | Register the given entity factory instance |
16,053 | public static function checkComposerVersion ( Event $ event ) { $ composer = $ event -> getComposer ( ) ; $ io = $ event -> getIO ( ) ; $ version = $ composer :: VERSION ; if ( $ version === '@package_version@' ) { $ io -> writeError ( '<warning>You are running a development version of Composer. If you experience probl... | Checks if the installed version of Composer is compatible . |
16,054 | public function toPrivateArray ( ) { return array ( 'number' => $ this -> getNumber ( ) , 'holder_name' => $ this -> getHolderName ( ) , 'expiration_year' => $ this -> getExpirationYear ( ) , 'expiration_month' => $ this -> getExpirationMonth ( ) , 'security_code' => $ this -> getSecurityCode ( ) , ) ; } | Returns only private properties that must be encrypted before sending |
16,055 | public function set ( $ key , $ value ) { if ( ! $ value instanceof EmitterInterface ) { throw new InvalidArgumentException ( "Only EmitterInterface object can be putted in a " . "EmittersMap." ) ; } return parent :: set ( $ key , $ value ) ; } | Puts a new emitter in the map . |
16,056 | public function loadConfig ( $ file ) { if ( file_exists ( $ file ) ) { $ config = include $ file ; $ driver = $ config [ 'driver' ] ; if ( $ driver == 'file' ) { $ session = new \ Wudimei \ Session \ File ( $ config ) ; } $ this -> session = $ session ; } else { throw new \ Exception ( 'sesstion config file "' . $ fil... | load config array from file |
16,057 | private function getFactoryForType ( $ taskType ) { foreach ( $ this -> factories as $ factory ) { if ( $ factory -> isTypeSupported ( $ taskType ) ) { return $ factory ; } } return null ; } | Search the factory that can handle the type . |
16,058 | public function retrieveByID ( $ identifier ) { $ user = $ this -> conn -> { $ this -> table } -> findOne ( array ( '_id' => new \ MongoId ( $ identifier ) ) ) ; if ( ! is_null ( $ user ) ) { return new MongolUser ( ( array ) $ user ) ; } } | Retrieve a user by their unique idenetifier . |
16,059 | protected function model ( $ class = false ) { if ( $ class !== false ) { return app ( $ class ) ; } if ( ! is_null ( $ this -> model ) ) { return $ this -> model ; } return $ this -> model = app ( $ this -> modelName ) ; } | Create model . |
16,060 | public function fetch ( $ url ) { $ SHDObject = $ this -> getSHDWrapper ( $ url ) ; $ urls = $ this -> getPageUrls ( $ SHDObject ) ; $ titles = $ this -> getPageTitles ( $ SHDObject ) ; $ snippets = $ this -> getPageSnippets ( $ SHDObject ) ; return array ( 'urls' => $ urls , 'titles' => $ titles , 'snippets' => $ snip... | Get a multidimensional array with urls titles and snippets for a given SERP url . |
16,061 | public function cacheHit ( $ url ) { $ file = FileSystemHelper :: getCachedEntry ( $ url , $ this -> getCacheDir ( ) ) ; return $ this -> isCaching ( ) && FileSystemHelper :: cacheEntryExists ( $ file ) && FileSystemHelper :: validateCache ( $ file , $ this -> getCacheTTL ( ) , $ this -> isCachingForever ( ) ) ; } | Check if cache should be hit for a given url request . |
16,062 | public function setCacheDir ( $ dir ) { if ( GenericValidator :: validateDirName ( $ dir ) ) { $ this -> cacheDir = $ dir ; FileSystemHelper :: setUpDir ( $ dir ) ; return true ; } return false ; } | Set the path to the cache folder . |
16,063 | public function setCacheTTL ( $ hours ) { if ( GenericValidator :: validateExpirationTime ( $ hours ) ) { $ this -> cacheTTL = $ hours ; return true ; } return false ; } | Set the cache duration expressed in hours . |
16,064 | public function enableCaching ( ) { if ( FileSystemHelper :: folderExists ( $ this -> getCacheDir ( ) ) ) { $ this -> caching = true ; return true ; } return false ; } | Turn caching on . Prevent turning caching on if the cache folder hasn t been yet created . |
16,065 | public function setCharset ( $ charset ) { if ( GenericValidator :: validateCharset ( $ charset ) ) { $ this -> charset = $ charset ; return true ; } return false ; } | Set the charset used by the SimpleHtmlDom object . |
16,066 | protected function cleanText ( $ text ) { $ strippedText = strip_tags ( $ text ) ; $ strippedText = htmlentities ( $ strippedText , ENT_QUOTES , $ this -> getCharset ( ) , FALSE ) ; return html_entity_decode ( $ strippedText , ENT_QUOTES , $ this -> getCharset ( ) ) ; } | Extract textual data from fetched raw html text . |
16,067 | protected function normalizeResult ( $ resultArray ) { $ countArr = count ( $ resultArray ) ; if ( $ countArr > 10 ) { $ resultArray = array_slice ( $ resultArray , 0 , 10 ) ; } else if ( $ countArr < 10 ) { for ( $ i = $ countArr ; $ i < self :: DEFAULT_RESULT_NUMBER ; $ i ++ ) $ resultArray [ $ i ] = self :: DEFAULT_... | Normalize result array by slicing it or by adding padding . |
16,068 | public function protectedLink ( $ title , $ url , $ options = [ ] , $ displayLinkTextIfUnauthorized = false ) { $ url = $ this -> _getUrl ( $ url ) ; if ( ! guardian ( ) -> hasAccess ( $ url ) ) { if ( $ displayLinkTextIfUnauthorized ) { return $ title ; } return '' ; } return $ this -> link ( $ title , $ url , $ optio... | Create a properly prefixed backend link . |
16,069 | public function unprotectedLink ( $ title , $ url , $ options = [ ] ) { $ url = $ this -> _getUrl ( $ url ) ; return $ this -> link ( $ title , $ url , $ options ) ; } | Create a properly prefixed backend link and don t check permissions . |
16,070 | public function protectedConfirmationLink ( $ title , $ url , $ options , $ displayLinkTextIfUnauthorized = false ) { if ( ! isset ( $ options [ 'confirm-message' ] ) ) { user_error ( '\'confirm-message\' option is not set on protectedConfirmationLink.' ) ; $ options [ 'confirm-message' ] = '' ; } if ( ! isset ( $ opti... | Create a backend confirmation link . |
16,071 | public static function convert ( string $ input , int $ to ) : string { $ string = self :: normalize ( $ input ) ; $ parts = explode ( ' ' , $ string ) ; array_walk ( $ parts , function ( & $ part ) { $ part = ucfirst ( $ part ) ; } ) ; switch ( $ to ) { case self :: TYPE_NAMESPACE : return implode ( '\\' , $ parts ) ;... | Convert input string to a different format . |
16,072 | public function setTemplate ( $ name , $ path ) { if ( ! isset ( $ this -> templates [ $ name ] ) ) { throw new UnexpectedValueException ( sprintf ( 'Unexpected template name "%s" provided.' , is_string ( $ name ) ? $ name : gettype ( $ name ) ) ) ; } $ finfo = new SplFileInfo ( $ path ) ; $ realPath = $ finfo -> getRe... | Sets template . |
16,073 | public function get ( $ abstract , $ args = [ ] ) { if ( $ this -> has ( $ abstract ) ) { return $ this -> retrieve ( $ this -> container , $ abstract , $ args ) ; } throw new Exceptions \ NotFoundException ( "Abstract '{$abstract}' not found." ) ; } | Invokes the registered entry for an abstract and returns the result . |
16,074 | private function retrieve ( & $ from , $ abstract , $ args = [ ] ) { $ entry = $ from [ $ abstract ] ; if ( is_object ( $ entry ) && ( $ entry instanceof \ Closure ) ) { return $ this -> invoke ( $ entry , $ args ) ; } return $ entry ; } | Helper method to retrieve an existing entry from a given library array . You have to find sure that the entry exists in the library . |
16,075 | public function make ( $ concrete , array $ args = [ ] ) { if ( ! is_object ( $ concrete ) && ! is_scalar ( $ concrete ) && ! is_null ( $ concrete ) ) { throw new Exceptions \ InvalidArgumentException ( ) ; } $ reflection = new \ ReflectionClass ( $ concrete ) ; $ constructor = $ reflection -> getConstructor ( ) ; $ ar... | Make a new instance of a concrete using Dependency Injection . |
16,076 | public function invoke ( Callable $ callable , array $ args = [ ] ) { if ( is_string ( $ callable ) && false !== strpos ( $ callable , '::' ) ) { $ callable = explode ( '::' , $ callable ) ; } if ( is_array ( $ callable ) ) { $ reflection = new \ ReflectionMethod ( $ callable [ 0 ] , $ callable [ 1 ] ) ; } if ( ! isset... | Invoke the given Closure with DI . |
16,077 | protected function inject ( \ ReflectionFunctionAbstract $ reflection , array $ args = [ ] ) { $ parameters = $ reflection -> getParameters ( ) ; $ arguments = [ ] ; foreach ( $ parameters as $ parameter ) { $ class = $ parameter -> getClass ( ) ; $ key = $ class && isset ( $ args [ $ class -> name ] ) ? $ class -> nam... | Performs the actual injection of dependencies from a reflection |
16,078 | public static function createService ( Application $ app , $ serviceName , $ pathName , $ optionsName ) { $ app [ $ optionsName ] = array ( ) ; $ app [ $ serviceName ] = $ app -> share ( function ( ) use ( $ app , $ serviceName , $ pathName , $ optionsName ) { $ app [ $ optionsName ] = array_merge ( array ( 'cache_path... | Creates a Wisdom service provider . |
16,079 | public function pipe ( ExecutableInterface $ process , $ _ = null ) { foreach ( func_get_args ( ) as $ index => $ process ) { if ( $ process instanceof ExecutableInterface ) { $ this -> processes [ ] = $ process ; } else { $ message = 'Argument ' . $ index . ' passed to ' . __METHOD__ . '() must implement interface ' .... | Adds one or more process to the pipe |
16,080 | public static function make_assoc ( $ columns , $ array ) { $ assoc = array ( ) ; $ cursor = 0 ; foreach ( $ array as $ record ) { foreach ( $ record as $ key => $ value ) { $ assoc [ $ cursor ] [ $ columns [ $ key ] ] = $ value ; } $ cursor ++ ; } return $ assoc ; } | Convert an array into an associative array |
16,081 | public static function group_concat ( $ data , $ column , $ strings = false , $ quotes = '\'' ) { if ( is_string ( $ column ) ) { $ column = array ( $ column ) ; } $ return = array ( ) ; foreach ( $ column as $ col ) { $ return [ $ col ] = ( $ strings ? $ quotes : '' ) ; } foreach ( $ data as $ row ) { foreach ( $ colu... | emulate the MySql group concat function for a result set |
16,082 | public static function value_to_key ( $ data , $ column ) { $ return = array ( ) ; foreach ( $ data as $ key => $ val ) { if ( is_object ( $ val ) ) { $ return [ $ val -> $ column ] = $ val ; } else { $ return [ $ val [ $ column ] ] = $ val ; } } return $ return ; } | column of array to key |
16,083 | public function filter ( $ value ) { if ( ! is_scalar ( $ value ) ) { return $ value ; } $ value = ( string ) $ value ; $ defaultScheme = $ this -> defaultScheme ? : $ this -> enforcedScheme ; if ( ! UriFactory :: getRegisteredSchemeClass ( $ defaultScheme ) ) { $ defaultScheme = null ; } try { $ uri = UriFactory :: fa... | Filter the URL by normalizing it and applying a default scheme if set |
16,084 | protected function enforceScheme ( Uri $ uri ) { $ path = $ uri -> getPath ( ) ; if ( strpos ( $ path , '/' ) !== false ) { list ( $ host , $ path ) = explode ( '/' , $ path , 2 ) ; $ path = '/' . $ path ; } else { $ host = $ path ; $ path = '' ; } if ( ! $ host ) { return ; } $ uri -> setScheme ( $ this -> enforcedSch... | Enforce the defined scheme on the URI |
16,085 | public function insert ( & $ data , array $ options = array ( ) ) { $ document = new Document ( $ data , $ this ) ; $ insert = $ document -> insert ( $ options ) ; $ data = $ document -> data ; return $ insert ; } | Insert new document |
16,086 | public function findAndModify ( array $ query , array $ update = array ( ) , array $ fields = null , array $ options = array ( ) ) { $ document = new Document ( $ query , $ this ) ; $ findAndModify = $ document -> findAndModify ( $ update , $ fields , $ options ) ; return $ findAndModify ; } | Find and Modify Document |
16,087 | public function getShort ( $ full ) { if ( strpos ( $ full , '*' ) !== false ) { return $ this -> schema_index [ substr ( $ full , 0 , - 2 ) ] . '.*' ; } if ( isset ( $ this -> schema [ $ full ] [ 'short' ] ) ) { return $ this -> schema [ $ full ] [ 'short' ] ; } return $ full ; } | Get short definitions based on full key |
16,088 | public static function create ( Request $ request , Response $ response = null , Exception $ previous = null ) { if ( ! $ response ) { return new self ( 'Error completing request' , $ request , null , $ previous ) ; } $ code = $ response -> getStatusCode ( ) ; switch ( $ code [ 0 ] ) { case '4' : $ message = 'Client Er... | Creates a new exception based on input data |
16,089 | public function getScalarRecords ( SimpleXMLElement $ element , $ asArray = true ) { $ data = [ ] ; if ( $ element -> count ( ) ) { foreach ( $ element -> children ( ) as $ name => $ property ) { if ( ! $ property -> count ( ) ) { $ data [ $ name ] = ( string ) $ property ; } } return $ data ; } elseif ( $ asArray ) { ... | Get all the Scalar records in the current element . Ignore all nested data . The XPaths should be used to include this data . |
16,090 | public function parse ( ) { if ( ! count ( $ this -> xPaths ) ) { return [ [ ] ] ; } $ xPaths = $ this -> xPaths ; return $ this -> parseXPath ( $ xPaths , $ this -> xml ) ; } | Start the Fusing process Using the XPaths try to merge nested data with child data recursively |
16,091 | public function setAttribs ( array $ aAttribs ) { if ( ! isset ( $ aAttribs [ 'method' ] ) ) $ aAttribs [ 'method' ] = 'POST' ; $ aAttribs [ 'class' ] = isset ( $ aAttribs [ 'class' ] ) ? $ aAttribs [ 'class' ] . ' sked-form' : 'sked-form' ; $ this -> aAttribs = $ aAttribs ; return $ this ; } | Set the HTML element attributes . |
16,092 | public function setSkeVent ( $ skeVent ) { if ( is_array ( $ skeVent ) ) $ skeVent = new SkeVent ( $ skeVent ) ; $ this -> skeVent = $ skeVent ; return $ this ; } | Save event object for populating defaults . |
16,093 | public function inputs ( ) { $ aReturn = [ ] ; foreach ( $ this -> getFieldDefinitions ( ) as $ strFieldName => $ aField ) { $ skeFormInput = new SkeFormInput ( $ strFieldName , $ aField [ 'type' ] ?? 'text' , $ aField [ 'options' ] ?? [ ] , $ aField [ 'attribs' ] ?? [ ] ) ; if ( $ this -> skeVent ) { $ skeFormInput ->... | Get inputs for SkeVent form . |
16,094 | public function checkPassword ( ) : bool { if ( ! isset ( $ this -> regex ) ) { return true ; } return filter_var ( $ this -> password , FILTER_VALIDATE_REGEXP , [ 'options' => [ 'regexp' => $ this -> regex ] ] ) ; } | Checks the password agains the set regex and returns the boolean result of this check |
16,095 | public function get_data ( $ priority = null ) { if ( $ priority === null ) { return $ this -> data ; } if ( isset ( $ this -> data [ $ priority ] ) ) { return $ this -> data [ $ priority ] ; } return [ ] ; } | Return all data for the hook . |
16,096 | private function generate_hook_info ( $ type , $ reflector , $ args ) { $ output = [ 'type' => $ type , 'file_name' => $ reflector -> getFileName ( ) , 'line_number' => $ reflector -> getStartLine ( ) , 'class' => null , 'name' => null , 'is_internal' => false , ] ; if ( $ reflector instanceof ReflectionMethod ) { $ ou... | Generate output for a hook callback . |
16,097 | protected function extractMessagesForDisplay ( & $ messages ) { $ output = [ ] ; if ( empty ( $ messages ) || count ( $ messages ) == 0 ) { return $ output ; } foreach ( $ messages as $ current ) { $ message_entry [ "message" ] = $ current [ "message" ] ; if ( ! empty ( $ current [ "code" ] ) ) { $ message_entry [ "cod... | This is internal auxiliary function for preparing messags for displaying . |
16,098 | public function getFocusElement ( ) { if ( empty ( self :: $ session_vars [ "focus_element" ] ) ) { return "" ; } $ felm = self :: $ session_vars [ "focus_element" ] ; unset ( self :: $ session_vars [ "focus_element" ] ) ; return $ felm ; } | Returns the element to be focused . |
16,099 | public function getActiveTab ( ) { if ( empty ( self :: $ session_vars [ "active_tab" ] ) ) { return "" ; } $ atab = self :: $ session_vars [ "active_tab" ] ; unset ( self :: $ session_vars [ "active_tab" ] ) ; return $ atab ; } | Returns the tab to be activated . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.