idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
55,800
public function getResult ( $ forObject ) { return isset ( $ this -> hash [ $ forObject ] ) ? $ this -> hash [ $ forObject ] : null ; }
Gets a result from the container for the given object . When getting results for a batch of requests provide the request object .
55,801
public function getSuccessful ( ) { $ results = [ ] ; foreach ( $ this -> hash as $ key ) { if ( ! ( $ this -> hash [ $ key ] instanceof \ Exception ) ) { $ results [ ] = $ this -> hash [ $ key ] ; } } return $ results ; }
Get an array of successful results .
55,802
public function getFailures ( ) { $ results = [ ] ; foreach ( $ this -> hash as $ key ) { if ( $ this -> hash [ $ key ] instanceof \ Exception ) { $ results [ ] = $ this -> hash [ $ key ] ; } } return $ results ; }
Get an array of failed results .
55,803
public function getIterator ( ) { $ results = [ ] ; foreach ( $ this -> hash as $ key ) { $ results [ ] = $ this -> hash [ $ key ] ; } return new \ ArrayIterator ( $ results ) ; }
Allows iteration over all batch result values .
55,804
public function offsetGet ( $ key ) { $ i = - 1 ; foreach ( $ this -> hash as $ obj ) { if ( $ key === ++ $ i ) { return $ this -> hash [ $ obj ] ; } } return null ; }
Allows access of the batch using a numerical array index .
55,805
protected function welcomeMessage ( ) { $ this -> comment ( '' ) ; $ this -> comment ( '**************************************************' ) ; $ this -> comment ( ' Welcome to HoneyComb CMS initial configuration!!!' ) ; $ this -> comment ( '**************************************************' ) ; $ this -> info ( '' ) ...
Shows welcome message
55,806
private function configureDatabase ( ) { $ this -> comment ( "Database configuration:" ) ; $ db [ 'host' ] = $ this -> choice ( "Database hostname: " , [ 'localhost' , 'custom' ] , 0 ) ; $ db [ 'name' ] = $ this -> ask ( "Database name: " ) ; $ db [ 'username' ] = $ this -> ask ( "Database username: " ) ; $ db [ 'passw...
Configure database settings
55,807
private function _connected ( array $ db ) { try { $ connection = mysqli_connect ( $ db [ 'host' ] , $ db [ 'username' ] , $ db [ 'password' ] , $ db [ 'name' ] ) ; return $ connection ? true : false ; } catch ( \ Exception $ e ) { return false ; } }
Checks if connected to db
55,808
private function configureMailSettings ( ) { $ this -> comment ( 'Configure mail driver settings' ) ; $ choice = $ this -> choice ( "Choose MAIL DRIVER. [log|mandrill|mailgun|sparkpost|set_up_later]" , [ 'log' , 'mailgun' , 'mandrill' , 'sparkpost' , 'set_up_later' ] , 0 ) ; switch ( $ choice ) { case 'log' : $ this ->...
Configure mail driver settings
55,809
private function _createEnvFile ( ) { $ fileName = '.env' ; $ content = "" ; foreach ( $ this -> envData as $ key => $ value ) $ content .= "$key=$value\n" ; $ path = base_path ( $ fileName ) ; if ( file_put_contents ( $ path , $ content ) ) return true ; return false ; }
Function which creates . env file
55,810
static function addPassword ( \ Db \ Connection $ db , User $ user , $ password ) { if ( ! $ user ) { throw new \ InvalidArgumentException ( "No user provided." ) ; } $ q = $ db -> prepare ( "SELECT * FROM user_passwords WHERE user_id=? LIMIT 1" ) ; $ q -> execute ( array ( $ user -> getId ( ) ) ) ; if ( $ q -> fetch (...
Add a password to the given account .
55,811
static function deletePasswords ( \ Db \ Connection $ db , User $ user ) { if ( ! $ user ) { throw new \ InvalidArgumentException ( "No user provided." ) ; } $ q = $ db -> prepare ( "DELETE FROM user_passwords WHERE user_id=?" ) ; $ q -> execute ( array ( $ user -> getId ( ) ) ) ; return true ; }
Delete all paswords for the given user .
55,812
static function changePassword ( \ Db \ Connection $ db , User $ user , $ password ) { self :: deletePasswords ( $ db , $ user ) ; return self :: addPassword ( $ db , $ user , $ password ) ; }
Change the given users password . Removes all existing passwords and then adds a new password .
55,813
protected function _setBlock ( $ block ) { if ( $ block !== null && ! ( $ block instanceof BlockInterface ) ) { throw $ this -> _createInvalidArgumentException ( $ this -> __ ( 'Invalid block' ) , null , null , $ block ) ; } $ this -> block = $ block ; }
Sets the block for this instance .
55,814
protected function add_plugin ( $ file ) { $ this -> plugins [ ] = $ file ; add_filter ( static :: FILTER_HOOK_ACTION_LINKS . plugin_basename ( $ file ) , [ $ this , 'change_action_links' ] ) ; }
Adds a filename to the list of plugins to toggle and sets up a filter callback for each plugin s action links
55,815
public function get ( $ key ) { if ( $ this -> willRemove ( $ key ) ) { return null ; } if ( true === $ this -> willChange ( $ key ) ) { return $ this -> getCurrent ( $ key ) ; } return $ this -> getOriginal ( $ key ) ; }
Gets the current value of an property .
55,816
public function calculateChangeSet ( ) { $ set = [ ] ; foreach ( $ this -> current as $ key => $ current ) { $ original = isset ( $ this -> original [ $ key ] ) ? $ this -> original [ $ key ] : null ; $ set [ $ key ] [ 'old' ] = $ original ; $ set [ $ key ] [ 'new' ] = $ current ; } foreach ( $ this -> remove as $ key ...
Calculates any property changes .
55,817
protected function clearRemoval ( $ key ) { if ( false === $ this -> willRemove ( $ key ) ) { return $ this ; } $ key = array_search ( $ key , $ this -> remove ) ; unset ( $ this -> remove [ $ key ] ) ; $ this -> remove = array_values ( $ this -> remove ) ; return $ this ; }
Clears an property from the removal queue .
55,818
protected function clearChange ( $ key ) { if ( true === $ this -> willChange ( $ key ) ) { unset ( $ this -> current [ $ key ] ) ; } return $ this ; }
Clears an property as having been changed .
55,819
protected function getOriginal ( $ key ) { if ( isset ( $ this -> original [ $ key ] ) ) { return $ this -> original [ $ key ] ; } return null ; }
Gets the property s original value .
55,820
protected function getCurrent ( $ key ) { if ( isset ( $ this -> current [ $ key ] ) ) { return $ this -> current [ $ key ] ; } return null ; }
Gets the property s current value .
55,821
public function parse ( $ signature ) { $ this -> setName ( $ signature ) ; $ argumentsOptions = $ this -> extractArgumentsOptions ( $ signature ) ; foreach ( $ argumentsOptions as $ value ) { if ( substr ( $ value , 0 , 2 ) !== '--' ) { $ input = new Argument ( $ value ) ; } else { $ input = new Option ( trim ( $ valu...
Parse the command signature .
55,822
protected function extractArgumentsOptions ( $ signature ) { preg_match_all ( '/{(.*?)}/' , $ signature , $ argumentsOption ) ; return array_map ( function ( $ item ) { return trim ( $ item , '{}' ) ; } , $ argumentsOption [ 1 ] ) ; }
Extract arguments and options from signature .
55,823
public static function normalizeExpireAt ( $ ttl ) { self :: checkTtlType ( $ ttl ) ; if ( is_int ( $ ttl ) ) { return time ( ) + $ ttl ; } if ( $ ttl instanceof DateInterval ) { $ now = new DateTimeImmutable ; return $ now -> add ( $ ttl ) -> getTimestamp ( ) ; } return null ; }
Normalize timestamp for expire at
55,824
public static function normalizeTtl ( $ ttl ) { self :: checkTtlType ( $ ttl ) ; if ( is_int ( $ ttl ) ) { return $ ttl ; } if ( $ ttl instanceof DateInterval ) { $ now = new DateTimeImmutable ; return $ now -> add ( $ ttl ) -> getTimestamp ( ) - $ now -> getTimestamp ( ) ; } return null ; }
Normalize timestamp for TTL
55,825
public function path ( ) { $ data = [ 'year' => $ this -> created_at -> format ( 'Y' ) , 'month' => $ this -> created_at -> format ( 'm' ) , 'day' => $ this -> created_at -> format ( 'd' ) , 'slug' => $ this -> getSlug ( ) ] ; return \ URL :: route ( 'post.view' , $ data ) ; }
Return the post s path .
55,826
public function metaKeywords ( ) { $ metaKeywords = $ this -> getMetaKeywords ( ) ; if ( ! $ metaKeywords && $ type = $ this -> getType ( ) ) { $ metaKeywords = $ type -> getMetaKeywords ( ) ; } if ( ! $ metaKeywords ) { $ metaKeywords = $ this -> getTags ( ) ; } return $ metaKeywords ; }
Return the combined meta keywords .
55,827
public function metaDescription ( ) { $ metaDescription = $ this -> getMetaDescription ( ) ; if ( ! $ metaDescription && $ type = $ this -> getType ( ) ) { $ metaDescription = $ type -> getMetaDescription ( ) ; } return $ metaDescription ; }
Return the combined meta description .
55,828
public function setFile ( $ filePath , $ type = self :: CONTENT_APP_STREAM , $ suggestedFileName = '' , $ disposition = 'attachment' , $ ignore_user_abort = false ) { $ this -> setHeaders ( $ type , $ suggestedFileName , $ disposition , $ ignore_user_abort ) ; $ this -> content = file_get_contents ( $ filePath ) ; retu...
Set the file to be sent .
55,829
public function setFileContents ( $ fileContents , $ type = self :: CONTENT_APP_STREAM , $ suggestedFileName = '' , $ disposition = 'attachment' , $ ignore_user_abort = false ) { $ this -> setHeaders ( $ type , $ suggestedFileName , $ disposition , $ ignore_user_abort ) ; $ this -> content = $ fileContents ; return $ t...
Set the file contents to be sent .
55,830
private function setHeaders ( $ type = self :: CONTENT_APP_STREAM , $ suggestedFileName = '' , $ disposition = 'attachment' , $ ignore_user_abort = false ) { $ this -> headers -> set ( 'Content-Type' , $ type ) ; $ this -> headers -> set ( 'Content-Disposition' , ( $ disposition ? : 'attachment' ) . '; filename=' . $ s...
Set the response headers .
55,831
private function resolveTemplateType ( $ templateType ) { if ( is_string ( $ templateType ) && ! $ templateType = $ this -> templateTypeLoader -> retrieve ( $ templateTypeName = $ templateType ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Given template type name is invalid, "%s" given.' , $ templateTypeName ...
Resolve given template type name as TemplateType object .
55,832
public function putContents ( $ filename , $ data , $ flags = 0 , $ context ) { return file_put_contents ( $ filename , $ data , $ flags , $ context ) ; }
Facade for the file_put_contents function .
55,833
public function fileOpen ( $ filename , $ mode , $ use_include_path = false , $ context ) { return fopen ( $ filename , $ mode , $ use_include_path , $ context ) ; }
Facade for the fopen function .
55,834
private function getApiMethod ( $ from ) { $ method = sprintf ( 'retrieve%s' , Utility :: classify ( $ from ) ) ; if ( ! method_exists ( $ this -> apiClient , $ method ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Method %s does not exist on %s!' , $ method , get_class ( $ this -> apiClient ) ) ) ; } return $...
Returns the apiClient method for the specified parameters
55,835
private function handle ( Response $ response , $ count = false ) { $ responseData = json_decode ( $ response -> getContent ( ) , true ) ; if ( ! $ response -> isSuccessful ( ) ) { throw new \ RuntimeException ( $ response -> getContent ( ) ) ; } if ( true === $ count ) { switch ( $ responseData [ 'kind' ] ) { case 'yo...
Handles a response from the ApiClient
55,836
public function findFirstTag ( $ tagName ) { $ nodes = $ this -> findTags ( $ tagName ) ; return $ nodes -> length > 0 ? $ nodes -> item ( 0 ) : false ; }
Finds the first element with given tag name .
55,837
public static function fromWeb ( $ url , HttpClient $ http = null ) { $ http = $ http ? : new HttpClient ( ) ; $ request = $ http -> get ( $ url ) ; if ( ! $ request -> success ) { throw new \ RuntimeException ( sprintf ( 'The URL "%s" could not be loaded.' , $ url ) ) ; } return new static ( $ request -> data ) ; }
Loads HTML from webpage .
55,838
public static function fromFile ( $ filename ) { if ( ! is_file ( $ filename ) || ! is_readable ( $ filename ) ) { throw new \ LogicException ( sprintf ( 'The file "%s" does not exist or is not readable.' , $ filename ) ) ; } $ html = file_get_contents ( $ filename ) ; return new static ( $ html ) ; }
Loads HTML from file .
55,839
public function getTicks ( ) { $ collection = [ ] ; $ reader = $ this -> getReader ( ) ; foreach ( $ this -> getClassesToScan ( ) as $ class ) { foreach ( $ class -> getMethods ( ) as $ method ) { foreach ( $ reader -> getMethodAnnotations ( $ method ) as $ annotation ) { array_push ( $ collection , $ annotation -> tic...
Convert the scanned annotations into ticks definitions .
55,840
protected function getClassesToScan ( ) { $ classes = [ ] ; foreach ( $ this -> scan as $ class ) { try { $ classes [ ] = new ReflectionClass ( $ class ) ; } catch ( \ Exception $ e ) { } } return $ classes ; }
Get all of the ReflectionClass instances in the scan path .
55,841
public static function path ( $ path , $ trailingSlash = true ) { $ path = str_replace ( [ '\\' , '/' ] , PHP_DS , $ path ) ; $ path = rtrim ( $ path , PHP_DS ) ; if ( $ trailingSlash ) { $ path .= PHP_DS ; } return $ path ; }
Normalize the path .
55,842
public function authorize ( $ payment , $ amount ) { $ error = false ; if ( $ amount > 0 ) { $ payment -> setAmount ( $ amount ) ; $ transaction = $ this -> _build ( $ payment , self :: TRANSACTION_PREAUTH ) ; $ response = $ this -> _send ( $ transaction ) ; $ payment -> setCcApproval ( $ response -> getReceiptId ( ) )...
Authorize a payment for future capture
55,843
public function capture ( $ payment , $ amount ) { $ error = false ; if ( $ amount > 0 ) { $ payment -> setAmount ( $ amount ) ; $ transaction = $ this -> _build ( $ payment , self :: TRANSACTION_COMPLETION ) ; $ response = $ this -> _send ( $ transaction ) ; if ( $ response -> getResponseCode ( ) > 0 && $ response -> ...
Capture the authorized transaction for a specific order
55,844
public function _send ( $ transaction ) { $ storeId = $ this -> getConfigData ( 'store_id' ) ; $ apiToken = $ this -> getConfigData ( 'api_token' ) ; $ request = new mpgRequest ( $ transaction ) ; $ mpgHttpsPost = new mpgHttpsPost ( $ storeId , $ apiToken , $ request ) ; return $ mpgHttpsPost -> getMpgResponse ( ) ; }
Receive a moneris transaction object and send it to the moneris webservice
55,845
public function _build ( $ payment , $ type ) { $ order = $ payment -> getOrder ( ) ; $ billing = $ order -> getBillingAddress ( ) ; $ shipping = $ order -> getShippingAddress ( ) ; $ token = $ this -> getConfigData ( 'order_token' ) ; $ token = ( empty ( $ token ) ) ? "" : "-" . $ token ; $ transaction = array ( 'type...
Build a moneris transaction object the data of moneris Make sure the transaction object is the appropriate type for the current step .
55,846
public function handle ( ) { $ client = new \ Raven_Client ( \ Skeleton \ Error \ Config :: $ sentry_dsn ) ; if ( isset ( $ _SESSION ) ) { $ client -> extra_context ( [ 'session' => print_r ( $ _SESSION , true ) ] ) ; } $ client -> captureException ( $ this -> exception ) ; }
Handle an error with Sentry
55,847
private function mysqlConnectionSetup ( $ capsule ) { $ capsule -> addConnection ( [ 'driver' => 'mysql' , 'host' => config ( 'database.connection.mysql.host' ) , 'database' => config ( 'database.connection.mysql.database' ) , 'username' => config ( 'database.connection.mysql.username' ) , 'password' => config ( 'datab...
To connect with mysql database
55,848
private function bootPaginator ( ) { Paginator :: currentPathResolver ( function ( ) { return url ( ) ; } ) ; Paginator :: currentPageResolver ( function ( $ pageName = 'page' ) { return request ( ) -> input ( $ pageName ) ; } ) ; }
To boot Paginator
55,849
public static function parseAPI ( BitRank $ bitrank , $ flag_data ) { $ flags = [ ] ; foreach ( $ flag_data as $ key => $ value ) { $ slug = isset ( $ value [ 'flag' ] ) ? $ value [ 'flag' ] : $ key ; switch ( self :: requireValue ( $ value , 'type' ) ) { case Flag :: TYPE_GOOD : $ type = Flag :: TYPE_GOOD ; break ; ca...
Parse API input to flags list
55,850
public function get ( $ code ) { foreach ( $ this -> getDbConnection ( ) -> fetchAll ( 'SELECT * from oauth_auth_code WHERE auth_code = :authCode AND expire_time > :ts' , [ 'authCode' => $ code , 'ts' => time ( ) ] ) as $ row ) { if ( $ row ) { return ( new AuthCodeEntity ( $ this -> server ) ) -> setRedirec...
Get the auth code
55,851
private function twigLoad ( string $ path ) : ? \ Twig_TemplateWrapper { try { return $ this -> twigEnv -> load ( $ path ) ; } catch ( TwigError $ exc ) { if ( defined ( 'WP_DEBUG' ) && WP_DEBUG ) { throw $ exc ; } } }
Load Template Data
55,852
protected function ensureDestinationPath ( array $ pathParts , CollectionBuilder $ stack ) { $ path = $ this -> destination ; while ( $ folder = array_shift ( $ pathParts ) ) { $ path .= '/' . $ folder ; if ( ! file_exists ( $ path ) ) { $ stack -> mkdir ( $ path ) ; } } return $ this ; }
Ensures a path in the destination folder exists . Creates it if not .
55,853
protected function waitForMySQLDatabaseByName ( $ database_name ) { return $ this -> retry ( 50 , function ( ) use ( $ database_name ) { $ this -> databases = $ this -> fetchMySQLDatabases ( ) ; $ database = $ this -> getMysqlDatabaseByName ( $ this -> databases , $ database_name ) ; return $ database [ 'status' ] == '...
Wait for MySQL database by name!
55,854
public function setAction ( $ action ) { if ( null !== $ action && ! is_string ( $ action ) ) { throw new Exception ( 'Invalid argument: $action must be a string or null' ) ; } $ this -> _action = $ action ; $ this -> _hrefCache = null ; return $ this ; }
Sets action name to use when assembling URL
55,855
public function setController ( $ controller ) { if ( null !== $ controller && ! is_string ( $ controller ) ) { throw new Exception ( 'Invalid argument: $controller must be a string or null' ) ; } $ this -> _controller = $ controller ; $ this -> _hrefCache = null ; return $ this ; }
Sets controller name to use when assembling URL
55,856
public function setModule ( $ module ) { if ( null !== $ module && ! is_string ( $ module ) ) { throw new Exception ( 'Invalid argument: $module must be a string or null' ) ; } $ this -> _module = $ module ; $ this -> _hrefCache = null ; return $ this ; }
Sets module name to use when assembling URL
55,857
public function setRoute ( $ route ) { if ( null !== $ route && ( ! is_string ( $ route ) || strlen ( $ route ) < 1 ) ) { throw new Exception ( 'Invalid argument: $route must be a non-empty string or null' ) ; } $ this -> _route = $ route ; $ this -> _hrefCache = null ; return $ this ; }
Sets route name to use when assembling URL
55,858
public function setResetParams ( $ resetParams ) { $ this -> _resetParams = ( bool ) $ resetParams ; $ this -> _hrefCache = null ; return $ this ; }
Sets whether params should be reset when assembling URL
55,859
public function setEncodeUrl ( $ encodeUrl ) { $ this -> _encodeUrl = ( bool ) $ encodeUrl ; $ this -> _hrefCache = null ; return $ this ; }
Sets whether href should be encoded when assembling URL
55,860
public function setScheme ( $ scheme ) { if ( null !== $ scheme && ! is_string ( $ scheme ) ) { require_once 'Zend/Navigation/Exception.php' ; throw new Exception ( 'Invalid argument: $scheme must be a string or null' ) ; } $ this -> _scheme = $ scheme ; return $ this ; }
Sets scheme to use when assembling URL
55,861
public static function get_between_versions ( $ package = 'project' , \ Datetime $ start_date = null , \ Datetime $ end_date = null ) { $ migrations = self :: get_by_package ( $ package ) ; foreach ( $ migrations as $ key => $ migration ) { if ( $ start_date !== null ) { if ( $ migration -> get_version ( ) <= $ start_d...
Get between versions
55,862
public static function get_by_version ( $ version ) { $ migrations = self :: get_all ( ) ; if ( strpos ( $ version , '/' ) === false ) { $ version = 'project/' . $ version ; } list ( $ package , $ version ) = explode ( '/' , $ version ) ; $ migrations = \ Skeleton \ Database \ Migration :: get_between_versions ( $ pack...
Get specific version
55,863
public function has ( $ path ) { $ target = & $ this -> all ; foreach ( explode ( '.' , $ path ) as $ key ) { if ( array_key_exists ( $ key , $ target ) ) { $ target = & $ target [ $ key ] ; } else return false ; } return true ; }
if contains return true .
55,864
public function initClient ( ) { $ client = new Client ( array ( 'base_url' => $ this -> getBaseUrl ( ) , 'stream' => false , 'http_errors' => false , ) ) ; $ client -> setDefaultOption ( 'exceptions' , false ) ; $ this -> setClient ( $ client ) ; }
Init Guzzle5 client with base url .
55,865
public function resolve ( $ connectionName ) { $ config = $ this -> databaseConfigs [ $ connectionName ] ; $ driver = $ config [ 'driver' ] ; return $ this -> factories [ $ driver ] -> build ( $ config ) ; }
Resolve a connection by using the appropriate factory
55,866
private function setUpLayout ( ) { if ( Layout :: filename ( ) ) { return ; } Layout :: filename ( 'layout' . $ this -> divisionPostfix . '.php' ) ; Layout :: addJsMgr ( 'layout' . ( $ this -> _division === '' ? '' : '_' . $ this -> _division ) ) ; Layout :: addCss ( 'layout' . $ this -> divisionPostfix . '.css' ) ; $ ...
Prepare layout with automatically added consts js js - mgr css .
55,867
protected function repositoryURL ( $ file ) { if ( $ this -> isAGithubRepo ( $ remote = $ this -> remoteGithub ( $ file ) ) ) { return $ remote ; } $ this -> error ( "Sorry we could not find a valid Git URL for folder $file" ) ; die ( ) ; }
Repository URL .
55,868
protected function folderContainsValidGithubRepo ( $ folder ) { $ remote = $ this -> remoteGithub ( $ folder ) ; if ( $ this -> isAGithubRepo ( $ remote ) ) { return true ; } return false ; }
Folder contains a valid Github repo .
55,869
public function setHandlers ( ) { $ error = configItem ( 'error' ) ; if ( $ error == 0 ) { ini_set ( 'display_errors' , 0 ) ; error_reporting ( 0 ) ; } else if ( $ error == 2 ) { error_reporting ( 0 ) ; set_error_handler ( array ( $ this , 'captureNormal' ) ) ; set_exception_handler ( array ( $ this , 'captureException...
Sets the Error Handlers
55,870
private function updateMainComposer ( array $ mainComposer , array $ content , string $ composerKey ) : array { if ( ! isset ( $ content [ $ composerKey ] ) ) return $ mainComposer ; $ content = $ content [ $ composerKey ] ; foreach ( $ content as $ key => $ value ) if ( strpos ( $ key , 'interactivesolutions/honeycomb...
Updating main composer file for dependencies
55,871
public static function register ( Configurator $ configurator ) { $ configurator -> onCompile [ ] = function ( $ configurator , $ compiler ) { $ compiler -> addExtension ( 'rest' , new RestExtension ( ) ) ; } ; }
Register REST API extension
55,872
public function download ( $ owner , $ repo , $ ref ) { $ fs = $ this -> getFs ( ) ; $ pfs = $ this -> project -> getFiles ( ) ; $ rfs = $ this -> remote -> getFilesystem ( $ repo , $ owner , $ ref ) ; $ files = $ rfs -> allFiles ( $ this -> docPath ) ; $ files = Arr :: without ( $ files , [ $ this -> indexPath , $ thi...
Download the ref
55,873
public function initialize ( $ vendor , $ package , $ directory ) { if ( ! $ this -> files -> exists ( $ directory ) || ! $ this -> files -> isDirectory ( $ directory ) ) { throw new InvalidPathException ( "{$directory} does not exist or is not a valid directory." ) ; } $ packageComposer = new Package ; $ packageCompos...
Initializes a package template in the provided directory .
55,874
public function Auth ( ) { if ( ! $ this -> OpenID -> mode ) { $ this -> OpenID -> identity = $ this -> OpenIDURL ; $ this -> OpenID -> returnUrl = url ( '' ) . $ _SERVER [ 'REQUEST_URI' ] ; $ this -> RedirectTo ( $ this -> OpenID -> authUrl ( ) ) ; } elseif ( $ this -> OpenID -> mode == 'cancel' ) { return false ; } e...
Check for Steam Authorization
55,875
public function transform ( SplFileInfo $ file ) { try { $ contentFile = $ this -> fileToContentFile -> transform ( $ file ) ; $ contentItem = $ this -> buildContentItem ( $ contentFile ) ; return $ contentItem ; } catch ( \ Exception $ e ) { throw new TransformationFailure ( $ e -> getMessage ( ) , 0 , $ e , $ file ->...
Transforms a file into a ContentItem
55,876
protected function getView ( Entity $ entity , array $ params = [ ] ) { switch ( true ) { case $ entity instanceof ContentItem : $ template = $ entity -> isIndex ( ) ? 'index.twig' : 'entry.twig' ; $ params [ 'entry' ] = $ entity ; break ; case $ entity instanceof Taxonomy : $ template = 'taxonomy.twig' ; $ params [ 't...
Determines what template should be used to render the view . Template is determined by the type of entity .
55,877
protected function _GetAuthorizeUrl ( iApiCommand $ command ) { $ serverUrl = $ this -> _getServerUrlEndpoints ( $ command ) ; $ authUrl = \ Poirot \ Http \ appendQuery ( $ serverUrl , \ Poirot \ Http \ buildQueryString ( iterator_to_array ( $ command ) ) ) ; $ response = new Response ( $ authUrl ) ; return $ response ...
Get Authorize Url By Argument Specified
55,878
function _Token ( iApiCommand $ command ) { $ headers = [ ] ; $ args = iterator_to_array ( $ command ) ; if ( array_key_exists ( 'client_id' , $ args ) && array_key_exists ( 'client_secret' , $ args ) ) { $ headers [ 'Authorization' ] = 'Basic ' . base64_encode ( $ args [ 'client_id' ] . ':' . $ args [ 'client_secret' ...
Request Grant Token
55,879
public function isRedirect ( ) { $ request = $ this -> request -> getData ( ) ; $ response = $ this -> getData ( ) ; return $ request [ 'opcode' ] === 0 && $ response [ 'extended_status' ] === '3DSECURE' ; }
Does the response require a redirect?
55,880
public function getTitle ( ) { $ node = $ this -> html -> findFirstTag ( 'title' ) ; return $ node ? trim ( $ node -> nodeValue ) : null ; }
Gets the title of the webpage .
55,881
public function getDescription ( ) { $ nodes = $ this -> html -> findTags ( 'meta' ) ; foreach ( $ nodes as $ node ) { if ( strtolower ( $ node -> getAttribute ( 'name' ) ) == 'description' ) { return trim ( $ node -> getAttribute ( 'content' ) ) ; } } return null ; }
Gets the description of the webpage .
55,882
public function getImages ( ) { $ images = array ( ) ; $ nodes = $ this -> html -> findTags ( 'img' ) ; foreach ( $ nodes as $ node ) { $ source = trim ( $ node -> getAttribute ( 'src' ) ) ; if ( empty ( $ source ) ) { continue ; } $ url = $ this -> getAbsoluteUrl ( $ source ) ; $ size = $ this -> getImageSize ( $ url ...
Gets the images of the webpage .
55,883
protected function getAbsoluteUrl ( $ href ) { if ( preg_match ( '#^(https?|ftps?)://#' , $ href ) ) { return $ href ; } elseif ( substr ( $ href , 0 , 2 ) == '//' ) { return parse_url ( $ this -> baseUrl , PHP_URL_SCHEME ) . ':' . $ href ; } elseif ( $ href [ 0 ] == '/' ) { return $ this -> baseUrl . $ href ; } else {...
Transforms the given URL to an absolute URL .
55,884
protected function getImageSize ( $ url ) { $ request = $ this -> http -> get ( $ url , [ 'Range' => 'bytes=0-32768' ] ) ; if ( ! $ request -> success ) { return false ; } return getimagesizefromstring ( $ request -> data ) ; }
Returns the size of an image .
55,885
public function encode ( $ data ) : string { $ encoded = \ json_encode ( $ data , \ JSON_UNESCAPED_SLASHES | \ JSON_UNESCAPED_UNICODE ) ; if ( \ json_last_error ( ) !== JSON_ERROR_NONE ) { throw new EncodingException ( \ json_last_error_msg ( ) ) ; } return $ encoded ; }
Creates JSON string from provided data
55,886
public function decode ( string $ json ) : array { $ decoded = \ json_decode ( $ json , true ) ; if ( \ json_last_error ( ) !== JSON_ERROR_NONE ) { throw new DecodingException ( \ json_last_error_msg ( ) , \ json_last_error ( ) ) ; } return $ decoded ; }
Decodes JSON string into an associative array
55,887
public function base64UrlDecode ( string $ data ) : string { return \ base64_decode ( \ str_pad ( \ strtr ( $ data , '-_' , '+/' ) , \ strlen ( $ data ) % 4 , '=' , \ STR_PAD_RIGHT ) ) ; }
Decodes base64url string
55,888
public function getLoaders ( ) { $ loaders = array ( ) ; foreach ( $ this -> validators as $ validator ) { $ loaders [ $ validator -> getName ( ) ] = $ validator -> getLoader ( ) ; } return $ loaders ; }
Retrieve the populated loaders .
55,889
public function getClassMap ( ) { $ classMap = new ClassMap ( ) ; $ duplicates = array ( ) ; foreach ( $ this -> validators as $ validator ) { $ validatorName = $ validator -> getName ( ) ; $ partialClassMap = $ validator -> getClassMap ( ) ; foreach ( $ partialClassMap as $ class => $ file ) { try { $ classMap -> add ...
Retrieve a class map containing all the class maps from all registered validators .
55,890
public function with ( $ iteration ) { return $ this -> fold ( array ( ) , function ( $ a , $ f ) use ( $ iteration ) { $ iteration ( $ f ) ; if ( ! $ f -> isFile ( ) ) { $ f -> contents ( ) ; } $ a [ ] = $ f ; return $ a ; } ) ; }
Like fold but with no start value or return .
55,891
public function moveUpAction ( Request $ request ) { $ context = $ this -> loadContext ( $ request ) ; $ resource = $ context -> getResource ( ) ; $ this -> isGranted ( 'EDIT' , $ resource ) ; $ repo = $ this -> getRepository ( ) ; $ repo -> moveUp ( $ resource , 1 ) ; return $ this -> redirectToReferer ( $ this -> gen...
Decrement the position .
55,892
public function moveDownAction ( Request $ request ) { $ context = $ this -> loadContext ( $ request ) ; $ resource = $ context -> getResource ( ) ; $ this -> isGranted ( 'EDIT' , $ resource ) ; $ repo = $ this -> getRepository ( ) ; $ repo -> moveDown ( $ resource , 1 ) ; return $ this -> redirectToReferer ( $ this ->...
Increment the position .
55,893
public function newChildAction ( Request $ request ) { $ this -> isGranted ( 'CREATE' ) ; $ context = $ this -> loadContext ( $ request ) ; $ resourceName = $ this -> config -> getResourceName ( ) ; $ resource = $ context -> getResource ( $ resourceName ) ; $ child = $ this -> createNewFromParent ( $ context , $ resour...
Creates a child resource .
55,894
public function createNewFromParent ( Context $ context , $ parent ) { $ resource = $ this -> createNew ( $ context ) ; $ resource -> setParent ( $ parent ) ; return $ resource ; }
Creates a new resource and configure it regarding to the parent .
55,895
function html ( $ string , $ options = array ( ) ) { static $ defaultCharset = false ; $ defaultCharset = 'UTF-8' ; $ default = array ( 'remove' => false , 'charset' => $ defaultCharset , 'quotes' => ENT_QUOTES , 'double' => true ) ; $ options = array_merge ( $ default , $ options ) ; if ( $ options [ 'remove' ] ) { $ ...
Returns given string safe for display as HTML . Renders entities .
55,896
protected function strip_images ( $ str ) { $ str = preg_replace ( '/(<a[^>]*>)(<img[^>]+alt=")([^"]*)("[^>]*>)(<\/a>)/i' , '$1$3$5<br />' , $ str ) ; $ str = preg_replace ( '/(<img[^>]+alt=")([^"]*)("[^>]*>)/i' , '$2<br />' , $ str ) ; $ str = preg_replace ( '/<img[^>]*>/i' , '' , $ str ) ; return $ str ; }
Strips image tags from output
55,897
protected function strip_tags ( ) { $ params = func_get_args ( ) ; $ str = $ params [ 0 ] ; for ( $ i = 1 , $ count = count ( $ params ) ; $ i < $ count ; $ i ++ ) { $ str = preg_replace ( '/<' . $ params [ $ i ] . '\b[^>]*>/i' , '' , $ str ) ; $ str = preg_replace ( '/<\/' . $ params [ $ i ] . '[^>]*>/i' , '' , $ str ...
Strips the specified tags from output . First parameter is string from where to remove tags . All subsequent parameters are tags .
55,898
public function isSatisfiedBy ( UrlModel $ url ) : bool { if ( ( string ) $ url -> substring ( 0 , 2 ) === '//' ) { return true ; } return ! $ url -> matches ( '/^[a-zA-Z]*:?\/\//' ) ; }
Check if the given url has a scheme or not
55,899
protected function isFilesystemReadable ( $ path ) { if ( $ this -> getFilesystem ( ) -> isReadable ( ) ) { return true ; } else { return $ this -> setError ( Message :: get ( Message :: STR_FS_NONREADABLE , $ path ) , Message :: STR_FS_NONREADABLE ) ; } }
Check filesystem readable or not