idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
10,900
public function migrate ( SystemUpdateListener $ listener ) { Foundation :: make ( 'antares.publisher.asset' ) -> foundation ( ) ; Foundation :: make ( 'antares.publisher.migrate' ) -> foundation ( ) ; return $ listener -> systemHasUpdated ( ) ; }
Migrate Antares components .
10,901
public function serializeThrowable ( Throwable $ e ) { $ this -> class = get_class ( $ e ) ; $ this -> message = $ e -> getMessage ( ) ; $ this -> properties = [ ] ; try { $ reflection = new ReflectionClass ( $ this -> class ) ; foreach ( $ reflection -> getProperties ( ) as $ property ) { if ( $ property -> isStatic (...
Serialize the throwable .
10,902
public function recover ( ) { if ( ! class_exists ( $ this -> class ) ) { return new RuntimeException ( $ this -> message ) ; } try { $ reflection = new ReflectionClass ( $ this -> class ) ; $ e = $ reflection -> newInstanceWithoutConstructor ( ) ; if ( ! $ e instanceof Throwable ) { throw new RuntimeException ( "Class...
Recover the exception from the serialization .
10,903
public static function parse ( string $ string ) : Cookie { $ parts = preg_split ( '/;\s*/' , $ string ) ; $ nameValue = explode ( '=' , array_shift ( $ parts ) , 2 ) ; if ( count ( $ nameValue ) !== 2 ) { throw new \ InvalidArgumentException ( 'The cookie string is not valid.' ) ; } [ $ name , $ value ] = $ nameValue ...
Creates a cookie from the contents of a Set - Cookie header .
10,904
protected function createSwooleProcess ( ) { $ process = new SwooleProcess ( function ( $ process ) { $ this -> running = true ; $ process -> name ( sprintf ( '%s : Process %s' , $ this -> app -> name ( ) , $ this -> getName ( ) ? : $ process -> pid ) ) ; $ this -> dispatchEvent ( 'Start' , $ this -> server , $ this ) ...
Create the Swoole process instance .
10,905
protected function runnableRetriever ( ) { $ runnable = $ this -> getRunnable ( ) ; if ( $ runnable && is_callable ( $ runnable ) ) { return $ runnable ; } return function ( $ server , $ process ) { $ this -> dispatchEvent ( 'Run' , $ server , $ process ) ; } ; }
Get the runnable for the process .
10,906
public function bind ( Server $ server ) { if ( $ this -> isBound ( ) ) { throw new LogicException ( 'Process can be bound to server only once.' ) ; } $ this -> server = $ server ; $ this -> dispatchEvent ( 'Bind' , $ server , $ this ) ; }
Bind the process to the server .
10,907
public function boot ( ) { $ path = realpath ( __DIR__ . '/../' ) ; $ this -> loadViewsFrom ( "{$path}/resources/views" , 'datatables-helpers' ) ; $ this -> mergeConfigFrom ( "{$path}/resources/config/config.php" , 'datatables-config' ) ; $ this -> app -> make ( 'antares.app' ) -> namespaced ( null , function ( Router ...
Booting service provider
10,908
function showResponse ( $ functionName , $ namespaceURI , & $ value ) { $ ResponseClass = $ this -> ResponseClass ; $ response = new $ ResponseClass ( $ functionName ) ; $ response -> setValue ( $ value ) ; $ this -> prepareResponse ( $ response ) ; $ payload = $ response -> payload ( ) ; foreach ( $ response -> respon...
Echoes the response setting http headers and such
10,909
function processRequest ( ) { $ namespaceURI = 'unknown_namespace_uri' ; $ data = $ this -> RawPostData ; $ data = $ this -> inflateRequest ( $ data ) ; if ( $ data === false ) { $ this -> showResponse ( 'unknown_function_name' , $ namespaceURI , new ggWebservicesFault ( self :: INVALIDCOMPRESSIONERROR , self :: INVALI...
Processes the request and prints out the proper response .
10,910
function handleRequest ( $ functionName , $ params ) { if ( array_key_exists ( $ functionName , $ this -> FunctionList ) ) { $ paramsOk = false ; foreach ( $ this -> FunctionList [ $ functionName ] as $ paramDesc ) { $ paramsOk = ( ( $ paramDesc === null ) || $ this -> validateParams ( $ params , $ paramDesc [ 'in' ] )...
Verifies if the given request has been registered as an exposed webservice and executes it . Called by processRequest .
10,911
function registerObject ( $ objectName , $ includeFile = null ) { if ( $ includeFile !== null ) include_once ( $ includeFile ) ; if ( class_exists ( $ objectName ) ) { $ methods = get_class_methods ( $ objectName ) ; foreach ( $ methods as $ method ) { if ( strcasecmp ( $ objectName , $ method ) ) $ this -> FunctionLis...
Registers all functions of an object on the server .
10,912
protected function checkout ( MessageBag $ messages ) { $ html = '' ; $ hasError = false ; $ hasSuccess = false ; foreach ( [ 'error' , 'info' , 'success' , 'warning' ] as $ key ) { if ( $ messages -> has ( $ key ) ) { $ hasError = ( ! $ hasError && $ key == 'error' ) ; $ hasSuccess = ( ! $ hasSuccess && $ key == 'succ...
checkout messages from session container
10,913
private function getFormConfigKey ( $ name , array $ control ) { if ( $ this -> isFrontend ( $ control [ 'component' ] ) ) { $ control [ 'component' ] = 'content' ; $ control [ 'method' ] = 'index' ; } return implode ( self :: separator , [ $ control [ 'component' ] , $ control [ 'action' ] , $ control [ 'method' ] , $...
form config keyname getter
10,914
protected function display ( FieldContract $ control , array $ displayable = array ( ) ) { $ name = $ control -> get ( 'name' ) ; $ shouldBeDisplayed = false ; if ( $ control -> force_displayable ) { return true ; } foreach ( $ displayable as $ field ) { if ( $ name == $ field [ 'name' ] ) { $ shouldBeDisplayed = true ...
resolve field display depends on form configuration
10,915
protected function resolveEditableField ( FieldContract $ control , array $ editable = array ( ) ) { $ name = $ control -> get ( 'name' ) ; if ( $ control -> force_editable ) { return $ control ; } $ shouldBeEdited = false ; foreach ( $ editable as $ editableField ) { if ( $ name == $ editableField [ 'name' ] ) { $ sho...
resolve field edition depends on form configuration
10,916
protected function validate ( $ name , $ key = null ) { if ( ! is_null ( $ key ) ) { return Memory :: make ( 'forms-config' ) -> get ( $ key ) ; } $ control = $ this -> runtime -> get ( 'control' , [ ] ) ; if ( empty ( $ control ) ) { return false ; } $ keyname = $ this -> getFormConfigKey ( $ name , $ control ) ; $ co...
validate current form configuration and matching with route middleware settings
10,917
protected function resolveModuleName ( ) { if ( ! isset ( $ this -> routeGroup ) ) { return '' ; } return join ( '.' , [ str_replace ( '/' , '.' , $ this -> routeGroup ) , self :: $ withSuffix ] ) ; }
middleware route keyname creator
10,918
function serializeDebug ( $ charset_encoding = '' ) { $ out = '' ; if ( $ this -> debug_info != '' ) { $ out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode ( $ this -> debug_info ) . "\n ; } if ( $ GLOBALS [ '_xmlrpc_debuginfo' ] != '' ) { $ out .= "<!-- DEBUG INFO:\n" . xmlrpc_encode_entitites ( str_r...
Return a string with the serialized representation of all debug info
10,919
function service ( $ data = null , $ return_payload = false ) { if ( $ data === null ) { $ data = file_get_contents ( 'php://input' ) ; } $ raw_data = $ data ; $ this -> debug_info = '' ; if ( $ this -> debug > 1 ) { $ this -> debugmsg ( "+++GOT+++\n" . $ data . "\n+++END+++" ) ; } $ r = $ this -> parseRequestHeaders (...
Execute the xmlrpc request printing the response
10,920
function add_to_map ( $ methodname , $ function , $ sig = null , $ doc = false , $ sigdoc = false ) { $ this -> dmap [ $ methodname ] = array ( 'function' => $ function , 'docstring' => $ doc ) ; if ( $ sig ) { $ this -> dmap [ $ methodname ] [ 'signature' ] = $ sig ; } if ( $ sigdoc ) { $ this -> dmap [ $ methodname ]...
Add a method to the dispatch map
10,921
function verifySignature ( $ in , $ sig ) { if ( is_object ( $ in ) ) { $ numParams = $ in -> getNumParams ( ) ; } else { $ numParams = count ( $ in ) ; } foreach ( $ sig as $ cursig ) { if ( count ( $ cursig ) == $ numParams + 1 ) { $ itsOK = 1 ; for ( $ n = 0 ; $ n < $ numParams ; $ n ++ ) { if ( is_object ( $ in ) )...
Verify type and number of parameters received against a list of known signatures
10,922
public function recover ( ) { return array_map ( function ( $ value ) { return $ value instanceof Serialization ? $ value -> recover ( ) : $ value ; } , $ this -> values ) ; }
Recover the array from the serialization .
10,923
protected function getQuery ( $ applyGlobalGroupScope = true ) { $ query = $ this -> query ( ) ; $ this -> addFilters ( ) ; $ finalQuery = $ this -> applyScopes ( $ query ) ; if ( $ applyGlobalGroupScope ) { $ this -> applyGlobalGroupScope ( $ finalQuery ) ; } $ request = app ( 'request' ) ; if ( $ finalQuery instanceo...
Query getter for defer initialization
10,924
private function addFilters ( ) { if ( empty ( $ this -> filters ) ) { return ; } foreach ( $ this -> filters as $ filter ) { if ( ! class_exists ( $ filter ) ) { continue ; } $ scope = app ( $ filter ) ; $ this -> addScope ( $ scope ) ; } return ; }
add filters to datatable instance
10,925
public function prepare ( $ query = null ) { $ of = is_null ( $ query ) ? $ this -> getQuery ( ) : $ query ; $ datatables = $ this -> datatables -> of ( $ of , get_class ( $ this ) ) ; $ path = str_replace ( url ( '/' ) , '' , url ( ) -> current ( ) ) ; Event :: fire ( "datatables.value.{$path}" , [ $ datatables ] ) ; ...
prepare datatable instance before
10,926
public function decorateActions ( $ row = null ) { if ( empty ( $ this -> tableActions ) ) { return '' ; } $ html = app ( 'html' ) ; $ section = $ html -> create ( 'div' , $ html -> raw ( implode ( '' , $ this -> tableActions -> toArray ( ) ) ) , [ 'class' => 'mass-actions-menu' , 'data-id' => $ row -> id ? $ row -> id...
row actions decorator
10,927
public function getQuickSearchRow ( array $ data = [ ] ) { $ pattern = '' ; try { $ pattern = $ this -> getPatternUrl ( ) ; } catch ( Exception $ ex ) { } $ view = array_get ( $ this -> search , 'view' ) ; if ( ! view ( ) -> exists ( $ view ) ) { return false ; } $ return = [ 'content' => view ( $ view , $ data ) -> re...
Gets quick search params
10,928
protected function setHtmlContent ( $ htmlContent ) { if ( is_string ( $ htmlContent ) ) { $ this -> content = $ htmlContent ; } else { throw new \ InvalidArgumentException ( "Invalid type '" . gettype ( $ htmlContent ) . "' for argument 'htmlContent' given." ) ; } return $ this ; }
Sets the HTML content
10,929
public function bootApiRouting ( Router $ router ) { if ( ! $ this -> app -> make ( 'antares.request' ) -> shouldMakeApiResponse ( ) ) { return ; } $ routerAdapter = $ this -> app -> make ( Adapter :: class ) ; $ routes = [ ] ; foreach ( $ router -> getRoutes ( ) -> getRoutes ( ) as $ route ) { $ routeActionName = $ ro...
Register router for API requests .
10,930
protected function setExtensionPath ( ) { $ filename = ( new ReflectionClass ( $ this ) ) -> getFileName ( ) ; return $ this -> extensionPath = ( new SplFileInfo ( $ filename ) ) -> getPath ( ) ; }
extension path resolver
10,931
protected function loadRoutes ( ) { $ path = $ this -> extensionPath ; $ routes = [ 'backend' => [ $ path . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'backend.php' , $ path . DIRECTORY_SEPARATOR . 'backend.php' , $ path . DIRECTORY_SEPARATOR . 'routes.php' , ] , 'frontend' => [ $ path . DIRECTORY_SEPARATOR ....
Boot extension routing .
10,932
protected function bootMemory ( ) { if ( ! isset ( $ this -> routeGroup ) or strlen ( $ this -> routeGroup ) <= 0 ) { throw new RuntimeException ( 'Invalid extension route group.' ) ; } $ this -> app -> make ( 'antares.acl' ) -> make ( $ this -> routeGroup ) -> attach ( $ this -> app -> make ( 'antares.platform.memory'...
boots extension memory
10,933
protected function bootConfiguration ( ) { $ path = $ this -> extensionPath . '/../' ; $ this -> addConfigComponent ( $ this -> routeGroup , $ this -> routeGroup , "{$path}/resources/config" ) ; $ this -> addLanguageComponent ( $ this -> routeGroup , $ this -> routeGroup , "{$path}/resources/lang" ) ; $ this -> addView...
boot extension configuration
10,934
protected function bind ( ) { if ( ! isset ( $ this -> di ) ) { return false ; } foreach ( $ this -> di as $ contract => $ object ) { $ this -> app -> bind ( $ contract , $ object ) ; } }
binds contracts to objects
10,935
protected function attachMenu ( $ classnames ) { $ menuComposer = MenuComposer :: getInstance ( ) ; if ( is_array ( $ classnames ) ) { foreach ( $ classnames as $ classname ) { $ menuComposer -> compose ( $ classname ) ; } return ; } return $ menuComposer -> compose ( $ classnames ) ; }
attaches menu to application container
10,936
protected function bindContracts ( ) { $ dir = dirname ( ( new ReflectionClass ( get_called_class ( ) ) ) -> getFileName ( ) ) ; $ configPath = $ dir . '/../resources/config/config.php' ; if ( ! file_exists ( $ configPath ) ) { return false ; } if ( empty ( $ di = require $ configPath ) ) { return false ; } foreach ( a...
bind contracts to its classes
10,937
private function loadBreadcrumbsFile ( ) { $ path = $ this -> extensionPath . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'breadcrumbs.php' ; if ( file_exists ( $ path ) ) { $ manager = $ this -> app -> instance ( Manager :: class , $ this -> app -> make ( Manager :: class ) ) ; require_once $ path ; } }
Loads breaedcrumbs file .
10,938
private function loadMenuFile ( ) { $ path = $ this -> extensionPath . DIRECTORY_SEPARATOR . 'Http' . DIRECTORY_SEPARATOR . 'menu.php' ; if ( file_exists ( $ path ) ) { $ menu = $ this -> app -> make ( MenuAssigner :: class ) ; require_once $ path ; } }
Loads menu file .
10,939
protected function importNotifications ( string $ extension ) { $ this -> afterActivated ( $ extension , function ( ) use ( $ extension ) { \ Artisan :: call ( 'notifications:import' , compact ( 'extension' ) ) ; } ) ; }
Imports notifications after activation of the given extension .
10,940
public function registerCollection ( Extensions $ extensions ) { foreach ( $ extensions as $ extension ) { $ this -> register ( $ extension ) ; } $ this -> eventDispatcher -> dispatch ( 'antares.after.load-service-providers' ) ; }
Register the collection of extensions .
10,941
public function register ( ExtensionContract $ extension ) { $ this -> extensions [ ] = $ extension ; $ this -> loader -> registerExtensionProviders ( $ extension ) ; }
Register the extension .
10,942
public function boot ( ) { $ this -> loader -> loadManifest ( ) ; foreach ( $ this -> extensions as $ extension ) { try { $ this -> eventDispatcher -> dispatch ( new Booted ( $ extension ) ) ; $ name = $ extension -> getPackage ( ) -> getName ( ) ; $ this -> eventDispatcher -> dispatch ( 'extension.started' , [ $ name ...
Boot all extensions .
10,943
public function after ( Closure $ callback = null ) { if ( $ callback && $ this -> booted ( ) ) { $ this -> container -> call ( $ callback ) ; } $ this -> eventDispatcher -> listen ( BootedAll :: class , $ callback ) ; $ this -> eventDispatcher -> listen ( 'antares.extension: booted' , $ callback ) ; $ this -> eventDis...
Create an event listener or execute it directly .
10,944
public function getDefaults ( $ args = null ) { if ( ! is_null ( $ args ) ) { if ( is_array ( $ args ) ) { return array_only ( $ this -> defaults , $ args ) ; } if ( array_key_exists ( $ args , $ this -> defaults ) ) { return $ this -> defaults [ $ args ] ; } } return $ this -> defaults ; }
Gets defaults attributes
10,945
protected function editable ( ) { if ( array_key_exists ( 'editable' , $ this -> attributes ) && $ this -> attributes [ 'editable' ] == false ) { return false ; } return in_array ( 'form' , get_class_methods ( $ this ) ) ; }
Does the ui component has editable attributes
10,946
public function setOptions ( array $ options ) { if ( $ this -> server && $ this -> server -> isRunning ( ) ) { throw new LogicException ( 'Options cannot be set while the server is running.' ) ; } $ this -> options = array_diff_key ( $ this -> options , $ options ) + $ options ; if ( $ this -> swoolePort != null ) { $...
Set the server socket options .
10,947
public function listen ( Server $ server , SwoolePort $ swoolePort = null ) { if ( $ this -> isBound ( ) ) { throw new LogicException ( 'The server socket can be bound to server only once.' ) ; } if ( $ swoolePort == null ) { return $ server -> listen ( $ this ) ; } $ this -> server = $ server ; $ this -> swoolePort = ...
Bind the server socket to a server instance .
10,948
public function getIterator ( ) { if ( $ this -> isBound ( ) && $ this -> server -> isRunning ( ) ) { return $ this -> swoolePort -> connections ; } return new EmptyIterator ; }
Retrieve an iterator for all connections in this port .
10,949
function payload ( ) { $ contentType = $ this -> ContentType ; if ( $ pos = strpos ( $ contentType , ';' ) !== false ) { $ contentType = substr ( $ contentType , 0 , $ pos ) ; } if ( $ contentType == '' ) { $ contentType = $ this -> defaultContentType ; } if ( $ this -> IsFault ) { $ value = array ( 'faultCode' => $ th...
Returns the payload for the response . Encoding varies depending on what the request asked for
10,950
protected function getFromSession ( $ key , $ perPage ) { $ session = $ this -> request -> session ( ) ; if ( ! $ session -> has ( $ key ) or $ this -> request -> ajax ( ) ) { $ session -> put ( $ key , $ perPage ) ; $ session -> save ( ) ; } return $ session -> get ( $ key ) ; }
Get key from session
10,951
public function defaults ( ) { $ defaults = $ this -> config ; if ( ! isset ( $ defaults [ 'width' ] ) ) { $ defaults [ 'width' ] = $ defaults [ 'default_width' ] ; } if ( ! isset ( $ defaults [ 'height' ] ) ) { $ defaults [ 'height' ] = $ defaults [ 'default_height' ] ; } return $ defaults ; }
created defaults dimenstion settings
10,952
public function attributes ( array $ current = array ( ) ) { $ attributes = isset ( $ this -> params [ 'attributes' ] ) ? $ this -> params [ 'attributes' ] : [ ] ; $ this -> attributes = array_merge ( $ this -> config , $ attributes , $ current ) ; $ this -> attributes [ 'name' ] = $ this -> name ; $ this -> attributes...
widget attributes manager
10,953
public function attributes ( $ key = null , $ value = null ) { if ( is_null ( $ key ) ) { return $ this -> attributes ; } if ( is_array ( $ key ) ) { $ this -> attributes = array_merge ( $ this -> attributes , $ key ) ; } else { $ this -> attributes [ $ key ] = $ value ; } return ; }
Add or append Grid attributes .
10,954
public function of ( $ name , $ callback = null ) { $ type = $ this -> definition [ 'name' ] ; if ( is_null ( $ type ) || ! property_exists ( $ this , $ type ) ) { throw new RuntimeException ( 'Not supported.' ) ; } elseif ( ! isset ( $ this -> keyMap [ $ name ] ) ) { throw new InvalidArgumentException ( "Name [{$name}...
Allow column overwriting .
10,955
public function message ( $ title , $ text = null ) { if ( ! in_array ( $ this -> type , [ 'success' , 'error' , 'info' , 'warning' ] ) ) { return '' ; } $ container = $ this -> assetFactory -> container ( self :: position ) ; $ type = $ this -> resolveType ( ) ; return $ container -> inlineScript ( 'swal-message' , $ ...
Appends inline script to scripts container
10,956
protected function inline ( $ type , $ title , $ text = null ) { $ html = ( string ) $ text ; $ inline = <<<EOD $(document).ready(function(){ swal($.extend({}, APP.swal.$type(), { title: '$title', text: '$html', ...
generate flash messanger inline scripts
10,957
public function form ( array $ configuration = array ( ) ) { Event :: fire ( 'antares.forms' , 'commands.' . $ this -> name ) ; Event :: fire ( new Form ( 'commands.' . $ this -> name ) ) ; return app ( 'antares.form' ) -> of ( "antares.command: " . $ this -> name , function ( FormGrid $ form ) use ( $ configuration ) ...
default command form
10,958
protected function getConfiguration ( ) { $ model = Jobs :: where ( 'name' , $ this -> name ) -> first ( ) ; return unserialize ( $ model -> value ) ; }
command configuration getter
10,959
public function isValid ( ExtensionContract $ extension ) : bool { return ! in_array ( $ extension -> getPackage ( ) -> getName ( ) , $ this -> configRepository -> getReservedNames ( ) , true ) ; }
Determines if the extension is set properly .
10,960
public function validateAssetsPath ( ExtensionContract $ extension ) { $ targetPath = $ this -> configRepository -> getPublicPath ( ) . '/packages/antares' ; if ( ! File :: isWritable ( $ targetPath ) ) { throw new ExtensionException ( 'The package [' . $ extension -> getPackage ( ) -> getName ( ) . '] cannot access to...
Check whether the package has a writable public asset .
10,961
public static function escapeRegEx ( $ str , $ delimiter = '/' ) { return StringUtils :: isEmpty ( $ str ) ? $ str : \ preg_quote ( $ str , $ delimiter ) ; }
Escapes the characters in a string to be suitable to pass to a regular expression .
10,962
public function setOption ( $ name , $ value ) { if ( is_string ( $ name ) ) { if ( isset ( $ this -> options [ $ name ] ) ) { switch ( $ name ) { case self :: OPTION_STYLE_TAG : if ( is_int ( $ value ) ) { if ( ! in_array ( $ value , [ self :: OPTION_STYLE_TAG_BODY , self :: OPTION_STYLE_TAG_HEAD , self :: OPTION_STYL...
Sets an option for the generation of the mail .
10,963
public function getOption ( $ name ) { if ( is_string ( $ name ) ) { if ( isset ( $ this -> options [ $ name ] ) ) { return $ this -> options [ $ name ] ; } else { throw new \ InvalidArgumentException ( "An option with the name '$name' doesn't exist." ) ; } } else { throw new \ InvalidArgumentException ( "Invalid type ...
Gets an option for the generation of the mail .
10,964
protected function prepareText ( \ DOMDocument $ doc ) { $ text = $ this -> convertHtmlToText ( $ doc -> childNodes ) ; $ charset = $ this -> getCharset ( ) ; $ textLineMaxLength = $ this -> getOption ( self :: OPTION_TEXT_LINE_WIDTH ) ; $ text = preg_replace_callback ( '/^([^\n]+)$/m' , function ( $ match ) use ( $ ch...
Prepares the mail text content .
10,965
protected function convertHtmlToText ( \ DOMNodeList $ nodes ) { $ text = "" ; foreach ( $ nodes as $ node ) { $ lineBreaksBefore = 0 ; $ lineBreaksAfter = 0 ; $ lineCharBefore = "" ; $ lineCharAfter = "" ; $ prefix = "" ; $ suffix = "" ; if ( in_array ( $ node -> nodeName , [ "h1" , "h2" , "h3" , "h4" , "h5" , "h6" , ...
Converts HTML tags to text to create a text version of an HTML document .
10,966
private static function getCurrentRequestHeaders ( ) : array { $ headers = [ ] ; if ( function_exists ( 'apache_request_headers' ) ) { $ requestHeaders = apache_request_headers ( ) ; if ( $ requestHeaders ) { foreach ( $ requestHeaders as $ key => $ value ) { $ key = strtolower ( $ key ) ; $ headers [ $ key ] = [ $ val...
Returns the current request headers .
10,967
public function setQuery ( array $ query ) : Request { $ this -> queryString = http_build_query ( $ query ) ; parse_str ( $ this -> queryString , $ this -> query ) ; $ this -> requestUri = $ this -> path ; if ( $ this -> queryString !== '' ) { $ this -> requestUri .= '?' . $ this -> queryString ; } return $ this ; }
Sets the query parameters .
10,968
public function setPost ( array $ post ) : Request { parse_str ( http_build_query ( $ post ) , $ this -> post ) ; if ( ! $ this -> isContentType ( 'multipart/form-data' ) ) { $ body = http_build_query ( $ post ) ; $ body = new MessageBodyString ( $ body ) ; $ this -> setBody ( $ body ) ; $ this -> setHeader ( 'Content-...
Sets the post parameter .
10,969
public function getFile ( string $ name ) : ? UploadedFile { $ file = $ this -> resolvePath ( $ this -> files , $ name ) ; if ( $ file instanceof UploadedFile ) { return $ file ; } return null ; }
Returns the uploaded file by the given name .
10,970
public function getFiles ( string $ name = null ) : array { if ( $ name === null ) { return $ this -> files ; } $ files = $ this -> resolvePath ( $ this -> files , $ name ) ; if ( $ files instanceof UploadedFile ) { return [ $ files ] ; } if ( is_array ( $ files ) ) { return array_filter ( $ files , static function ( $...
Returns the uploaded files under the given name .
10,971
public function setCookies ( array $ cookies ) : Request { $ query = http_build_query ( $ cookies ) ; parse_str ( $ query , $ this -> cookies ) ; if ( $ cookies ) { $ cookie = str_replace ( '&' , '; ' , $ query ) ; $ this -> setHeader ( 'Cookie' , $ cookie ) ; } else { $ this -> removeHeader ( 'Cookie' ) ; } return $ t...
Sets the cookies for this request .
10,972
public function setMethod ( string $ method ) : Request { $ this -> method = $ this -> fixMethodCase ( $ method ) ; return $ this ; }
Sets the request method .
10,973
private function fixMethodCase ( string $ method ) : string { $ upperMethod = strtoupper ( $ method ) ; $ isStandard = in_array ( $ upperMethod , self :: $ standardMethods , true ) ; return $ isStandard ? $ upperMethod : $ method ; }
Fixes a method case .
10,974
public function setScheme ( string $ scheme ) : Request { $ scheme = strtolower ( $ scheme ) ; if ( $ scheme === 'http' ) { $ this -> isSecure = false ; } elseif ( $ scheme === 'https' ) { $ this -> isSecure = true ; } else { throw new \ InvalidArgumentException ( 'The scheme must be http or https.' ) ; } return $ this...
Sets the request scheme .
10,975
public function isHost ( string $ host , bool $ includeSubDomains = false ) : bool { $ thisHost = strtolower ( $ this -> host ) ; $ thatHost = strtolower ( $ host ) ; if ( ! $ includeSubDomains ) { return $ thisHost === $ thatHost ; } $ thisHost = explode ( '.' , $ thisHost ) ; $ thatHost = explode ( '.' , $ thatHost )...
Returns whether the host is on the given domain or optionally on a sub - domain of it .
10,976
private function updateHostHeader ( ) : Request { $ host = $ this -> host ; $ standardPort = $ this -> isSecure ? 443 : 80 ; if ( $ this -> port !== $ standardPort ) { $ host .= ':' . $ this -> port ; } return $ this -> setHeader ( 'Host' , $ host ) ; }
Updates the Host header from the values of host and port .
10,977
public function setPath ( string $ path ) : Request { if ( strpos ( $ path , '?' ) !== false ) { throw new \ InvalidArgumentException ( 'The request path must not contain a query string.' ) ; } $ this -> path = $ path ; return $ this -> updateRequestUri ( ) ; }
Sets the request path .
10,978
private function updateRequestUri ( ) : Request { $ this -> requestUri = $ this -> path ; if ( $ this -> queryString !== '' ) { $ this -> requestUri .= '?' . $ this -> queryString ; } return $ this ; }
Updates the request URI from the values of path and query string .
10,979
public function setRequestUri ( string $ requestUri ) : Request { $ pos = strpos ( $ requestUri , '?' ) ; if ( $ pos === false ) { $ this -> path = $ requestUri ; $ this -> queryString = '' ; $ this -> query = [ ] ; } else { $ this -> path = substr ( $ requestUri , 0 , $ pos ) ; $ this -> queryString = substr ( $ reque...
Sets the request URI .
10,980
public function getUrlBase ( ) : string { $ url = sprintf ( '%s://%s' , $ this -> getScheme ( ) , $ this -> host ) ; $ isStandardPort = ( $ this -> port === ( $ this -> isSecure ? 443 : 80 ) ) ; return $ isStandardPort ? $ url : $ url . ':' . $ this -> port ; }
Returns the scheme and host name of this request .
10,981
public function setUrl ( string $ url ) : Request { $ components = parse_url ( $ url ) ; if ( $ components === false ) { throw new \ InvalidArgumentException ( 'The URL provided is not valid.' ) ; } if ( ! isset ( $ components [ 'scheme' ] ) ) { throw new \ InvalidArgumentException ( 'The URL must have a scheme.' ) ; }...
Sets the request URL .
10,982
public function getReferer ( ) : ? Url { $ referer = $ this -> getFirstHeader ( 'Referer' ) ; if ( $ referer === null ) { return null ; } try { return new Url ( $ referer ) ; } catch ( \ InvalidArgumentException $ e ) { return null ; } }
Returns the Referer URL if it is present and valid else null .
10,983
public function setSecure ( bool $ isSecure ) : Request { $ isStandardPort = ( $ this -> port === ( $ this -> isSecure ? 443 : 80 ) ) ; if ( $ isStandardPort ) { $ this -> port = $ isSecure ? 443 : 80 ; } $ this -> isSecure = $ isSecure ; return $ this ; }
Sets whether this request is sent over a secure connection .
10,984
private function parseHeaderParameters ( string $ header ) : array { $ result = [ ] ; $ values = explode ( ',' , $ header ) ; foreach ( $ values as $ parts ) { $ parameters = [ ] ; $ parts = explode ( ';' , $ parts ) ; $ item = trim ( array_shift ( $ parts ) ) ; if ( $ item === '' ) { continue ; } foreach ( $ parts as ...
Parses a header with multiple values and optional parameters .
10,985
public static function getLocalHost ( ) { if ( $ nets = swoole_get_local_ip ( ) ) { foreach ( $ nets as $ net => $ host ) { if ( self :: isUsableHost ( $ host ) ) { return $ host ; } } } return self :: LOCAL_HOST ; }
Get the local host ip .
10,986
function processRequest ( ) { $ namespaceURI = 'unknown_namespace_uri' ; $ data = $ this -> RawPostData ; $ data = $ this -> inflateRequest ( $ data ) ; if ( $ data === false ) { $ this -> showResponse ( 'unknown_function_name' , $ namespaceURI , new ggWebservicesFault ( self :: INVALIDCOMPRESSIONERROR , self :: INVALI...
Reimplemented because we do not recover params in the request obj
10,987
public function put ( $ docs ) { if ( $ docs instanceof Document ) { $ this -> obj_gateway -> put ( [ $ docs ] ) ; } elseif ( is_array ( $ docs ) ) { $ this -> obj_gateway -> put ( $ docs ) ; } else { throw new \ InvalidArgumentException ( 'Parameter must be one or more \Search\Document objects' ) ; } }
Put a document into the index
10,988
public function search ( $ query ) { if ( $ query instanceof Query ) { return $ this -> obj_gateway -> search ( $ query ) ; } return $ this -> obj_gateway -> search ( new Query ( ( string ) $ query ) ) ; }
Run a basic search query
10,989
public function delete ( $ docs ) { if ( $ docs instanceof Document ) { $ this -> obj_gateway -> delete ( [ $ docs -> getId ( ) ] ) ; } elseif ( is_string ( $ docs ) ) { $ this -> obj_gateway -> delete ( [ $ docs ] ) ; } elseif ( is_array ( $ docs ) ) { $ arr_doc_ids = [ ] ; foreach ( $ docs as $ doc ) { if ( $ doc ins...
Delete one or more documents
10,990
private function getActions ( Component $ component ) { $ defaultActions = ( array ) config ( 'antares/installer::permissions.components.' . $ component -> name , [ ] ) ; return Action :: where ( 'component_id' , $ component -> id ) -> whereIn ( 'name' , $ defaultActions ) -> get ( ) ; }
Returns actions for the given component .
10,991
protected function _payload ( ) { $ results = array ( ) ; foreach ( $ this -> Parameters as $ key => $ val ) { if ( is_array ( $ val ) ) { foreach ( $ val as $ vkey => $ vval ) { $ results [ ] = urlencode ( $ key ) . '[' . urlencode ( $ vkey ) . ']=' . urlencode ( $ vval ) ; } } else { $ results [ ] = urlencode ( $ key...
the payload can be used in URIS for GETs and in http req bodies for POSTs
10,992
public function handle ( AbstractNotificationTemplate $ instance ) { $ type = $ instance -> getType ( ) ; $ notifier = $ this -> getNotifierAdapter ( $ type ) ; if ( ! $ notifier ) { return false ; } $ render = $ instance -> render ( ) ; $ view = $ render instanceof View ? $ render -> render ( ) : $ render ; $ title = ...
handle notification event
10,993
public function getNotifierAdapter ( $ type ) { try { $ config = config ( "antares/notifier::{$type}" ) ; $ notifierConfig = $ config [ 'adapters' ] [ $ config [ 'adapters' ] [ 'default' ] ] ; if ( ! class_exists ( $ notifierConfig [ 'model' ] ) ) { throw new Exception ( sprintf ( 'Notifier adapter: %s not exists.' , $...
gets notifier adapter by type
10,994
public function getAccount ( $ accountID , $ subaccounts = true ) { if ( $ this -> isAuthenticated ( ) ) { $ url = 'https://www.googleapis.com/adsense/v1.1/accounts/' . urlencode ( $ accountID ) . ( $ subaccounts ? '?tree=true' : '' ) ; $ jdata = $ this -> query ( $ url ) ; if ( $ data = json_decode ( $ jdata -> body ,...
Method to get an Adsense account s settings from Google
10,995
public function listAccounts ( $ options = array ( ) , $ maxpages = 1 ) { if ( $ this -> isAuthenticated ( ) ) { $ next = array_key_exists ( 'nextPageToken' , $ options ) ? $ options [ 'nextPage' ] : null ; unset ( $ options [ 'nextPageToken' ] ) ; $ url = 'https://www.googleapis.com/adsense/v1.1/accounts?' . http_buil...
Method to retrieve a list of AdSense accounts from Google
10,996
public function listClients ( $ accountID , $ options = array ( ) , $ maxpages = 1 ) { if ( $ this -> isAuthenticated ( ) ) { $ next = array_key_exists ( 'nextPageToken' , $ options ) ? $ options [ 'nextPage' ] : null ; unset ( $ options [ 'nextPageToken' ] ) ; $ url = 'https://www.googleapis.com/adsense/v1.1/accounts/...
Method to retrieve a list of AdSense clients from Google
10,997
public function getUnit ( $ accountID , $ adclientID , $ adunitID ) { if ( $ this -> isAuthenticated ( ) ) { $ url = 'https://www.googleapis.com/adsense/v1.1/accounts/' . urlencode ( $ accountID ) ; $ url .= '/adclients/' . urlencode ( $ adclientID ) . '/adunits/' . urlencode ( $ adunitID ) ; $ jdata = $ this -> query ...
Method to get an AdSense AdUnit
10,998
public function generateReport ( $ accountID , $ start , $ end = false , $ options = array ( ) , $ maxpages = 1 ) { if ( $ this -> isAuthenticated ( ) ) { if ( \ is_int ( $ start ) ) { $ startobj = new DateTime ; $ startobj -> setTimestamp ( $ start ) ; } elseif ( \ is_string ( $ start ) ) { $ startobj = new DateTime (...
Method to retrieve a list of AdSense Channel URLs
10,999
public function get ( $ action , $ alt = "xml" ) { if ( array_key_exists ( $ action , $ this -> actions ) ) { if ( ! in_array ( $ alt , $ this -> actions [ $ action ] ) ) { throw new \ Exception ( "Invalid Format: " . $ alt ) ; } $ response = $ this -> client -> get ( '/' . strtolower ( get_class ( $ this ) ) . '/' . $...
Get resource action