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 ) . "... | 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'... | 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... | 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 ( \ Th... | 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 = $ resp... | 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 ... | 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 ( ) -> local... | 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 ( ) -> deb... | 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 ( $ pag... | 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 Unsupported... | 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 i... | 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... | 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... | 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 ,... | 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" => $ ... | 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 -... | 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 [ ] = $ i... | 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... | 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 ... | 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 \ Pre... | 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 ... | 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 ( ) , ] , ] ) ; $ th... | 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 , [ 'prio... | 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 -> ... | 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 ... | 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 -> ac... | 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 -> isCorrec... | 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 \ ... | 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 ( ... | 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 riado... |
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 ( ) -> ge... | 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... | 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 ( $ ... | 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 ... | 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 -> ssoClientNotifie... | 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*)?' . ')?' . ')?' . '... | 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_com... | 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 = $ ro... | 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 ( $ pa... | 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' ) ) ===... | 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 ) { $ typ... | 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... | 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 stati... | 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 -> priv... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.