idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
11,300
protected function registerRouteFilters ( Router $ router ) { foreach ( ( array ) $ this -> before as $ before ) { $ router -> before ( $ before ) ; } foreach ( ( array ) $ this -> after as $ after ) { $ router -> after ( $ after ) ; } foreach ( ( array ) $ this -> filters as $ name => $ filter ) { $ router -> filter (...
Register route filters .
11,301
public function initiate ( ) { $ items = [ ] ; $ memories = $ this -> cache instanceof Repository ? $ this -> getItemsFromCache ( ) : $ this -> getItemsFromDatabase ( ) ; foreach ( $ memories as $ memory ) { $ value = $ memory -> value ; $ items [ $ memory -> name ] = unserialize ( $ value ) ; $ this -> addKey ( $ memo...
Load the data from database .
11,302
static function listMethods ( ) { $ methods = array ( ) ; $ ini = eZINI :: Instance ( 'ezjscore.ini' ) ; foreach ( $ ini -> groups ( ) as $ blockname => $ data ) { if ( strpos ( $ blockname , 'ezjscServer_' ) === 0 ) { $ classname = substr ( $ blockname , 12 ) ; if ( $ ini -> hasVariable ( $ blockname , 'TemplateFuncti...
Returns the list of all webservices available on this server
11,303
public static function chomp ( $ str ) { if ( true === self :: isEmpty ( $ str ) ) { return $ str ; } if ( 1 === self :: length ( $ str ) ) { $ firstChar = self :: charAt ( $ str , 0 ) ; if ( "\r" === $ firstChar || "\n" === $ firstChar ) { return self :: EMPTY_STR ; } return $ str ; } $ lastIndex = self :: length ( $ ...
Removes one newline from end of a string if it s there otherwise leave it alone .
11,304
public static function chop ( $ str ) { if ( true === self :: isEmpty ( $ str ) ) { return $ str ; } if ( "\r\n" === \ substr ( $ str , - 2 ) ) { return \ substr ( $ str , 0 , - 2 ) ; } return \ substr ( $ str , 0 , - 1 ) ; }
Remove the specified last character from a string .
11,305
public static function replace ( $ text , $ search , $ replace , $ max = - 1 ) { if ( ( true === self :: isEmpty ( $ text ) ) || ( true === self :: isEmpty ( $ search ) ) || ( null === $ replace ) || ( 0 === $ max ) ) { return $ text ; } return \ preg_replace ( '/' . \ preg_quote ( $ search ) . '/' , $ replace , $ text...
Replaces a string with another string inside a larger string for the first maximum number of values to replace of the search string .
11,306
public static function strip ( $ str , $ chars ) { return ( true === self :: isEmpty ( $ str ) ) ? $ str : self :: stripEnd ( self :: stripStart ( $ str , $ chars ) , $ chars ) ; }
Strips any of a set of characters from the start and end of a string .
11,307
public static function stripToEmpty ( $ str ) { return ( null === $ str ) ? self :: EMPTY_STR : self :: strip ( $ str , null ) ; }
Strips whitespace from the start and end of a string returning an empty string if null input .
11,308
public static function stripStart ( $ str , $ chars ) { if ( true === self :: isEmpty ( $ str ) ) { return $ str ; } return ( null === $ chars ) ? \ ltrim ( $ str ) : \ ltrim ( $ str , $ chars ) ; }
Strips any of a set of characters from the start of a string .
11,309
public static function stripEnd ( $ str , $ chars ) { if ( true === self :: isEmpty ( $ str ) ) { return $ str ; } return ( null === $ chars ) ? \ rtrim ( $ str ) : \ rtrim ( $ str , $ chars ) ; }
Strips any of a set of characters from the end of a string .
11,310
public static function equalsIgnoreCase ( $ str1 , $ str2 ) { return ( null === $ str1 ) ? ( null === $ str2 ) : ( self :: lowercase ( $ str1 ) === self :: lowercase ( $ str2 ) ) ; }
Compares two string s returning true if they are equal ignoring the case .
11,311
public static function indexOf ( $ str , $ search , $ startPos = 0 ) { $ result = self :: validateIndexOf ( $ str , $ search , $ startPos ) ; if ( true !== $ result ) { return $ result ; } if ( true === self :: isEmpty ( $ search ) ) { return $ startPos ; } $ pos = \ strpos ( $ str , $ search , $ startPos ) ; return ( ...
Finds the first index within a string from a start position handling null .
11,312
public static function lastIndexOf ( $ str , $ search , $ startPos = 0 ) { $ result = self :: validateIndexOf ( $ str , $ search , $ startPos ) ; if ( true !== $ result ) { return $ result ; } if ( true === self :: isEmpty ( $ search ) ) { return $ startPos ; } $ pos = \ strrpos ( $ str , $ search , $ startPos ) ; retu...
Finds the first index within a string handling null .
11,313
public static function split ( $ str , $ chars = null , $ max = 0 ) { $ result = self :: EMPTY_STR ; if ( null === $ str ) { return null ; } if ( self :: EMPTY_STR === $ str ) { return array ( ) ; } if ( null === $ chars ) { $ result = \ preg_split ( '/\s+/' , $ str , $ max ) ; } elseif ( $ max > 0 ) { $ result = \ exp...
Splits the provided text into an array with a maximum length separators specified .
11,314
public static function substring ( $ str , $ start , $ end = null ) { if ( ( 0 > $ start ) && ( 0 < $ end ) ) { $ start = 0 ; } if ( null === $ end ) { $ end = self :: length ( $ str ) ; } return \ substr ( $ str , $ start , $ end - $ start ) ; }
Gets a substring from the specified string avoiding exceptions .
11,315
public static function substringAfter ( $ str , $ separator ) { if ( true === self :: isEmpty ( $ str ) ) { return $ str ; } if ( null === $ separator ) { return self :: EMPTY_STR ; } $ pos = self :: indexOf ( $ str , $ separator ) ; if ( self :: INDEX_NOT_FOUND === $ pos ) { return self :: EMPTY_STR ; } return self ::...
Gets the substring after the first occurrence of a separator .
11,316
public static function substringAfterLast ( $ str , $ separator ) { if ( true === self :: isEmpty ( $ str ) ) { return $ str ; } if ( true === self :: isEmpty ( $ separator ) ) { return self :: EMPTY_STR ; } $ pos = self :: lastIndexOf ( $ str , $ separator ) ; if ( self :: INDEX_NOT_FOUND === $ pos || ( self :: length...
Gets the substring after the last occurrence of a separator .
11,317
public static function substringBeforeLast ( $ str , $ separator ) { if ( ( true === self :: isEmpty ( $ str ) ) || ( true === self :: isEmpty ( $ separator ) ) ) { return $ str ; } $ pos = self :: lastIndexOf ( $ str , $ separator ) ; if ( self :: INDEX_NOT_FOUND === $ pos ) { return $ str ; } return self :: substring...
Gets the substring before the last occurrence of a separator .
11,318
public static function substringBetween ( $ str , $ open , $ close = null ) { $ result = null ; if ( null === $ close ) { $ close = $ open ; } $ startPos = self :: indexOf ( $ str , $ open ) ; if ( self :: INDEX_NOT_FOUND !== $ startPos ) { $ startPos += self :: length ( $ open ) ; $ endPos = self :: indexOf ( $ str , ...
Gets the string that is nested in between two string s .
11,319
public static function repeat ( $ str , $ repeat , $ separator = null ) { $ result = self :: EMPTY_STR ; if ( ( null === $ str ) || ( null === $ separator ) ) { $ result = \ str_repeat ( $ str , $ repeat ) ; } else { $ result = \ str_repeat ( $ str . $ separator , $ repeat ) ; if ( true === self :: isNotEmpty ( $ str )...
Repeats a string the specified number of times to form a new string with a specified string injected each time .
11,320
public static function endsWith ( $ str , $ suffix ) { return ( ( null === $ str ) && ( null === $ suffix ) ) ? true : self :: substring ( $ str , self :: length ( $ str ) - self :: length ( $ suffix ) ) === $ suffix ; }
Checks if a string ends with a specified suffix .
11,321
public static function startsWith ( $ str , $ prefix ) { return ( ( null === $ str ) && ( null === $ prefix ) ) ? true : self :: substring ( $ str , 0 , self :: length ( $ prefix ) ) === $ prefix ; }
Checks if a string starts with a specified prefix .
11,322
public static function removeEnd ( $ str , $ remove ) { if ( ( true === self :: isEmpty ( $ str ) ) || ( true === self :: isEmpty ( $ remove ) ) ) { return $ str ; } if ( true === self :: endsWith ( $ str , $ remove ) ) { return self :: substring ( $ str , 0 , self :: length ( $ str ) - self :: length ( $ remove ) ) ; ...
Removes a substring only if it is at the end of a source string otherwise returns the source string .
11,323
public static function removeStart ( $ str , $ remove ) { if ( ( true === self :: isEmpty ( $ str ) ) || ( true === self :: isEmpty ( $ remove ) ) ) { return $ str ; } if ( true === self :: startsWith ( $ str , $ remove ) ) { return self :: substring ( $ str , self :: length ( $ remove ) ) ; } return $ str ; }
Removes a substring only if it is at the beginning of a source string otherwise returns the source string .
11,324
public function adapt ( Grid & $ grid ) { $ this -> grid = $ grid ; $ customfields = app ( 'customfields' ) -> get ( ) ; if ( empty ( $ customfields ) ) { return ; } foreach ( $ customfields as $ classname => $ customfield ) { if ( is_array ( $ grid -> row ) ) { continue ; } if ( get_class ( $ grid -> row ) !== $ class...
Adapts customfields to form grid
11,325
protected function addToForm ( CustomField $ customfield ) { if ( ! $ customfield -> formAutoDisplay ( ) ) { return false ; } $ field = $ customfield -> setModel ( $ this -> grid -> row ) ; $ this -> grid -> fieldset ( function ( Fieldset $ fieldset ) use ( $ field ) { $ fieldset -> add ( $ field ) ; } ) ; $ this -> gr...
Assigns customfield to form
11,326
protected function getServerRuntime ( ) { $ filename = $ this -> option ( 'filename' ) ?? storage_path ( 'framework/server.runtime' ) ; if ( ! file_exists ( $ filename ) ) { return null ; } return json_decode ( file_get_contents ( $ filename ) , true ) ; }
Get the running info .
11,327
public function scopeSearch ( Builder $ query , $ name , $ userId ) { return $ query -> where ( 'user_id' , '=' , $ userId ) -> where ( 'name' , '=' , $ name ) ; }
Return a meta data belong to a user .
11,328
public function decorate ( array $ attributes , array $ defaults = [ ] ) { $ class = $ this -> buildClassDecorate ( $ attributes , $ defaults ) ; $ attributes = array_merge ( $ defaults , $ attributes ) ; empty ( $ class ) || $ attributes [ 'class' ] = $ class ; return $ attributes ; }
Build a list of HTML attributes from one or two array .
11,329
protected function buildClassDecorate ( array $ attributes , array $ defaults = [ ] ) { $ default = Arr :: get ( $ defaults , 'class' , '' ) ; $ attribute = Arr :: get ( $ attributes , 'class' , '' ) ; $ classes = explode ( ' ' , trim ( $ default . ' ' . $ attribute ) ) ; $ current = array_unique ( $ classes ) ; $ excl...
Build class attribute from one or two array .
11,330
protected function groupedAssignAction ( $ role , array $ actions , $ allow = true ) { foreach ( $ actions as $ action ) { if ( ! $ this -> actions -> has ( $ action ) ) { throw new InvalidArgumentException ( "Action {$action} does not exist." ) ; } $ this -> assign ( $ role , $ action , $ allow ) ; } return true ; }
Grouped assign actions to have access .
11,331
protected function setDefaultOptions ( ) { $ areas = array_keys ( config ( 'areas.areas' ) ) ; $ default = config ( 'areas.default' ) ; $ configuration = require_once ( modules_path ( 'core/brands/resources/config/install.php' ) ) ; $ countryId = Country :: where ( 'code' , 'pl' ) -> first ( ) -> id ; $ languageId = La...
Sets brand default options
11,332
public static function random ( $ count , $ startPosition = 0 , $ endPosition = 0 , $ letters = true , $ numbers = true , array $ characters = array ( ) ) { if ( 0 === $ count ) { return StringUtils :: EMPTY_STR ; } if ( 0 > $ count ) { throw new InvalidArgumentException ( 'Requested random string length ' . $ count . ...
Creates a random string based on a variety of options .
11,333
function toArray ( ) { $ out = array ( ) ; $ attributes = $ this -> attribute ( 'attributes' ) ; if ( count ( $ attributes ) ) { $ out [ 'attributes' ] = $ attributes ; } $ children = $ this -> attribute ( 'children' ) ; foreach ( $ children as $ name => $ value ) { if ( is_object ( $ value ) ) { $ out [ 'children' ] [...
Try a useful conversion to an array structure . Useful for eg . dump calls
11,334
protected static function domNode2STX ( $ node ) { if ( $ node -> hasAttributes ( ) ) { return new ggSimpleTemplateXML ( $ node ) ; } foreach ( $ node -> childNodes as $ childNode ) { if ( $ childNode -> nodeType == XML_ELEMENT_NODE ) { return new ggSimpleTemplateXML ( $ node ) ; } } return $ node -> textContent ; }
Returns either a ggSimpleTemplateXML wrapping a dom element or a string based on whether the element has any attribute or child or none
11,335
public function resource ( $ name , $ alt = "xml" ) { $ response = $ this -> client -> get ( '/project/' . $ this -> name . '/resource/' . $ name , $ alt ) ; return $ response ; }
Get project resource
11,336
public function scriptsByParams ( array $ params = array ( ) ) { if ( ! isset ( $ params [ 'resources' ] ) or ! isset ( $ params [ 'position' ] ) ) { return $ this ; } if ( empty ( $ params [ 'resources' ] ) ) { return $ this ; } $ container = $ this -> container ( $ params [ 'position' ] ) ; foreach ( $ params [ 'reso...
add scripts from params
11,337
public function client ( array $ config ) { $ key = $ this -> getClientKey ( $ config ) ; if ( isset ( $ this -> clients [ $ key ] ) ) { return $ this -> clients [ $ key ] ; } return $ this -> clients [ $ key ] = $ this -> createClient ( $ config ) ; }
Get client instance .
11,338
protected function createClient ( array $ config ) { $ url = Arr :: pull ( $ config , 'url' ) ; $ urls = parse_url ( $ url ) ; $ config [ 'host' ] = $ urls [ 'host' ] ; $ config [ 'port' ] = $ urls [ 'port' ] ; switch ( $ urls [ 'scheme' ] ) { case 'http' : return new HttpClient ( $ this -> app , $ this -> serializerFa...
Create the client instance .
11,339
public function proxy ( Invoker $ invoker ) { $ interface = $ invoker -> getInterface ( ) ; $ className = $ this -> generateClassName ( $ interface ) ; $ code = $ this -> populateStub ( $ this -> getStub ( ) , $ className , $ interface ) ; $ this -> load ( $ className , $ code ) ; return $ this -> createProxyInstance (...
Get a invoking proxy instance .
11,340
protected function createProxyInstance ( $ className , $ interface , Invoker $ invoker ) { $ className = $ this -> getFullClassName ( $ className ) ; return new $ className ( $ interface , $ invoker ) ; }
Create a invoking proxy instance .
11,341
protected function load ( $ className , $ code ) { if ( class_exists ( $ this -> getFullClassName ( $ className ) , false ) ) { return ; } eval ( '?>' . $ code ) ; }
Load the proxy class .
11,342
protected function populateStub ( $ stub , $ className , $ interface ) { $ stub = str_replace ( 'ProxyClass' , $ className , $ stub ) ; $ stub = str_replace ( 'ProxyInterface' , '\\' . $ interface , $ stub ) ; $ stub = str_replace ( '// ## Implemented Methods ##' , $ this -> getMethodDefinitions ( $ interface ) , $ stu...
Populate the place - holders in the proxy stub .
11,343
protected function getMethodDefinitions ( $ interface ) { $ definitions = [ ] ; try { $ reflection = new ReflectionClass ( $ interface ) ; if ( ! $ reflection -> isInterface ( ) ) { throw new InvalidArgumentException ( "{$interface} must be an interface." ) ; } foreach ( $ reflection -> getMethods ( ) as $ method ) { $...
Get interface s method definitions .
11,344
protected function renderMethodParameters ( $ method ) { $ parameters = [ ] ; foreach ( $ method -> getParameters ( ) as $ parameter ) { if ( $ parameter -> isPassedByReference ( ) ) { throw new InvalidArgumentException ( sprintf ( 'Parameter [%s] in %s->%s cannot declared as a reference.' , $ parameter -> getName ( ) ...
Render method parameters definition .
11,345
protected function renderParameterTypeHint ( $ parameter ) { $ typeHint = $ parameter -> hasType ( ) ? ( string ) $ parameter -> getType ( ) : '' ; $ typeHint = trim ( $ typeHint ) ; if ( $ typeHint ) { if ( ! in_array ( $ typeHint , [ 'self' , 'array' , 'callable' , 'bool' , 'float' , 'int' , 'string' , 'object' , 'it...
Render method parameter s type hint .
11,346
protected function renderMethodBody ( $ method ) { $ body = '{' ; $ body .= '$arguments = func_get_args();' ; $ body .= '$result = $this->__call(__FUNCTION__, $arguments);' ; if ( $ method -> getReturnType ( ) !== 'void' ) { $ body .= 'return $result;' ; } $ body .= '}' ; return $ body ; }
Render method body definition .
11,347
protected function getStub ( ) { if ( $ this -> proxyStub == null ) { $ this -> proxyStub = file_get_contents ( $ this -> stubPath ( ) . '/proxy.stub' ) ; } return $ this -> proxyStub ; }
Get the proxy stub file .
11,348
protected function sandbox ( & $ locate , UrlGenerator $ url , array $ options = [ ] ) { $ sandbox = ( isset ( $ options [ 'sandbox' ] ) && $ options [ 'sandbox' ] == false ) ? null : $ url -> getRequest ( ) -> query ( 'sandbox' ) ; if ( ! is_null ( $ sandbox ) ) { $ separator = ( parse_url ( $ locate , PHP_URL_QUERY )...
Creates url with sandbox param
11,349
public function generate ( $ type ) { return function ( $ row , $ control , $ templates = [ ] ) use ( $ type ) { $ data = $ this -> buildFieldByType ( $ type , $ row , $ control ) ; return $ this -> render ( $ templates , $ data ) ; } ; }
Generate Field .
11,350
public function nextId ( ) { $ timestamp = time ( ) - static :: BASE_TIME ; if ( $ this -> lastTimestamp >= $ timestamp ) { $ timestamp = $ this -> lastTimestamp ; $ sequence = ++ $ this -> sequence ; if ( $ sequence > 0x7ff ) { $ this -> lastTimestamp = ++ $ timestamp ; $ sequence = $ this -> sequence = 0 ; } } else {...
Generate a new snowflake id .
11,351
protected function generateNewChecksum ( $ value ) { ! is_string ( $ value ) && $ value = ( is_object ( $ value ) ? spl_object_hash ( $ value ) : serialize ( $ value ) ) ; return md5 ( $ value ) ; }
Generate a checksum from given value .
11,352
public function forgetCache ( ) { return ! is_null ( $ this -> cache ) ? $ this -> cache -> forget ( $ this -> cacheKey ) : true ; }
force forgetting cache each driver
11,353
public function exportInvoker ( Invoker $ invoker ) { $ interface = $ invoker -> getInterface ( ) ; if ( isset ( $ this -> invokers [ $ interface ] ) ) { return ; } Log :: channel ( 'homer' ) -> info ( "Service {$interface} has been exported." ) ; $ this -> invokers [ $ interface ] = $ invoker ; }
Export the invoker .
11,354
public function handleMessage ( $ message ) { try { if ( $ message instanceof Invocation ) { return $ this -> handleInvocation ( $ message ) ; } return $ message ; } catch ( HomerException $ e ) { throw $ e ; } catch ( Throwable $ e ) { Log :: channel ( 'homer' ) -> warning ( $ e -> getMessage ( ) , [ 'exception' => $ ...
Handler the invoking request .
11,355
protected function handleInvocation ( Invocation $ invocation ) { $ invoker = $ this -> dispatchInvocation ( $ invocation ) ; return $ invoker -> invoke ( $ invocation ) ; }
Handle the invocation .
11,356
protected function dispatchInvocation ( Invocation $ invocation ) { $ interface = $ invocation -> getInterface ( ) ; if ( isset ( $ this -> invokers [ $ interface ] ) ) { return $ this -> invokers [ $ interface ] ; } throw new CallingException ( "No invoker found for {$interface}." ) ; }
Dispatch the invocation .
11,357
private function joinWithRelations ( $ model , $ with , $ joinType ) { $ relations = [ ] ; foreach ( $ with as $ name => $ callback ) { if ( is_int ( $ name ) ) { $ name = $ callback ; $ callback = null ; } $ primaryModel = $ model ; $ parent = $ this ; $ prefix = '' ; while ( ( $ pos = strpos ( $ name , '.' ) ) !== fa...
Modifies the current query by adding join fragments based on the given relations .
11,358
private function getJoinType ( $ joinType , $ name ) { if ( is_array ( $ joinType ) && isset ( $ joinType [ $ name ] ) ) { return $ joinType [ $ name ] ; } else { return is_string ( $ joinType ) ? $ joinType : 'INNER JOIN' ; } }
Returns the join type based on the given join type parameter and the relation name .
11,359
protected function resolveRouteGroupAttributes ( $ namespace = null , array $ attributes = [ ] ) { if ( is_array ( $ namespace ) ) { $ attributes = $ namespace ; $ namespace = '' ; } if ( ! is_null ( $ namespace ) ) { $ attributes [ 'namespace' ] = empty ( $ namespace ) ? $ this -> namespace : "{$this->namespace}\\{$na...
Resolve route group attributes .
11,360
protected function setDestinationPath ( $ folder ) { $ this -> destinationPath = wp_upload_dir ( ) ; $ this -> destinationPath = rtrim ( $ this -> destinationPath [ 'basedir' ] , 'uploads' ) . $ folder ; }
Set destination path
11,361
protected function setOriginPath ( $ filter ) { $ this -> originPath = ( has_filter ( $ filter ) ? apply_filters ( $ filter , rtrim ( $ this -> originPath ) ) : get_stylesheet_directory ( ) . '/' . $ this -> pathDefault ) ; }
Get origin path
11,362
public function deregister ( ) { $ this -> pathOrigin = get_stylesheet_directory ( ) . '/' . $ this -> pathDefault ; if ( $ this -> folderExist ( $ this -> pathOrigin ) ) return ; rename ( $ this -> destinationPath , $ this -> pathOrigin ) ; }
make it work for advanced custom fields
11,363
public function invoke ( Invocation $ invocation ) { try { return $ this -> doInvoke ( $ invocation ) ; } catch ( Throwable $ e ) { return $ this -> createExceptionResult ( $ e ) ; } }
Do invoking .
11,364
public function make ( $ app_name , $ flags = [ ] ) { ob_start ( ) ; ?> <div id=" <?= $ app_name ?> "></div> <script> window.addEventListener('load', function () { <?php if ( ! empty ( $ flags ) ) : ?> Elm. <?= $ app_name ?> .embed( document.getElementById(' <?= $ app_name ?> ')...
Bind the given array of variables to the elm program render the script include and return the html .
11,365
public function rejectCommand ( $ command ) { $ binary = ProcessUtils :: escapeArgument ( ( new PhpExecutableFinder ) -> find ( false ) ) ; if ( defined ( 'HHVM_VERSION' ) ) { $ binary .= ' --php' ; } if ( defined ( 'ARTISAN_BINARY' ) ) { $ artisan = ProcessUtils :: escapeArgument ( ARTISAN_BINARY ) ; } else { $ artisa...
reject Artisan command
11,366
public function build ( ExtensionModel $ model , SettingsFormContract $ settingsForm , SettingsContract $ settings ) { return $ this -> formFactory -> make ( function ( FormGrid $ form ) use ( $ model , $ settingsForm , $ settings ) { $ url = route ( area ( ) . '.modules.viewer.configuration.update' , [ 'id' => $ model...
Builds the form for the given extension model and its settings .
11,367
protected function beforeTable ( ) { $ hasMassActions = $ this -> hasMassActions ( ) ; $ filters = $ this -> filterAdapter -> getFilters ( ) ; $ hasColumnFilter = $ this -> hasColumnFilter ( ) ; $ params = [ ] ; if ( ! $ hasMassActions and ! $ this -> searchable and empty ( $ this -> selects ) and ! $ filters and ! $ h...
triggers before table
11,368
public function addRightCtrls ( $ rightCtrls = null ) { if ( ! is_string ( $ rightCtrls ) ) { return $ this ; } $ this -> rightCtrls = $ rightCtrls ; return $ this ; }
Adds right ctrls container
11,369
protected function getColumnFilterAdapter ( ) { if ( is_null ( $ this -> columnFilterAdapter ) ) { $ this -> columnFilterAdapter = app ( ColumnFilterAdapter :: class , [ $ this -> collection , get_class ( $ this -> datatable ) ] ) ; } return $ this -> columnFilterAdapter ; }
Gets colum filter adapter instance
11,370
public function setDeferedData ( ) { if ( request ( ) -> has ( 'search' ) ) { return $ this ; } $ totalItemsCount = $ this -> datatable -> count ( ) ; $ this -> deferredData = $ this -> datatable -> ajax ( ) -> getData ( ) -> data ; $ filters = $ this -> datatable -> getFilters ( ) ; $ query = $ this -> datatable -> qu...
defered data setter
11,371
public function containerAttributes ( array $ attributes = [ ] ) : Builder { foreach ( $ this -> containerAttributes as $ name => $ value ) { if ( is_null ( $ param = array_get ( $ attributes , $ name ) ) ) { continue ; } array_set ( $ this -> containerAttributes , $ name , $ value . ' ' . $ param ) ; } return $ this ;...
Container attributes setter
11,372
public function tableAttributes ( array $ attributes = array ( ) ) : Builder { array_set ( $ attributes , 'id' , array_get ( $ attributes , 'id' ) . str_random ( 3 ) ) ; $ this -> tableAttributes = array_merge ( $ this -> tableAttributes , $ attributes ) ; return $ this ; }
Table attributes setter
11,373
public function addColumn ( array $ attributes ) { $ query = $ this -> getQuery ( ) ; $ orders = $ query instanceof \ Illuminate \ Database \ Eloquent \ Builder ? $ query -> getQuery ( ) -> orders : null ; if ( ! isset ( $ this -> attributes [ 'order' ] ) and ! is_null ( $ query ) and ! is_null ( $ orders ) ) { foreach...
Add a column in collection using attributes .
11,374
public function addMassAction ( $ name , Expression $ massAction ) { $ model = $ this -> getQuery ( ) -> getModel ( ) ; $ this -> massActions = array_merge ( $ this -> massActions , ( array ) event ( new BeforeMassActionsAction ( uri ( ) , $ name , $ model , $ this -> massActions ) , [ ] , true ) ) ; if ( empty ( $ thi...
appends mass actions to mass actions container
11,375
public function setDataTable ( $ datatable ) { $ this -> setQuery ( $ datatable -> query ( ) ) ; $ this -> datatable = $ datatable ; return $ this ; }
Defered data setter
11,376
public function addGroupSelect ( $ options , $ columnIndex = 0 , $ defaultSelected = null , array $ attributes = [ ] ) { $ orderAdapter = app ( OrderAdapter :: class ) -> setClassname ( get_class ( $ this -> datatable ) ) ; if ( ( $ order = $ orderAdapter -> getSelected ( ) ) !== false ) { $ this -> parameters ( [ 'ord...
Add additional table selects
11,377
public function parameters ( array $ attributes = [ ] ) { if ( ! is_null ( $ defaultOrder = array_get ( $ attributes , 'order' ) ) ) { $ orderAdapter = app ( OrderAdapter :: class ) -> setClassname ( get_class ( $ this -> datatable ) ) ; if ( ( $ order = $ orderAdapter -> getSelected ( ) ) !== false ) { } } return pare...
Configure DataTable s parameters .
11,378
public function resolve ( $ matches = [ ] ) { if ( ! isset ( $ this -> route [ 'controller' ] ) ) { return false ; } list ( $ controller , ) = explode ( '@' , $ this -> route [ 'controller' ] ) ; $ fileName = ( new ReflectionClass ( $ controller ) ) -> getFileName ( ) ; $ rootPath = substr ( $ fileName , 0 , strrpos ( ...
module namespace resolver
11,379
public function getClear ( ) { $ return = str_replace ( self :: $ namespacePrefix . '/' , '' , $ this -> name ) ; $ exists = array_where ( self :: $ core , function ( $ key ) use ( $ return ) { return $ return == $ key ; } ) ; if ( ! empty ( $ exists ) ) { return self :: $ registeredForCore ; } if ( $ return == 'app' )...
cleared namespace of module
11,380
public function getController ( $ matches = [ ] ) { if ( ! isset ( $ this -> route [ 'controller' ] ) ) { return false ; } $ controller = $ this -> route [ 'controller' ] ; preg_match ( "/.+?(?=Controllers)(.*)@/" , $ controller , $ matches ) ; if ( ! isset ( $ matches [ 1 ] ) ) { return false ; } return str_ireplace (...
resolver controller name from route
11,381
public function getConcrete ( ) { if ( $ this -> instance ) { return $ this -> instance ; } if ( is_object ( $ this -> concrete ) || $ this -> concrete instanceof Closure ) { $ instance = $ this -> concrete ; } else { $ instance = $ this -> context -> getContainer ( ) -> make ( $ this -> concrete ) ; } if ( ! $ this ->...
Get the concrete instance .
11,382
private static function xml2array ( \ SimpleXMLElement $ xml ) { $ arr = [ ] ; if ( $ xml ) { foreach ( $ xml -> children ( ) as $ r ) { $ t = [ ] ; if ( ! is_null ( $ r ) && count ( $ r -> children ( ) ) == 0 ) { $ arr [ $ r -> getName ( ) ] = strval ( $ r ) ; } else { $ arr [ $ r -> getName ( ) ] [ ] = self :: xml2ar...
Convert a SimpleXMLElement to an array
11,383
public function searchableColumnIndex ( ) { $ searchable = [ ] ; for ( $ i = 0 , $ c = count ( $ this -> get ( 'columns' ) ) ; $ i < $ c ; $ i ++ ) { if ( $ this -> isColumnSearchable ( $ i , false ) ) { $ searchable [ ] = $ i ; } } return $ searchable ; }
Get searchable column indexes
11,384
public function isSearchable ( ) { if ( request ( ) -> has ( 'inline_search' ) ) { $ this -> replace ( [ 'start' => 0 , 'length' => 25 , 'search' => request ( ) -> get ( 'inline_search' ) ] ) ; } $ search = ( array ) $ this -> get ( 'search' ) ; return isset ( $ search [ 'value' ] ) ? $ search [ 'value' ] != '' : false...
Check if Datatables is searchable .
11,385
function setCredentials ( $ u , $ p , $ t = 1 ) { $ this -> username = $ u ; $ this -> password = $ p ; $ this -> authtype = $ t ; }
Add some http BASIC AUTH credentials used by the client to authenticate
11,386
function & send ( $ msg , $ timeout = 0 , $ method = '' ) { if ( $ method == '' ) { $ method = $ this -> method ; } if ( is_array ( $ msg ) ) { $ r = $ this -> multicall ( $ msg , $ timeout , $ method ) ; return $ r ; } elseif ( is_string ( $ msg ) ) { $ n = new xmlrpcmsg ( '' ) ; $ n -> payload = $ msg ; $ msg = $ n ;...
Send an xmlrpc request
11,387
function serialize ( $ charset_encoding = '' ) { if ( $ charset_encoding != '' ) $ this -> content_type = 'text/xml; charset=' . $ charset_encoding ; else $ this -> content_type = 'text/xml' ; if ( $ GLOBALS [ 'xmlrpc_null_apache_encoding' ] ) { $ result = "<methodResponse xmlns:ex=\"" . $ GLOBALS [ 'xmlrpc_null_apache...
Returns xml representation of the response . XML prologue not included
11,388
function addParam ( $ par ) { if ( is_object ( $ par ) && is_a ( $ par , 'xmlrpcval' ) ) { $ this -> params [ ] = $ par ; return true ; } else { return false ; } }
Add a parameter to the list of parameters to be used upon method invocation
11,389
function serialize ( $ charset_encoding = '' ) { reset ( $ this -> me ) ; list ( $ typ , $ val ) = each ( $ this -> me ) ; return '<value>' . $ this -> serializedata ( $ typ , $ val , $ charset_encoding ) . "</value>\n" ; }
Returns xml representation of the value . XML prologue not included
11,390
function getval ( ) { reset ( $ this -> me ) ; list ( $ a , $ b ) = each ( $ this -> me ) ; if ( is_array ( $ b ) ) { @ reset ( $ b ) ; while ( list ( $ id , $ cont ) = @ each ( $ b ) ) { $ b [ $ id ] = $ cont -> scalarval ( ) ; } } if ( is_object ( $ b ) ) { $ t = get_object_vars ( $ b ) ; @ reset ( $ t ) ; while ( li...
for a long long time . Shall we remove it for 2 . 0?
11,391
function scalarval ( ) { reset ( $ this -> me ) ; list ( , $ b ) = each ( $ this -> me ) ; return $ b ; }
Returns the value of a scalar xmlrpcval
11,392
function scalartyp ( ) { reset ( $ this -> me ) ; list ( $ a , ) = each ( $ this -> me ) ; if ( $ a == $ GLOBALS [ 'xmlrpcI4' ] ) { $ a = $ GLOBALS [ 'xmlrpcInt' ] ; } return $ a ; }
Returns the type of the xmlrpcval . For integers int is always returned in place of i4
11,393
public function positions ( $ params = array ( ) ) { $ arr = $ params ; $ rawResponse = $ this -> client -> request ( 'get' , 'api/exchange/leverage/positions' , $ arr ) ; return $ rawResponse ; }
Get a leverage positions list .
11,394
public function save ( $ name , $ attributes = [ ] ) { if ( auth ( ) -> guest ( ) ) { return ; } $ params = [ 'uid' => auth ( ) -> user ( ) -> id , 'brand_id' => brand_id ( ) , 'resource' => uri ( ) , 'name' => snake_case ( $ name ) , 'data' => $ attributes , ] ; $ this -> cache -> forget ( $ this -> cacheKey ( $ param...
Saves ui component
11,395
protected function getComponentId ( $ name ) { $ where = [ 'name' => $ name , 'type_id' => app ( ComponentTypes :: class ) -> newInstance ( ) -> getDefault ( ) -> id ] ; $ exists = $ this -> makeModel ( ) -> where ( $ where ) -> first ( ) ; if ( ! is_null ( $ exists ) ) { return $ exists -> id ; } $ component = $ this ...
Gets existing ui component id or add new
11,396
public function findAllByResourceAndNames ( $ resource , array $ params ) { $ where = $ this -> getWhere ( [ 'resource' => $ resource ] ) ; $ model = $ this -> makeModel ( ) -> getModel ( ) -> widgetParams ( ) -> getModel ( ) -> newQuery ( ) ; return $ model -> where ( $ where ) -> whereIn ( 'name' , $ params ) -> get ...
Finds all ui components by resource and additional params
11,397
protected function findByParams ( $ where ) { $ model = $ this -> makeModel ( ) -> getModel ( ) -> widgetParams ( ) -> getModel ( ) -> newQuery ( ) ; return $ model -> where ( $ where ) -> get ( ) -> toArray ( ) ; }
Find items by params
11,398
public function saveEntity ( Model $ model ) { $ cacheKey = $ this -> cacheKey ( $ model -> toArray ( ) ) ; $ this -> cache -> forget ( $ cacheKey ) ; return $ model -> save ( ) ; }
Saves single entity
11,399
protected function cacheKey ( array $ params = [ ] ) { $ prefix = config ( 'antares/ui-components::cache' ) ; $ required = [ 'resource' , 'uid' , 'brand_id' , 'name' ] ; if ( count ( array_only ( $ params , $ required ) ) != count ( $ required ) ) { return $ prefix ; } $ ordered = [ ] ; foreach ( $ required as $ key ) ...
Creates cache key