idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
16,400
private function setInput ( ) { $ this -> input = file_get_contents ( "php://input" ) ; if ( ! empty ( $ this -> input ) ) { $ this -> input = gzinflate ( $ this -> input ) ; $ this -> input = json_decode ( $ this -> input , true ) ; } }
Sets inbound input value into scope
16,401
private function executeCoreComponent ( $ component , $ action ) { $ ns = "\\Plinker\\" . ucfirst ( $ component ) ; if ( class_exists ( $ ns ) ) { $ response = $ this -> execute ( $ ns , $ action ) ; } elseif ( class_exists ( $ ns . "\\" . ucfirst ( $ component ) ) ) { $ ns = "\\Plinker\\" . ucfirst ( $ component ) . "\\" . ucfirst ( $ component ) ; $ response = $ this -> execute ( $ ns , $ action ) ; } else { if ( empty ( $ component ) && $ action === "info" ) { $ response = $ this -> info ( ) ; } else { $ response = sprintf ( Server :: ERROR_EXT_COMPONENT , $ component ) ; } } return $ response ; }
Execute core component
16,402
private function executeUserComponent ( $ component , $ action ) { $ ns = null ; if ( ! empty ( $ this -> config [ "classes" ] [ $ component ] [ 0 ] ) ) { $ ns = $ this -> config [ "classes" ] [ $ component ] [ 0 ] ; } if ( ! empty ( $ this -> config [ "classes" ] [ $ component ] [ 1 ] ) ) { $ this -> config [ 'config' ] = array_merge ( $ this -> config [ 'config' ] , $ this -> config [ "classes" ] [ $ component ] [ 1 ] ) ; } if ( ! empty ( $ ns ) && ! file_exists ( $ ns ) ) { $ this -> response = serialize ( [ "error" => sprintf ( Server :: ERROR_USR_COMPONENT , $ component ) , "code" => 422 ] ) ; return ; } require ( $ ns ) ; if ( ! class_exists ( $ component ) ) { $ this -> response = serialize ( [ "error" => sprintf ( Server :: ERROR_USR_COMPONENT , $ component ) , "code" => 422 ] ) ; return ; } return $ this -> execute ( $ component , $ action ) ; }
Execute user component
16,403
final public static function factory ( WebDriver_Command $ command , array $ infoList = [ ] , $ rawResponse = null , $ responseJson = null ) { if ( ! isset ( $ responseJson [ 'status' ] ) ) { $ errorMessage = "Unknown error" ; } elseif ( static :: isOk ( $ responseJson [ 'status' ] ) ) { $ errorMessage = "Unexpected Ok status {$responseJson['status']}" ; } elseif ( static :: isKnownError ( $ responseJson [ 'status' ] ) ) { $ errorMessage = static :: getErrorMessage ( $ responseJson [ 'status' ] ) ; } else { $ errorMessage = "Unknown error status: {$responseJson['status']}" ; } $ messageList = [ $ errorMessage ] ; if ( isset ( $ responseJson [ 'value' ] [ 'message' ] ) ) { $ messageList [ ] = $ responseJson [ 'value' ] [ 'message' ] ; } $ messageList [ ] = static :: getCommandDescription ( $ command ) ; $ messageList [ ] = "HTTP Status Code: {$infoList['http_code']}" ; switch ( $ responseJson [ 'status' ] ) { case self :: STALE_ELEMENT_REFERENCE : $ e = new WebDriver_Exception_StaleElementReference ( implode ( "\n" , $ messageList ) , $ responseJson [ 'status' ] ) ; $ e -> responseList = $ responseJson ; return $ e ; default : $ e = new WebDriver_Exception_FailedCommand ( implode ( "\n" , $ messageList ) , $ responseJson [ 'status' ] ) ; $ e -> responseList = $ responseJson ; return $ e ; } }
Factory for all failed command exceptions .
16,404
public function fetchReferences ( $ refs = true , $ soft = false ) { $ this -> fetchRefs = $ refs ; $ this -> softRefs = $ soft ; return $ this ; }
Change reference fetching behavior .
16,405
public function validate ( $ subject ) : bool { $ validatedCount = 0 ; foreach ( $ this -> schema [ 'oneOf' ] as $ schema ) { $ nodeValidator = new NodeValidator ( $ schema , $ this -> rootSchema ) ; if ( $ nodeValidator -> validate ( $ subject ) ) { $ validatedCount ++ ; } } return $ validatedCount === 1 ; }
Validates subject against oneOf
16,406
public function run ( ) { $ this -> requestId = uniqid ( ) ; $ this -> startTime = microtime ( ) ; try { try { $ requestFactory = new Requests \ Factories \ Http ; $ request = $ requestFactory -> get ( $ this ) ; $ this -> setLocale ( $ request -> getLocale ( ) ) ; $ this -> issueResponse ( $ request ) ; } catch ( \ Throwable $ throwable ) { $ errorRequest = new Requests \ Http \ Error ; $ errorRequest -> setThrowable ( $ throwable ) ; $ this -> issueResponse ( $ errorRequest , $ throwable ) ; } } catch ( \ Exception $ exception ) { $ this -> fail ( $ exception ) ; } Logger :: get ( ) -> info ( $ this -> getStats ( ) ) ; }
Starts the application s cycle .
16,407
private function issueResponse ( Request $ request , \ Exception $ exception = null ) { $ responder = null ; if ( $ exception === null ) { $ responder = ResponderFactory :: getResponder ( $ request ) ; } else { $ responder = ResponderFactory :: getErrorResponder ( $ request , $ exception ) ; } try { $ response = $ responder -> getResponse ( ) ; } catch ( NotAuthenticatedException $ exception ) { $ this -> keepCurrentLocator ( $ request ) ; $ request -> setMethod ( HttpRequest :: HTTP_METHOD_GET ) ; $ responder = new IdentityResponder ( $ request ) ; $ response = $ responder -> getResponse ( ) ; } if ( $ response instanceof Response ) { $ this -> alterResponse ( $ response ) ; $ response -> issue ( ) ; } else { throw new HttpException ( 'No response available.' ) ; } }
Obtains a Response to a Request and actions it .
16,408
public function fail ( \ Throwable $ throwable ) { Logger :: get ( ) -> exception ( $ throwable ) ; header ( 'Server error' , true , 500 ) ; echo '<h1>Eix</h1>' ; echo 'The application cannot continue.' ; echo '<blockquote>' . $ throwable -> getMessage ( ) . '</blockquote>' ; if ( defined ( 'DEBUG' ) && DEBUG ) { echo '<pre>' . $ throwable -> getTraceAsString ( ) . '</pre>' ; } die ( - 1 ) ; }
Stops the application and outputs an error .
16,409
public static function getSettings ( ) { try { return self :: getCurrent ( ) -> settings ; } catch ( Exception $ exception ) { throw new SettingsException ( $ exception -> getMessage ( ) , $ exception -> getCode ( ) , $ exception ) ; } }
Provides access to the current application s settings .
16,410
public function handleError ( $ number , $ message , $ file , $ line , array $ context ) { if ( error_reporting ( ) ) { $ message = "PHP error $number: $message\n\tat $file:$line" ; Logger :: get ( ) -> error ( $ message ) ; $ this -> handleException ( new \ RuntimeException ( $ message ) ) ; } }
Eix s way of handling a PHP error is to wrap it in a runtime exception and throw it so that the standard exception handler can catch it .
16,411
public function setLocale ( $ locale = null ) { if ( class_exists ( '\Locale' ) ) { $ this -> locale = \ Locale :: lookup ( $ this -> getAvailableLocales ( ) , $ locale , true , $ this -> getSettings ( ) -> locale -> default ) ; } if ( empty ( $ this -> locale ) ) { $ this -> locale = $ this -> getSettings ( ) -> locale -> default ; } bindtextdomain ( self :: TEXT_DOMAIN_NAME , self :: TEXT_DOMAIN_LOCATION ) ; bind_textdomain_codeset ( self :: TEXT_DOMAIN_NAME , 'UTF-8' ) ; textdomain ( self :: TEXT_DOMAIN_NAME ) ; putenv ( 'LANG=' . $ this -> locale ) ; putenv ( 'LC_MESSAGES=' . $ this -> locale ) ; $ locale = setlocale ( LC_MESSAGES , $ this -> locale ) ; Logger :: get ( ) -> info ( sprintf ( 'Locale is now %s [%s] (domain "%s" at %s)' , $ locale , $ this -> locale , self :: TEXT_DOMAIN_NAME , realpath ( self :: TEXT_DOMAIN_LOCATION ) ) ) ; }
Sets the locale of the application if this locale is available .
16,412
private function keepCurrentLocator ( Request $ request ) { if ( ! @ $ _COOKIE [ self :: LOCATOR_COOKIE_NAME ] ) { $ currentUrl = $ request -> getCurrentUrl ( ) ; if ( ! preg_match ( '#/identity.+#' , $ currentUrl ) ) { setcookie ( self :: LOCATOR_COOKIE_NAME , $ currentUrl , time ( ) + 300 ) ; Logger :: get ( ) -> debug ( 'Current locator stored: ' . $ currentUrl ) ; } } }
Keeps the currently requested URL to be able to retrieve it at a later point .
16,413
public function popLastLocator ( ) { $ lastLocator = @ $ _COOKIE [ self :: LOCATOR_COOKIE_NAME ] ; if ( $ lastLocator ) { setcookie ( self :: LOCATOR_COOKIE_NAME , null , time ( ) - 1 ) ; } return $ lastLocator ; }
Returns the latest stored URL and clears the record .
16,414
private function getAvailableLocales ( ) { if ( empty ( $ this -> availableLocales ) ) { $ pagesDirectory = opendir ( '../data/pages/' ) ; while ( $ directory = readdir ( $ pagesDirectory ) ) { if ( ( $ directory != '.' ) && ( $ directory != '..' ) ) { $ this -> availableLocales [ ] = $ directory ; } } closedir ( $ pagesDirectory ) ; } return $ this -> availableLocales ; }
Gathers all the locales the application can serve .
16,415
protected function getStats ( ) { $ endTime = microtime ( ) - $ this -> startTime ; $ stats = sprintf ( 'Request-response cycle finished: %1.3fs' . ' - Memory usage: %1.2fMB (peak: %1.2fMB)' , $ endTime , memory_get_usage ( true ) / 1048576 , memory_get_peak_usage ( true ) / 1048576 ) ; return $ stats ; }
Gather some runtime statistics .
16,416
public function getLocale ( ) { if ( empty ( $ this -> locale ) ) { $ this -> locale = $ this -> getSettings ( ) -> locale -> default ; } return $ this -> locale ; }
This should probably go in Http \ Request .
16,417
public function isOne ( $ symbols ) { if ( $ this -> type !== self :: TYPE_SYMBOL ) { return false ; } if ( ! is_array ( $ symbols ) ) { $ symbols = func_get_args ( ) ; } return in_array ( $ this -> value , $ symbols ) ; }
Checks if token is a TYPE_SYMBOL matching one of the arguments or one of the symbol contained in the first argument if it is an array
16,418
public function setOptions ( array $ options ) { foreach ( $ options as $ k => $ v ) { $ this -> smarty -> $ k = $ v ; } }
Set Smarty s options
16,419
public function removeEnclosure ( EnclosureInterface $ enclosure ) { foreach ( $ this -> enclosures as $ i => $ itemEnclosure ) { if ( $ itemEnclosure == $ enclosure ) { unset ( $ this -> enclosures [ $ i ] ) ; } } $ this -> enclosures = array_values ( $ this -> enclosures ) ; return $ this ; }
Remove an enclosure from the feed .
16,420
public function handle ( ) { $ cachedPath = SYSTEM . 'cached_configs.php' ; $ configs = $ this -> loadAllConfigs ( ) ; $ this -> file -> put ( $ cachedPath , '<?php return ' . var_export ( $ configs , true ) . ';' . PHP_EOL ) ; $ this -> info ( 'Configuration cached successfully!' ) ; }
handle the command
16,421
public function supportsEntity ( EntityInterface $ entity ) : bool { foreach ( $ this -> mappers as $ mapper ) { if ( $ mapper -> supportsEntity ( $ entity ) ) { return true ; } } return false ; }
Indicates if this mapper can handle the given entity
16,422
public function toEntityFull ( ResourceInterface $ resource , EntityInterface $ entity ) { foreach ( $ this -> mappers as $ mapper ) { if ( $ mapper -> supportsEntity ( $ entity ) ) { $ this -> configureResourceMapper ( $ mapper ) ; $ mapper -> toEntityFull ( $ resource , $ entity ) ; return ; } } throw new UnsupportedTypeException ( $ resource -> type ( ) ) ; }
Maps all fields of the given api resource from post request to the given entity and throws an exception if required elements are missing
16,423
private function constructDatabase ( $ db ) { if ( is_null ( $ this -> dbClass ) ) { if ( is_array ( $ db ) ) { if ( array_keys ( $ db ) !== range ( 0 , count ( $ db ) - 1 ) ) { $ this -> db = new Databases \ AssociativeArray ( $ db ) ; } else { $ this -> db = new Databases \ NumericArray ( $ db ) ; } } elseif ( $ db instanceof \ Illuminate \ Support \ Collection ) { $ this -> db = new Databases \ LaravelCollection ( $ db ) ; } elseif ( $ db instanceof \ Illuminate \ Database \ Eloquent \ Builder || $ db instanceof \ Illuminate \ Database \ Eloquent \ Relations \ Relation ) { $ this -> db = new Databases \ LaravelEloquent ( $ db ) ; } elseif ( ! is_object ( $ db ) ) { throw new InvalidArgumentException ( 'Database must be an object or array' ) ; } else { $ class_name = get_class ( $ db ) ; throw new DomainException ( "Please add database class for handling $class_name objects" ) ; } } else { $ this -> db = new $ dbClass ( $ db ) ; } }
Instantiate the database .
16,424
private function constructColumnHeaders ( ) { foreach ( $ this -> columnHeaders as $ column_name => $ column_key ) { $ this -> columnHeaderObjects [ ] = new TableColumnHeader ( $ this , $ this -> request , $ column_key , $ column_name ) ; } }
Instantiate the column headers .
16,425
private function constructFilters ( ) { foreach ( $ this -> filters as $ filter_name => $ filter_options ) { $ this -> filterObjects [ ] = new TableFilter ( $ this -> request , $ filter_name , $ filter_options ) ; } }
Instantiate the filters .
16,426
private function runFilters ( ) { foreach ( $ this -> filterObjects as $ filter ) { $ filter_key = $ filter -> getKey ( ) ; if ( $ this -> request -> has ( $ filter_key ) ) { $ filter_option = ucfirst ( preg_replace ( '/[^a-z0-9]/i' , ' ' , $ this -> request -> input ( $ filter_key ) ) ) ; $ filter_key = ucfirst ( preg_replace ( '/[^a-z0-9]/i' , ' ' , $ filter_key ) ) ; if ( ! in_array ( $ filter_option , $ this -> filters [ $ filter_key ] ) ) { continue ; } $ filter_method = 'filter' . Str :: studly ( $ filter_key ) . Str :: studly ( $ filter_option ) ; if ( method_exists ( $ this , $ filter_method ) ) { $ this -> $ filter_method ( ) ; } } } }
Run the filters .
16,427
private function runSorting ( ) { $ sort_method = 'sort' . studly_case ( $ this -> sortKey ) ; if ( method_exists ( $ this , $ sort_method ) ) { $ this -> $ sort_method ( $ this -> sortOrder ) ; } else { $ this -> db -> sort ( $ this -> sortKey , $ this -> sortOrder ) ; } }
Run the sorting .
16,428
public function paginate ( $ perPage = 15 , $ columns = [ '*' ] , $ pageName = 'page' , $ page = null ) { $ per_page = ( $ this -> request -> has ( 'per_page' ) ) ? $ this -> request -> get ( 'per_page' ) : $ perPage ; $ paginator = $ this -> db -> paginate ( $ per_page , $ columns , $ pageName , $ page ) ; $ paginator -> appends ( $ this -> request -> all ( ) ) ; return $ paginator ; }
Return paginated rows .
16,429
public function paginator ( ) { $ paginator = $ this -> paginate ( ) ; if ( ! is_null ( $ this -> presenter ) ) { return ( new $ this -> presenter ( $ paginator ) ) -> render ( ) ; } return $ paginator -> render ( ) ; }
Return the paginator presenter markup .
16,430
static function retriveTokensByScope ( $ scope , $ domain = null ) { $ kind_schema = self :: getGoogleAccessTokenKind ( ) ; $ str_query = "SELECT * FROM $kind_schema WHERE scopes='$scope'" ; if ( ! is_null ( $ domain ) ) { $ str_query = $ str_query . " AND domain='$domain'" ; } return self :: fetchAll ( $ kind_schema , $ str_query ) ; }
Function that retrives users and tokens based on URL . used for background processing in bulk .
16,431
static function retrieveMostCurrentWorkflowJobByAgeAndStatus ( $ workflow_key , $ status , $ created_after ) { $ kind_schema = self :: getWorkflowJobKind ( ) ; $ store = self :: store ( $ kind_schema ) ; $ obsolete_time = new \ DateTime ( $ created_after ) ; $ where = [ "workflow_key" => $ workflow_key , "status" => $ status , "obsolete_time" => $ obsolete_time ] ; syslog ( LOG_INFO , __METHOD__ . " with vars " . json_encode ( $ where ) ) ; $ str_query = "SELECT * FROM $kind_schema WHERE workflow_key = @workflow_key AND status = @status AND created > @obsolete_time ORDER BY created DESC" ; $ result = $ store -> fetchOne ( $ str_query , $ where ) ; if ( $ result ) { return $ result -> getData ( ) ; } else { return false ; } }
Used to check if job is running and getting last successful job run to retrieve state .
16,432
public function set ( $ name , $ value = null ) { if ( is_array ( $ name ) ) { $ this -> parameters = array_replace ( $ this -> parameters , $ name ) ; } else { $ this -> parameters [ trim ( strtolower ( $ name ) ) ] = is_string ( $ value ) ? trim ( $ value ) : $ value ; } }
Save a value
16,433
public function add ( $ name , $ value = null ) { $ name = trim ( $ name ) ; if ( ! isset ( $ this -> parameters [ $ name ] ) ) { $ this -> parameters [ $ name ] = [ ] ; } elseif ( ! is_array ( $ this -> parameters [ $ name ] ) ) { $ this -> parameters [ $ name ] = ( array ) $ this -> parameters [ $ name ] ; } $ this -> parameters [ $ name ] [ ] = $ value ; }
Adds a subvalue
16,434
public static function update ( $ id , $ keysValues , $ table , $ idAttribute = 'id' , $ limit = 1 ) { if ( is_object ( $ keysValues ) ) { $ keysValues = ( array ) $ keysValues ; } $ queryKeys = implode ( '" = ?,"' , array_keys ( $ keysValues ) ) ; $ queryValues = array_values ( $ keysValues ) ; $ queryValues [ ] = $ id ; $ tableName = '' ; if ( is_object ( $ table ) ) { $ table = ( array ) $ table ; } if ( is_array ( $ table ) && isset ( $ table [ 'schema' ] ) && isset ( $ table [ 'table' ] ) ) { $ tableName = sprintf ( '"%s"."%s"' , $ table [ 'schema' ] , $ table [ 'table' ] ) ; } else { $ tableName = sprintf ( '"%s"' , $ table ) ; } $ query = sprintf ( 'UPDATE %s SET "%s" = ? WHERE "%s" = ? %s' , $ tableName , $ queryKeys , $ idAttribute , ( $ limit === null ? '' : '' ) ) ; $ result = Database :: execute ( $ query , $ queryValues ) ; return $ result ; }
Update database records
16,435
public static function formatDate ( $ time , $ format = DATE_ISO8601 , $ timezone = 'UTC' ) { return static :: create ( $ time , $ timezone ) -> format ( $ format ) ; }
Returns date formatted according to the specified format and timezone
16,436
public static function compare ( $ date1 , $ date2 ) : int { $ d1 = static :: create ( $ date1 ) ; $ d2 = static :: create ( $ date2 ) ; return ( $ d1 > $ d2 ) ? static :: DATETIME_GREATER : ( ( $ d1 < $ d2 ) ? static :: DATETIME_LESS : static :: DATETIME_EQUAL ) ; }
Return comparision result of 2 datetime object
16,437
public static function ParseCoreVersion ( $ Path ) { $ fp = fopen ( $ Path , 'rb' ) ; $ Application = FALSE ; $ Version = FALSE ; while ( ( $ Line = fgets ( $ fp ) ) !== FALSE ) { if ( preg_match ( "`define\\('(.*?)', '(.*?)'\\);`" , $ Line , $ Matches ) ) { $ Name = $ Matches [ 1 ] ; $ Value = $ Matches [ 2 ] ; switch ( $ Name ) { case 'APPLICATION' : $ Application = $ Value ; break ; case 'APPLICATION_VERSION' : $ Version = $ Value ; } } if ( $ Application !== FALSE && $ Version !== FALSE ) break ; } fclose ( $ fp ) ; return $ Version ; }
Parse the version out of the core s index . php file .
16,438
public function setPostContent ( ) { $ content = "---\n" ; $ content .= "type: " . $ this -> properties [ 'type' ] . "\n" ; $ content .= "layout: " . $ this -> properties [ 'layout' ] . "\n" ; $ content .= "title: " . $ this -> properties [ 'title' ] . "\n" ; $ content .= "date: " . Date ( 'Y-m-d' ) . "\n" ; $ content .= "dateFormat: 'F d, Y' \n" ; $ content .= "url: :year/:month/:date/:title \n" ; $ content .= "author: " . $ this -> properties [ 'author' ] . " \n" ; $ content .= "categories: " . implode ( ',' , $ this -> properties [ 'categories' ] ) . "\n" ; $ content .= "featuredImage: " . $ this -> properties [ 'featuredImage' ] . "\n" ; $ content .= "---\n" ; $ content .= $ this -> properties [ 'body' ] ; return $ content ; }
Set post metadata template
16,439
public function init ( ) { if ( TIGA_DEBUG == true && ! $ this -> app -> isConsole ( ) ) { $ whoops = new \ Whoops \ Run ( ) ; if ( $ this -> app [ 'request' ] -> isJson ( ) ) { $ whoops -> pushHandler ( new \ Whoops \ Handler \ JsonResponseHandler ( ) ) ; } else { $ whoops -> pushHandler ( new \ Whoops \ Handler \ PrettyPageHandler ( ) ) ; } $ whoops -> register ( ) ; } }
Init Whoops based on App conditional rule .
16,440
public function setType ( $ type ) { $ this -> type = $ type ; switch ( $ type ) { case 'text' : case 'string' : $ this -> operatorOpts = [ 'equals' , 'notequals' , 'contains' ] ; break ; case 'integer' : $ this -> operatorOpts = [ 'equals' , 'notequals' , 'greaterthan' , 'lessthan' ] ; break ; case 'boolean' : $ this -> operatorOpts = [ 'equals' ] ; break ; } return $ this ; }
Set the type and predefine the operatorOpts by type
16,441
protected function addCaptchaElement ( ) { if ( ! $ this -> getCaptchaOptions ( ) || $ this -> has ( 'captcha' ) ) { return ; } $ spec = array_replace_recursive ( $ this -> captchaElementSpec , [ 'name' => $ this -> getCaptchaElementName ( ) , 'options' => [ 'captcha' => $ this -> getCaptchaOptions ( ) , ] , ] ) ; $ this -> add ( $ spec , [ 'priority' => - 970 ] ) ; }
Setup CAPTCHA protection
16,442
protected function addCsrfElement ( ) { if ( $ this -> has ( 'csrf' ) ) { return ; } $ spec = array_replace_recursive ( $ this -> csrfElementSpec , [ 'name' => $ this -> getCsrfElementName ( ) , 'options' => [ 'csrf_options' => [ 'timeout' => $ this -> getFormTimeout ( ) , ] , ] , ] ) ; $ this -> add ( $ spec , [ 'priority' => - 980 ] ) ; }
Setup CSRF protection
16,443
public function evaluateWebPage ( ) { try { $ renderer = new PageRenderer ( $ this -> webPage , $ this -> uriVariables ) ; $ this -> response = $ renderer -> evaluatePage ( ) ; $ this -> rawRequestBody = $ this -> response -> getResult ( ) ; } catch ( WebException $ e ) { $ this -> thrownWebException = $ e ; $ this -> rawRequestBody = $ this -> createRequestBodyFromException ( ) ; } finally { $ this -> evaluated = true ; } }
Evaluates the given webpage and handles any occuring error
16,444
public function createHeader ( ) { if ( $ this -> router -> isTestRun ( ) ) { return ; } http_response_code ( $ this -> getStatusCode ( ) ) ; if ( $ this -> response === null ) { header ( Header :: CONTENT_TYPE . ":" . $ this -> getContentType ( ) ) ; } else { foreach ( $ this -> response -> getHeaders ( ) as $ header => $ value ) { header ( $ header . ":" . $ value ) ; } } }
Method to set all necessary fields for the response header such as the content type or the status code .
16,445
public function getRequestBody ( ) { if ( ! $ this -> evaluated ) { $ this -> evaluateWebPage ( ) ; } if ( $ this -> webPage instanceof JsonPage ) { $ serializer = $ this -> router -> getJsonSerializer ( ) ; return $ serializer -> serialize ( $ this -> rawRequestBody ) ; } else { return $ this -> rawRequestBody ; } }
Method to get the request body from the given web page .
16,446
public function getArchitecture ( ) { $ int = $ this -> variant -> architecture ( ) ; $ possible = [ 0 => 'x86' , 1 => 'MIPS' , 2 => 'Alpha' , 3 => 'PowerPC' , 6 => 'ia64' , 9 => 'x64' , ] ; return $ this -> getFromPossibleValues ( $ int , $ possible ) ; }
Returns the processor architecture .
16,447
public function getProcessorType ( ) { $ int = $ this -> variant -> processorType ( ) ; $ possible = [ 1 => 'Other' , 2 => 'Unknown' , 3 => 'Central Processor' , 4 => 'Math Processor' , 5 => 'DSP Processor' , 6 => 'Video Processor' , ] ; return $ this -> getFromPossibleValues ( $ int , $ possible ) ; }
The ProcessorType property specifies the processor s primary function .
16,448
private function action ( ActionHandler $ handler ) { try { $ presenter = $ this -> presenterFactory -> createPresenter ( $ handler -> presenter , $ handler -> args ) ; } catch ( \ Exception $ e ) { throw new InternalServerErrorException ( $ e -> getMessage ( ) ) ; } if ( ! method_exists ( $ presenter , $ handler -> action ) ) { throw new BadFunctionCallException ( sprintf ( "Can not call `%s`." , $ handler -> action ) ) ; } $ presenter -> startup ( ) ; call_user_func_array ( [ $ presenter , $ handler -> action ] , [ ] ) ; $ response = $ this -> httpResponse ; if ( ! $ response -> isRedirect ( ) && empty ( $ response -> contents ) ) { $ response -> contents = $ presenter -> render ( ) ; } unset ( $ presenter ) ; }
Process website presenter life - cycle
16,449
public function save ( $ object ) { if ( is_array ( $ object ) ) { $ objectData = $ object ; if ( $ object [ 'id' ] > 0 ) { $ object = $ this -> find ( $ object [ 'id' ] ) ; } else { $ object = $ this -> createNewObject ( ) ; } $ this -> assignArrayToObject ( $ object , $ objectData ) ; } else if ( ! $ this -> isCorrectInstance ( $ object ) ) { $ this -> addErrorMessage ( self :: ERROR_WRONG_OBJECT ) ; } if ( ! $ this -> hasError ( ) ) { $ check = $ this -> manager -> save ( $ object ) ; if ( $ check ) { $ this -> addSuccessMessage ( self :: SUCCESS_SAVED ) ; } } return $ object ; }
save a object you can pass the Site object or an array with the fields if you pass an array the keys must be with underscore and not with CamelCase
16,450
public function getOldInput ( $ key ) { $ this -> input = $ this -> request -> hasOldInput ( ) !== false ? $ this -> request -> oldInput ( ) : array ( ) ; return array_get ( $ this -> input , $ this -> transformKey ( $ key ) , null ) ; }
Get old input by key .
16,451
private function filters ( $ value , $ type = null , $ safe = true ) { if ( $ type == "date" ) { $ ret = $ this -> convertDate ( $ value , false ) ; return $ ret ; } if ( $ type == "datetime-local" ) { return $ ret = strtotime ( $ value ) ; } if ( $ type == "date_string" ) { return date ( "Y-m-d" , \ AsyncWeb \ Date \ Time :: getUnix ( $ this -> convertDate ( $ value , false ) ) ) ; } if ( $ type == "number" ) { $ value = str_replace ( " " , "" , $ value ) ; $ value = str_replace ( "," , "." , $ value ) ; } if ( ! $ safe ) { if ( ( $ val = $ this -> execute ( $ value ) ) !== false ) { return $ val ; } } return $ value ; }
This function makes the input filters and parses php also cleans the number format from spaces and replaces to .
16,452
public function show ( $ what = "ALL" , $ show_results = true ) { $ ret = "" ; if ( $ show_results ) $ ret .= $ this -> show_results ( ) ; if ( @ $ this -> data [ "expectRight" ] ) if ( ! Group :: is_in_group ( $ this -> data [ "expectRight" ] ) ) return ; if ( $ this -> insertingN2N ) { $ what = "INSERT" ; } switch ( $ what ) { case "INSERT" : $ ret .= $ this -> insertForm ( ) ; break ; case "UPDATE1" : $ ret .= $ this -> update1Form ( ) ; break ; case "UPDATE2" : $ ret .= $ this -> update2Form ( ) ; break ; case "DELETE" : $ ret .= $ this -> deleteForm ( ) ; break ; case "ONLY_INSERT" : $ ret .= $ this -> makeCoverFront ( ) ; $ ret .= $ this -> show ( "INSERT" ) ; $ ret .= $ this -> makeCoverBack ( ) ; break ; case "ONLY_UPDATE" : $ ret .= $ this -> makeCoverFront ( ) ; $ ret .= $ this -> show ( "UPDATE2" ) ; $ ret .= $ this -> makeCoverBack ( ) ; break ; case "ALL_UPDATE_FIRST" : $ formName = $ this -> data [ "uid" ] ; $ ret .= $ this -> makeCoverFront ( ) ; if ( URLParser :: v ( $ formName . " UPDATE1" ) || URLParser :: v ( $ formName . " UPDATE2" ) ) { $ ret .= $ this -> show ( "UPDATE2" ) ; } else { $ ret .= $ this -> show ( "UPDATE1" ) ; $ ret .= $ this -> show ( "INSERT" ) ; $ ret .= $ this -> show ( "DELETE" ) ; } $ ret .= $ this -> makeCoverBack ( ) ; break ; case "ALL" : if ( @ URLParser :: v ( $ formName . " UPDATE1" ) || @ URLParser :: v ( $ formName . " UPDATE2" ) ) { $ ret .= $ this -> show ( "UPDATE2" ) ; } else { return $ ret . \ AsyncWeb \ View \ MakeDBView :: make ( $ this -> data , $ this ) ; } break ; } return $ ret ; }
Tato funkcia zobrazi formular parametre .. ALL .. zobrazi vsetky insert update a delete formulare INSERT .. zobrazi iba formular na vkladanie ONLY_INSERT .. zobrazi iba formular na vkladanie s obalom UPDATE1 .. zobrazi iba formular na upravovanie UPDATE2 .. zobrazi iba formular na upravovanie ale musi byt vybrany riadok DELETE .. zobrazi iba formular na mazanie
16,453
public function routeSave ( MvcEvent $ event ) { $ match = $ event -> getRouteMatch ( ) ; if ( ! $ match || ! $ event -> getRequest ( ) instanceof HttpRequest ) { return ; } if ( $ event -> getParam ( 'route-cached' ) || ! $ event -> getParam ( 'route-cacheable' ) ) { return ; } $ path = $ event -> getRequest ( ) -> getUri ( ) -> getPath ( ) ; $ services = $ event -> getApplication ( ) -> getServiceManager ( ) ; $ cacheName = $ services -> get ( RouterCacheOptions :: class ) -> getCache ( ) ; $ cache = $ services -> get ( $ cacheName ) ; $ cacheKey = $ this -> getCacheKey ( $ path ) ; $ name = $ match -> getMatchedRouteName ( ) ; $ data = [ 'name' => $ name , 'spec' => [ 'type' => 'Literal' , 'options' => [ 'route' => $ path , 'defaults' => $ match -> getParams ( ) , ] , ] , ] ; $ routes = $ services -> get ( 'Config' ) [ 'router' ] [ 'routes' ] ; if ( isset ( $ routes [ $ name ] ) ) { $ data [ 'spec' ] = array_replace_recursive ( $ routes [ $ name ] , $ data [ 'spec' ] ) ; } $ cache -> setItem ( $ cacheKey , $ data ) ; }
Method that tries to save a route match into a cache
16,454
final public function apply ( callable $ function , array $ args = [ ] ) : self { iterator_apply ( $ this , function ( CollectionType $ collection ) use ( $ function , $ args ) { $ collection -> set ( $ collection -> key ( ) , $ function ( $ collection -> current ( ) , $ args ) ) ; return true ; } , [ $ this -> toArray ( ) ] ) ; return $ this ; }
Apply a callback to every element of the collection
16,455
final public function filter ( callable $ filter , array $ args = [ ] ) : self { $ collection = new Collection ( ) ; iterator_apply ( $ this , function ( IteratorAggregate $ iterator ) use ( $ filter , $ args , & $ collection ) { if ( $ filter ( $ iterator -> current ( ) , $ args ) === true ) { $ collection -> set ( $ iterator -> key ( ) , $ iterator -> current ( ) ) ; } return true ; } , [ $ this -> toArray ( ) ] ) ; return $ collection ; }
Filter the current collection by a user - defined function
16,456
public function first ( callable $ filter = null , array $ args = [ ] , $ default = null ) { $ filtered = ( $ filter === null ) ? $ this : $ this -> filter ( $ filter , $ args ) ; return empty ( $ filtered ) ? $ default : reset ( $ filtered ) ; }
Return first element matching criteria
16,457
public function last ( callable $ filter = null , array $ args = [ ] , $ default = null ) { $ filtered = ( $ filter === null ) ? $ this : $ this -> filter ( $ filter , $ args ) ; return empty ( $ filtered ) ? $ default : end ( $ filtered ) ; }
Return last element matching criteria
16,458
public function exists ( $ offset ) : bool { $ offsets = is_array ( $ offset ) ? $ offset : func_get_args ( ) ; foreach ( $ offsets as $ key ) { if ( ! $ this -> offsetExists ( $ key ) ) { return false ; } } return true ; }
Check that an offset or series of offsets exists
16,459
final public function count ( ) : int { if ( isset ( $ this -> size ) ) { return $ this -> size ; } return $ this -> size = count ( $ this -> data ) ; }
Counts the items in the set
16,460
final private function getCachedIterator ( ) : CachingIterator { if ( isset ( $ this -> iterator ) ) { return $ this -> iterator ; } return $ this -> iterator = new CachingIterator ( new ArrayIterator ( $ this -> data ) , CachingIterator :: TOSTRING_USE_CURRENT | CachingIterator :: FULL_CACHE ) ; }
Get the cache
16,461
public static function getLogo ( ) { $ file_logo_app = app_path ( 'logo.txt' ) ; if ( file_exists ( $ file_logo_app ) ) return file_get_contents ( $ file_logo_app ) ; $ file_logo = __DIR__ . '/Resources/logo.txt' ; if ( file_exists ( $ file_logo ) ) return file_get_contents ( $ file_logo ) ; return '' ; }
Rerurn logo ASCII
16,462
protected function getDefaultCommands ( ) { $ commands = parent :: getDefaultCommands ( ) ; $ commands [ ] = new Command \ AboutCommand ( $ this -> app ) ; $ commands [ ] = new Command \ StopCommand ( $ this -> app ) ; $ cmds = config ( 'app.commands' , [ ] ) ; foreach ( $ cmds as $ cid => $ cClass ) { $ cid = sprintf ( 'command.%s' , $ cid ) ; $ this -> app -> bind ( $ cid , $ cClass ) ; $ commands [ ] = $ this -> app [ $ cid ] ; } if ( ( 'phar:' !== substr ( __FILE__ , 0 , 5 ) ) && ( class_exists ( '\Consolle\Command\MakeCommand' ) ) ) $ commands [ ] = new \ Consolle \ Command \ MakeCommand ( $ this -> app ) ; if ( ( 'phar:' !== substr ( __FILE__ , 0 , 5 ) ) && ( class_exists ( '\Consolle\Command\OptimizeCommand' ) ) ) $ commands [ ] = new \ Consolle \ Command \ OptimizeCommand ( $ this -> app ) ; if ( ( 'phar:' !== substr ( __FILE__ , 0 , 5 ) ) && ( class_exists ( '\Consolle\Command\SelfCompilerCommand' ) ) ) $ commands [ ] = new \ Consolle \ Command \ SelfCompilerCommand ( $ this -> app ) ; if ( ( 'phar:' === substr ( __FILE__ , 0 , 5 ) ) && ( class_exists ( '\Consolle\Command\SelfCompilerCommand' ) ) && ( file_exists ( base_path ( 'update.json' ) ) ) ) $ commands [ ] = new \ Consolle \ Command \ SelfUpdateCommand ( $ this -> app ) ; return $ commands ; }
Initializes all the commands default
16,463
public function compile ( $ expression , $ names = array ( ) ) { return $ this -> getCompiler ( ) -> compile ( $ this -> parse ( $ expression , $ names ) -> getNodes ( ) ) -> getSource ( ) ; }
Compiles an expression source code .
16,464
public function destroyRegisteredSsoClientSessions ( SessionInterface $ session ) { if ( ! $ session -> isStarted ( ) ) { return ; } $ ssoClients = $ this -> getRegisteredSsoClients ( $ session ) ; $ sessionId = $ session -> getId ( ) ; $ ssoServer = $ this -> ssoServerFactory -> create ( ) ; $ this -> ssoClientNotifier -> destroySession ( $ ssoServer , $ sessionId , $ ssoClients ) ; }
Destroy the given session on registered SSO clients
16,465
public function findAllWithConfigGroups ( ) { $ query = $ this -> createQueryBuilder ( 's' ) -> select ( 's' , 'g' ) -> innerJoin ( 's.configGroups' , 'g' ) -> orderBy ( 's.position' , 'ASC' ) -> getQuery ( ) ; $ result = $ query -> getResult ( ) ; return $ result ; }
Find all section with their groups
16,466
public function one ( $ style = PDO :: FETCH_ASSOC ) { $ stmt = $ this -> execute ( ) ; if ( $ stmt ) { return $ stmt -> fetch ( $ style ) ; } else { return false ; } }
Executes a query and returns the first row .
16,467
public function all ( $ style = PDO :: FETCH_ASSOC ) { $ stmt = $ this -> execute ( ) ; if ( $ stmt ) { return $ stmt -> fetchAll ( $ style ) ; } else { return false ; } }
Executes a query and returns all of the rows .
16,468
public function column ( $ index = 0 ) { $ stmt = $ this -> execute ( ) ; if ( $ stmt ) { return $ stmt -> fetchAll ( PDO :: FETCH_COLUMN , $ index ) ; } else { return false ; } }
Executes a query and returns a column from all rows .
16,469
public function scalar ( $ index = 0 ) { $ stmt = $ this -> execute ( ) ; if ( $ stmt ) { return $ stmt -> fetchColumn ( $ index ) ; } else { return false ; } }
Executes a query and returns a value from the first row .
16,470
public static function isBase64Encoded ( $ str ) { $ debug = \ bdk \ Debug :: getInstance ( ) ; return $ debug -> utilities -> isBase64Encoded ( $ str ) ; }
Checks if a given string is base64 encoded
16,471
public static function isUrl ( $ url , $ opts = array ( ) ) { $ opts = \ array_merge ( array ( 'requireSchema' => true , ) , $ opts ) ; $ urlRegEx = '@^' . ( $ opts [ 'requireSchema' ] ? 'https?://' : '(https?://)?' ) . '[-\w\.]+' . '(:\d+)?' . '(' . '/' . '(' . '[-\w/\.,%:]*' . '(\?\S+)?' . '(#\S*)?' . ')?' . ')?' . '$@' ; return \ preg_match ( $ urlRegEx , $ url ) > 0 ; }
Is the passed string a URL?
16,472
public static function fromCamelToUnder ( $ data ) { $ transformed = [ ] ; foreach ( $ data as $ camelKey => $ value ) { $ transformed [ self :: unCamelize ( $ camelKey ) ] = $ value ; } return $ transformed ; }
Transform an array s keys from camelCase to under_score
16,473
public static function arrayFromCamelToUnder ( $ arrData ) { $ transformed = [ ] ; foreach ( $ arrData as $ index => $ data ) { foreach ( $ data as $ camelKey => $ value ) { $ transformed [ $ index ] [ self :: unCamelize ( $ camelKey ) ] = $ value ; } } return $ transformed ; }
Transform arrays keys from camelCase to under_score
16,474
public static function transliterateStr ( $ str ) { $ rule = 'Any-Latin; Latin-ASCII;' ; $ transliterator = \ Transliterator :: create ( $ rule ) ; return $ transliterator -> transliterate ( $ str ) ; }
Transliterate special characters to LATIN characters
16,475
public static function getControllerName ( $ qualifiedControllerName ) { $ nsComponents = explode ( '\\' , $ qualifiedControllerName ) ; $ ctrlName = str_replace ( 'Controller' , '' , end ( $ nsComponents ) ) ; return $ ctrlName ; }
Get the controller name from a full qualified class name
16,476
public static function csvFileToArray ( $ filename = '' , $ delimiter = ',' ) { $ header = null ; $ data = [ ] ; if ( ( $ handle = fopen ( $ filename , 'r' ) ) !== false ) { while ( ( $ row = fgetcsv ( $ handle , 1000 , $ delimiter ) ) !== false ) { if ( ! $ header ) { $ header = $ row ; } else { $ data [ ] = array_combine ( $ header , $ row ) ; } } fclose ( $ handle ) ; } return $ data ; }
Transform csv file into array data
16,477
public static function csvFileToArrayGenerator ( string $ filename = '' , string $ delimiter = ',' ) { $ complete = false ; try { $ header = null ; if ( ( $ handle = fopen ( $ filename , 'r' ) ) !== false ) { while ( ( $ row = fgetcsv ( $ handle , 4096 , $ delimiter ) ) !== false ) { if ( ! $ header ) { $ header = $ row ; } else { yield array_combine ( $ header , $ row ) ; } } } $ complete = true ; } finally { if ( ! $ complete ) { } else { } } }
Read a csv using a generator in order to avoid memory issues
16,478
public static function arrayToCsvFile ( $ filename , $ data ) { $ fp = fopen ( $ filename , 'w' ) ; foreach ( $ data as $ fields ) { fputcsv ( $ fp , $ fields ) ; } fclose ( $ fp ) ; }
Transform array data to csv file
16,479
public static function shortenAndCapitalize ( $ string ) { $ result = '' ; $ parts = explode ( ' ' , trim ( $ string ) ) ; foreach ( $ parts as $ part ) { $ result = $ result . strtoupper ( mb_substr ( $ part , 0 , 1 ) ) ; } return $ result ; }
Shorten a string ant transform into capitals john van helsing will be JVH
16,480
public function get ( $ pattern , $ handler , array $ requirements = [ ] , array $ defaults = [ ] ) { $ this -> addRoute ( 'GET' , $ pattern , $ handler , $ requirements , $ defaults ) ; }
Adds a GET route to the collection .
16,481
public function head ( $ pattern , $ handler , array $ requirements = [ ] , array $ defaults = [ ] ) { $ this -> addRoute ( 'HEAD' , $ pattern , $ handler , $ requirements , $ defaults ) ; }
Adds a HEAD route to the collection
16,482
public function patch ( $ pattern , $ handler , array $ requirements = [ ] , array $ defaults = [ ] ) { $ this -> addRoute ( 'PATCH' , $ pattern , $ handler , $ requirements , $ defaults ) ; }
Adds a PATCH route to the collection
16,483
public function any ( $ pattern , $ handler , array $ requirements = [ ] , array $ defaults = [ ] ) { $ this -> addRoute ( 'GET|HEAD|POST|PUT|PATCH|DELETE' , $ pattern , $ handler , $ requirements , $ defaults ) ; }
Adds a route to the collection that handles all available request methods .
16,484
public function addRoute ( $ methods , $ pattern , $ handler , array $ requirements = [ ] , array $ defaults = [ ] ) { list ( $ name , $ host , $ schemes , $ constraints ) = $ this -> parseRequirements ( $ this -> extendRequirements ( $ requirements ) , $ methods ) ; $ route = new Route ( $ this -> prefixPattern ( $ pattern ) , $ handler , is_array ( $ methods ) ? $ methods : explode ( '|' , $ methods ) , $ host , $ defaults , $ constraints , is_array ( $ schemes ) ? $ schemes : explode ( '|' , $ schemes ) ) ; $ this -> routes -> add ( $ name , $ route ) ; }
Adds a route to the collection that handles the given request methods .
16,485
public function group ( $ prefix , array $ requirements = [ ] , callable $ groupConstructor = null ) { $ this -> enterGroup ( $ prefix , $ requirements ) ; if ( null !== $ groupConstructor ) { call_user_func ( $ groupConstructor , $ this ) ; $ this -> leaveGroup ( ) ; } }
Starts a new entry point for grouping routes .
16,486
protected function load ( $ parentDirectory ) { while ( false !== ( $ entry = $ parentDirectory -> read ( ) ) ) { if ( $ entry !== '.' && $ entry !== '..' ) { if ( is_dir ( $ entry ) ) { $ tmpD = dir ( $ entry ) ; $ this -> load ( $ tmpD ) ; $ tmpD -> close ( ) ; } else if ( substr ( $ entry , - strlen ( '.php' ) ) === '.php' ) { $ this [ substr ( $ entry , 0 , - strlen ( '.php' ) ) ] = include $ this -> getPath ( ) . $ entry ; } } } }
Load item from configs
16,487
public function loadAll ( ) { $ this -> setAll ( array ( ) ) ; $ d = dir ( $ this -> getPath ( ) ) ; $ this -> load ( $ d ) ; $ d -> close ( ) ; }
Load all configuration files to be available
16,488
protected static function getMimetypeFromLocalFilePath ( $ filePath ) { $ mimetype = getMimeType ( $ filePath ) ; if ( $ mimetype !== 'text/plain' ) { return $ mimetype ; } return static :: getMimetypeFromExtension ( pathinfo ( $ filePath , PATHINFO_EXTENSION ) ) ; }
Get mimetype from local file path
16,489
public static function parse ( $ record ) : Record { if ( $ record instanceof Record ) { return $ record ; } if ( $ record instanceof stdClass ) { $ record = ( array ) $ record ; } if ( is_array ( $ record ) ) { return static :: make ( $ record ) ; } $ type = gettype ( $ record ) ; if ( $ type === TYPE_OBJECT ) { $ type = get_class ( $ type ) ; } throw new SimplesRunTimeError ( "Record must be an array or instanceof Record '{$type}' given" ) ; }
Convert data into a Record instance
16,490
public function set ( string $ name , $ value ) : Record { if ( ! $ this -> isEditable ( ) ) { throw new SimplesRecordReadonlyError ( [ 'set' => [ $ name => $ value ] ] ) ; } $ this -> public [ $ name ] = $ value ; return $ this ; }
Set a value of the Record
16,491
public function copy ( string $ target , string $ source , bool $ override = false ) { if ( is_null ( $ this -> get ( $ target ) ) || $ override ) { $ this -> set ( $ target , $ this -> get ( $ source ) ) ; } return $ this ; }
Copy the value of one index to another
16,492
public function remove ( string $ name ) : Record { if ( ! $ this -> isEditable ( ) ) { throw new SimplesRecordReadonlyError ( [ 'remove' => $ name ] ) ; } unset ( $ this -> public [ $ name ] ) ; return $ this ; }
Remove a key and associated value of the Record
16,493
public function setPrivate ( string $ name ) : Record { if ( $ this -> indexOf ( $ name ) ) { $ this -> private [ $ name ] = $ this -> public [ $ name ] ; unset ( $ this -> public [ $ name ] ) ; } return $ this ; }
Make a property hidden
16,494
public function setPublic ( string $ name ) : Record { if ( $ this -> indexOf ( $ name , false ) ) { $ this -> public [ $ name ] = $ this -> private [ $ name ] ; unset ( $ this -> private [ $ name ] ) ; } return $ this ; }
Make a property be public
16,495
public function merge ( array $ public , array $ private = [ ] ) : Record { $ public = array_merge ( $ this -> public , $ public ) ; $ private = array_merge ( $ this -> private , $ private ) ; if ( $ this -> isEditable ( ) ) { $ this -> public = $ public ; $ this -> private = $ private ; return $ this ; } return static :: make ( $ public , $ this -> isEditable ( ) , $ this -> mutations , $ this -> private ) ; }
This method merge an array of data to record overriding the previously value of the keys
16,496
public function import ( array $ public , array $ private = [ ] ) : Record { $ public = array_merge ( $ public , $ this -> public ) ; $ private = array_merge ( $ private , $ this -> private ) ; if ( $ this -> isEditable ( ) ) { $ this -> public = $ public ; $ this -> private = $ private ; return $ this ; } return static :: make ( $ public , $ this -> isEditable ( ) , $ this -> mutations , $ this -> private ) ; }
This method import an array of data to record keeping the previously value of the keys
16,497
public function update ( array $ public , array $ private = [ ] ) : Record { if ( $ this -> isEditable ( ) ) { $ this -> public = $ public ; if ( count ( $ private ) ) { $ this -> private = $ private ; } return $ this ; } return static :: make ( $ public , $ this -> isEditable ( ) , $ this -> mutations , $ this -> private ) ; }
Update all data in Record
16,498
public function indexOf ( string $ name , bool $ public = true ) { if ( $ public ) { return isset ( $ this -> public [ $ name ] ) ; } return isset ( $ this -> private [ $ name ] ) ; }
Check is exists a property into Record
16,499
public function getService ( $ name ) { $ container = $ this -> getContainer ( ) ; return ! is_null ( $ container ) && isset ( $ container [ $ name ] ) ? $ container [ $ name ] : null ; }
Get service in container