idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
52,400 | private function scanDir ( $ path ) { if ( ! is_dir ( $ path ) ) return ; $ finder = $ this -> createFinder ( ) ; $ rootSPL = new DirectoryResource ( $ path ) ; $ rootResource = new DirectoryResource ( $ rootSPL ) ; $ rootResource = $ this -> createTrackedObject ( $ rootResource ) ; $ this -> add ( $ rootResource ) ; f... | Scan path and add it to listener |
52,401 | public function createTrackedObject ( ResourceInterface $ resource ) { $ tracked = new TrackedObject ( ) ; $ tracked -> setResource ( $ resource ) ; $ tracked -> setChecksum ( $ resource -> getChecksum ( ) ) ; if ( is_null ( $ tracked -> getID ( ) ) ) { $ tracked -> setID ( PathUtil :: createPathID ( $ resource -> getR... | Create new TrackedObject |
52,402 | protected function create ( Request $ request ) : Model { return User :: create ( [ 'name' => $ request -> input ( 'name' ) , 'email' => $ request -> input ( 'email' ) , 'password' => Hash :: make ( $ request -> input ( 'password' ) ) ] ) ; } | Add new a new user |
52,403 | public function chain ( Reader $ reader ) { $ newFilter = new LocalConfigurationFilter ( $ reader ) ; $ newFilter -> setProject ( $ this -> getProject ( ) ) ; $ newFilter -> setCacheDir ( $ this -> getCacheDir ( ) ) ; $ newFilter -> setTYPO3Version ( $ this -> getTYPO3Version ( ) ) ; $ newFilter -> addInstallTool ( $ t... | Creates a new LocalConfigurationFilter using the passed in Reader for instantiation . |
52,404 | public function read ( $ len = null ) { if ( FALSE === $ this -> getInitialized ( ) ) { $ this -> initialize ( ) ; $ this -> setInitialized ( TRUE ) ; } $ defaultConfiguration = '' ; if ( - 1 === version_compare ( $ this -> getTYPO3Version ( ) , '0.0.0' ) ) { throw new BuildException ( 'You must pass a TYPO3 version vi... | Reads stream applies property file formatting and returns resulting stream . |
52,405 | private function initialize ( ) { $ params = $ this -> getParameters ( ) ; if ( $ params ) { foreach ( $ params as $ param ) { $ setter = 'set' . str_replace ( ' ' , '' , ucwords ( str_replace ( '-' , ' ' , $ param -> getName ( ) ) ) ) ; if ( FALSE === method_exists ( $ this , $ setter ) ) { $ msg = sprintf ( 'Unknown ... | Initializes any parameters |
52,406 | protected function setDefaultConfiguration ( $ rawContent ) { $ resolvedContent = strtr ( $ rawContent , $ this -> unresolveableReplacementPairs ) ; $ cacheFile = tempnam ( $ this -> cacheDir , 'tmp' ) ; $ fh = fopen ( $ cacheFile , 'w' ) ; fwrite ( $ fh , $ resolvedContent ) ; fclose ( $ fh ) ; $ this -> defaultConfig... | modifies the given raw content by creating a temp file and resolving some TYPO3 CMS constants |
52,407 | public function createPropertyPathsFromCommentArray ( $ comments ) { $ out = '' ; foreach ( $ comments as $ mainKey => $ subKeys ) { foreach ( $ subKeys as $ subKey => $ comment ) { if ( '' === $ comment ) { continue ; } $ defaultConfigurationValue = $ this -> defaultConfiguration [ $ mainKey ] [ $ subKey ] ; if ( FALS... | creates the property file lines for the given comments array |
52,408 | public function toArray ( $ keys = array ( ) ) { $ vars = get_object_vars ( $ this ) ; $ results = array ( ) ; if ( count ( $ keys ) == 0 ) { foreach ( $ vars as $ name => $ value ) { if ( is_string ( $ value ) || is_numeric ( $ value ) || is_bool ( $ value ) ) { $ results [ $ name ] = $ value ; } } return $ results ; ... | Serializes an object into a dictionary |
52,409 | static function json ( $ data , $ code = 200 ) { return ( new Response ( ) ) -> setCode ( $ code ) -> setContent ( json_encode ( $ data ) ) -> setContentType ( 'application/json' ) ; } | Create Response object with JSON header + content |
52,410 | function setCode ( $ code ) { $ this -> code = $ code ; $ this -> addHeader ( $ this -> getDefaultHeaderFromCode ( $ code ) ) ; return $ this ; } | Set HTTP code and put on header |
52,411 | final public function openFile ( $ filename , $ use_include_path = false ) { $ this -> getPathInfo ( $ filename , $ use_include_path ) ; $ this -> fileResource = fopen ( $ this -> dirname . DIRECTORY_SEPARATOR . $ this -> basename , self :: FILE_MODE ) ; return flock ( $ this -> fileResource , LOCK_EX ) ; } | Opens the file in the specified mode designating read write create capabilities . Obtains exclusive lock on file which is released when class is destroyed . |
52,412 | public final function getDifferenceYears ( $ dt = null , bool $ abs = true ) : int { $ dt = $ dt ? : static :: Now ( $ this -> getTimezone ( ) ) ; return ( int ) $ this -> diff ( $ dt , $ abs ) -> format ( '%r%y' ) ; } | Get the difference in years between current date time and defined . |
52,413 | public function setISODate ( $ year , $ week , $ day = null ) : DateTime { parent :: setISODate ( $ year , $ week , $ day ) ; return $ this ; } | Sets a date by ISO - 8601 conform data . |
52,414 | public final function setYear ( int $ year = null ) : DateTime { if ( \ is_null ( $ year ) ) { $ year = static :: CurrentYear ( ) ; } return $ this -> setDateParts ( $ year ) ; } | Changes the current defined year to defined value . |
52,415 | public final function setMonth ( int $ month = null ) : DateTime { if ( \ is_null ( $ month ) ) { $ month = static :: CurrentMonth ( ) ; } return $ this -> setDateParts ( null , $ month ) ; } | Changes the current defined month to defined value . |
52,416 | public final function setDay ( int $ day = null ) : DateTime { if ( \ is_null ( $ day ) ) { $ day = static :: CurrentDay ( ) ; } return $ this -> setDateParts ( null , null , $ day ) ; } | Changes the current defined day to defined value . |
52,417 | public final function setHour ( int $ hour = null ) : DateTime { if ( \ is_null ( $ hour ) ) { $ hour = static :: CurrentHour ( ) ; } return $ this -> setTimeParts ( $ hour ) ; } | Changes the current defined hour to defined value . |
52,418 | public final function setMinute ( int $ minute = null ) : DateTime { if ( \ is_null ( $ minute ) ) { $ minute = static :: CurrentMinute ( ) ; } return $ this -> setTimeParts ( null , $ minute ) ; } | Changes the current defined minute to defined value . |
52,419 | public final function setSecond ( int $ second = null ) : DateTime { if ( \ is_null ( $ second ) ) { $ second = static :: CurrentSecond ( ) ; } return $ this -> setTimeParts ( null , null , $ second ) ; } | Changes the current defined second to defined value . |
52,420 | public final function addSeconds ( int $ seconds = 1 ) : DateTime { return $ this -> move ( new \ DateInterval ( 'PT' . \ abs ( $ seconds ) . 'S' ) , $ seconds < 0 ) ; } | Adds the defined number of seconds . |
52,421 | public final function addMinutes ( int $ minutes = 1 ) : DateTime { return $ this -> move ( new \ DateInterval ( 'PT' . \ abs ( $ minutes ) . 'M' ) , $ minutes < 0 ) ; } | Adds the defined number of minutes . |
52,422 | public final function addHours ( int $ hours = 1 ) : DateTime { return $ this -> move ( new \ DateInterval ( 'PT' . \ abs ( $ hours ) . 'H' ) , $ hours < 0 ) ; } | Adds the defined number of hours . |
52,423 | public final function addDays ( int $ days = 1 ) : DateTime { return $ this -> move ( new \ DateInterval ( 'P' . \ abs ( $ days ) . 'D' ) , $ days < 0 ) ; } | Adds the defined number of days . |
52,424 | public final function addWeeks ( int $ weeks = 1 ) : DateTime { return $ this -> move ( new \ DateInterval ( 'P' . \ abs ( $ weeks ) . 'W' ) , $ weeks < 0 ) ; } | Adds the defined number of weeks . |
52,425 | public final function formatNamedDate ( bool $ short = false ) : string { if ( $ short ) { return \ sprintf ( '%s., %s. %s %d' , $ this -> getShortWeekDayName ( ) , $ this -> getDay ( ) , $ this -> getShortMonthName ( ) , $ this -> getYear ( ) ) ; } return \ sprintf ( '%s, %s. %s %d' , $ this -> getWeekDayName ( ) , $ ... | Formats the current instance to a named date depending to current used locale . The output uses long names like Montag 20 . Dezember 2030 or short names like Mon 20 . Dec 2030 |
52,426 | public static function Parse ( $ datetime , \ DateTimeZone $ timezone = null ) { if ( \ is_null ( $ datetime ) ) { return false ; } if ( $ datetime instanceof DateTime ) { return $ datetime ; } if ( $ datetime instanceof \ DateTimeInterface ) { return new DateTime ( $ datetime -> format ( 'y-m-d H:i:s' ) , $ datetime -... | Parses a value to a \ Beluga \ Date \ DateTime instance . |
52,427 | public static function Create ( int $ year , int $ month , int $ day , int $ hour = 0 , int $ minute = 0 , int $ second = 0 ) : DateTime { $ dt = new DateTime ( ) ; $ dt -> setDate ( $ year , $ month , $ day ) ; $ dt -> setTime ( $ hour , $ minute , $ second ) ; return $ dt ; } | Init s a new instance . |
52,428 | public static function FromDateTime ( \ DateTime $ dt ) : DateTime { if ( $ dt instanceof DateTime ) { return clone $ dt ; } return new DateTime ( $ dt -> format ( 'Y-m-d H:i:s.u' ) , $ dt -> getTimezone ( ) ) ; } | Create a DateTime instance from PHP \ DateTime instance . |
52,429 | public static function FromFormat ( string $ format , $ time , \ DateTimeZone $ timezone = null ) : DateTime { if ( $ timezone !== null ) { $ dt = parent :: createFromFormat ( $ format , $ time , $ timezone ) ; } else { $ dt = parent :: createFromFormat ( $ format , $ time ) ; } if ( $ dt instanceof \ DateTime ) { retu... | Create a DateTime instance from a specific format . |
52,430 | public static function Now ( \ DateTimeZone $ timezone = null , bool $ useDayStart = false , bool $ useDayEnd = false ) : DateTime { $ dt = new DateTime ( 'now' , $ timezone ) ; if ( $ useDayStart ) { $ dt -> setTime ( 0 , 0 , 0 ) ; } else if ( $ useDayEnd ) { $ dt -> setTime ( 23 , 59 , 59 ) ; } return $ dt ; } | Init s a \ Beluga \ Date \ DateTime with current DateTime and returns it . |
52,431 | public static function FromFile ( string $ file , bool $ checkIfFileExists = false ) { if ( $ checkIfFileExists && ! \ file_exists ( $ file ) ) { return false ; } try { return DateTime :: Parse ( \ filemtime ( $ file ) ) ; } catch ( \ Throwable $ ex ) { $ ex = null ; return false ; } } | Gets the last change DateTime of defined file . |
52,432 | public static function GetDaysInMonth ( int $ year , int $ month ) : int { $ dt = new \ DateTime ( ) ; $ dt -> setDate ( $ year , $ month , 2 ) ; $ dt -> setTime ( 0 , 0 , 2 ) ; return \ intval ( $ dt -> format ( 't' ) ) ; } | Gets the days of the defined month in defined year . |
52,433 | protected function initializeFiltering ( ContextInterface $ context ) { $ activeFilters = $ context -> getActiveFilters ( ) ; foreach ( $ activeFilters as $ activeFilter ) { $ filterName = $ activeFilter -> getFilterName ( ) ; if ( $ this -> table -> hasFilter ( $ filterName ) ) { $ this -> table -> getFilter ( $ filte... | Initializes filtering by applying all active filters through the related filter types . |
52,434 | protected function initializeSorting ( ContextInterface $ context ) { if ( null !== $ activeSort = $ context -> getActiveSort ( ) ) { $ columnName = $ activeSort -> getColumnName ( ) ; if ( $ this -> table -> hasColumn ( $ columnName ) ) { $ this -> table -> getColumn ( $ columnName ) -> applySort ( $ this , $ activeSo... | Initializes sorting by applying all active sorts through the related column types . |
52,435 | public static function generateWithCustomAlphabet ( $ customAlphabet = '0123456789ABCDEF' , $ tokenLength = 32 ) { $ generator = new RandomStringGenerator ( $ customAlphabet ) ; $ token = $ generator -> generate ( $ tokenLength ) ; return $ token ; } | Generate token with custom alphabet |
52,436 | public function init ( ) { $ this -> register ( 'request' , function ( $ app ) { return new Request ( $ app -> config [ 'baseurl' ] ) ; } ) ; $ this -> register ( 'response' , function ( $ app ) { return new Response ( ) ; } ) ; $ this -> register ( 'router' , function ( $ app ) { return new Router ( ) ; } ) ; $ app = ... | Initialise the IoC aliases and routes . |
52,437 | public function registerRoutes ( Map $ map ) { $ map -> attach ( 'legacy.' , '/' , function ( Map $ map ) { $ map -> get ( 'polls' , 'polls/' , $ this -> controller ( PollsController :: class , 'polls' ) ) -> allows ( [ 'POST' ] ) ; } ) ; } | Add the legacy route |
52,438 | public function load ( string $ resourceName , bool $ prependResourceName = false ) { switch ( $ this -> _handler -> load ( $ resourceName , $ prependResourceName ) ) { case Handler :: CONFIG_PARSE_ERROR : throw new Exception \ ConfigParseException ( "Error parsing '{$resourceName}' configuration resource" ) ; case Han... | Load config resource |
52,439 | public function setNavigationClass ( $ class ) { if ( is_string ( $ class ) && ! empty ( trim ( $ class ) ) ) { $ this -> menuElements [ 'ul_class' ] = $ class ; } if ( ( is_string ( $ class ) && empty ( trim ( $ class ) ) ) || $ class === false ) { $ this -> menuElements [ 'ul_class' ] = '' ; } return $ this ; } | Set the main navigation UL class |
52,440 | public function setNavigationID ( $ id ) { if ( is_string ( $ id ) && ! empty ( trim ( $ id ) ) ) { $ this -> menuElements [ 'ul_id' ] = $ id ; } if ( ( is_string ( $ id ) && empty ( trim ( $ id ) ) ) || $ id === false ) { $ this -> menuElements [ 'ul_id' ] = '' ; } return $ this ; } | Set the main navigation ID element |
52,441 | public function setDefaultClass ( $ class , $ element = 'li' ) { if ( in_array ( $ element , [ 'a' , 'li' , 'ul' ] ) && ( ( is_string ( $ class ) && ! empty ( trim ( $ class ) ) ) || is_bool ( $ class ) ) ) { $ this -> menuElements [ strtolower ( $ element ) . '_default' ] = $ class ; } elseif ( in_array ( $ element , ... | Change the default class assigned to all elements of a certain type in the menu |
52,442 | public function setCurrentURI ( $ uri ) { if ( is_string ( $ uri ) && ! empty ( trim ( $ uri ) ) ) { $ this -> currentURI = $ uri ; $ this -> currentArray = Levels :: getCurrent ( $ this -> navigation , $ this -> currentURI ) ; } else { throw new InvalidArgumentException ( '$uri must be a valid string when seting the c... | Sets the current active URI |
52,443 | public function hasLink ( $ link ) { $ found = false ; array_walk_recursive ( $ this -> navigation , function ( $ value , $ key ) use ( & $ found , $ link ) { if ( $ value == $ link && $ key === 'uri' ) { $ found = true ; } } ) ; return $ found ; } | Checks to see if a link exists within the current navigation array |
52,444 | public function hasLinks ( $ array ) { if ( is_array ( $ array ) ) { foreach ( $ array as $ link ) { if ( $ this -> hasLink ( $ link ) === false ) { return false ; } } return true ; } return false ; } | Checks to see if an array of links exist within the current navigation array |
52,445 | public function render ( ) { return Menu :: build ( $ this -> navigation , $ this -> menuElements , $ this -> currentArray , $ this -> getActiveClass ( ) , $ this -> getStartLevel ( ) , $ this -> getMaxLevels ( ) , $ this -> caretElement , $ this -> dropdownLinkExtras ) ; } | Returns the HTML navigation string |
52,446 | public function renderBreadcrumb ( $ class = 'breadcrumb' , $ itemClass = 'breadcrumb-item' , $ list = true ) { $ breadcrumb = new Breadcrumb ( ) ; $ breadcrumb -> navArray = $ this -> navigation ; return $ breadcrumb -> setBreacrumbLinks ( $ this -> currentArray ) -> createBreadcrumb ( $ class , $ itemClass , $ list )... | Renders a breadcrumb menu |
52,447 | public static function get ( array $ array , $ key = null , $ default = null ) { if ( $ key === null ) { return $ array ; } if ( isset ( $ array [ $ key ] ) ) { return static :: value ( $ array [ $ key ] ) ; } foreach ( explode ( '.' , ( string ) $ key ) as $ segment ) { if ( ! array_key_exists ( $ segment , $ array ) ... | Get an item from an array using dot notation . If key dont exist you get a default value back . |
52,448 | public static function add ( array $ array , $ key , $ value ) : array { $ target = static :: get ( $ array , $ key , [ ] ) ; if ( ! is_array ( $ target ) ) { $ target = [ $ target ] ; } $ target [ ] = $ value ; $ array = static :: set ( $ array , $ key , $ target ) ; return $ array ; } | Add an element to the array at a specific location using the dot notation . |
52,449 | public static function any ( array $ array , $ keys ) : bool { foreach ( ( array ) $ keys as $ key ) { if ( static :: has ( $ array , $ key ) ) { return true ; } } return false ; } | Check if any item or items exist in an array using dot notation . |
52,450 | public static function update ( array $ array , string $ key , callable $ callback ) { $ keys = explode ( '.' , $ key ) ; $ current = & $ array ; foreach ( $ keys as $ key ) { if ( ! isset ( $ current [ $ key ] ) ) { return $ array ; } $ current = & $ current [ $ key ] ; } $ current = $ callback ( $ current ) ; return ... | Updates data at the given path . |
52,451 | public static function closest ( array $ array , string $ value ) { sort ( $ array ) ; $ closest = $ array [ 0 ] ; for ( $ i = 1 , $ j = count ( $ array ) , $ k = 0 ; $ i < $ j ; $ i ++ , $ k ++ ) { $ middleValue = ( ( int ) $ array [ $ i ] - ( int ) $ array [ $ k ] ) / 2 + ( int ) $ array [ $ k ] ; if ( $ value >= $ m... | Return the closest found value from array . |
52,452 | public static function every ( array $ array , int $ step , int $ offset = 0 ) : array { $ new = [ ] ; $ position = 0 ; foreach ( $ array as $ key => $ item ) { if ( $ position % $ step === $ offset ) { $ new [ ] = $ item ; } ++ $ position ; } return $ new ; } | Create a new array consisting of every n - th element . |
52,453 | public static function combine ( array $ array , callable $ callback , bool $ overwrite = true ) : array { $ combined = [ ] ; foreach ( $ array as $ key => $ value ) { $ combinator = $ callback ( $ value , $ key ) ; if ( defined ( 'HHVM_VERSION' ) && version_compare ( HHVM_VERSION , '3.10.0' , '<=' ) ) { $ combinator -... | Indexes an array depending on the values it contains . |
52,454 | public static function collapse ( array $ array ) : array { $ newArray = [ ] ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { if ( preg_match ( '/\./' , ( string ) $ key ) ) { $ key = substr ( $ key , 0 , - 2 ) ; } self :: recurseCollapse ( $ value , $ newArray , ( array ) $ key ) ; } else { $ ... | Collapse a nested array down to an array of flat key = > value pairs . |
52,455 | public static function reindex ( array $ array , array $ map , bool $ unmapped = true ) : array { $ reindexed = $ unmapped ? $ array : [ ] ; foreach ( $ map as $ from => $ to ) { if ( isset ( $ array [ $ from ] ) ) { $ reindexed [ $ to ] = $ array [ $ from ] ; } } return $ reindexed ; } | Reindexes a list of values . |
52,456 | public static function extend ( ) : array { $ merged = [ ] ; foreach ( func_get_args ( ) as $ array ) { foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) && static :: has ( $ merged , $ key ) && is_array ( $ merged [ $ key ] ) ) { $ merged [ $ key ] = static :: extend ( $ merged [ $ key ] , $ value ) ... | Extend one array with another . |
52,457 | public static function asHierarchy ( array $ array ) : array { $ hierarchy = [ ] ; foreach ( $ array as $ key => $ value ) { $ segments = explode ( '.' , ( string ) $ key ) ; $ valueSegment = array_pop ( $ segments ) ; $ branch = & $ hierarchy ; foreach ( $ segments as $ segment ) { if ( ! isset ( $ branch [ $ segment ... | Transforms a 1 - dimensional array into a multi - dimensional one exploding keys according to a separator . |
52,458 | public static function groupBy ( array $ array , callable $ callback = null ) : array { $ callback = $ callback ? : function ( $ value ) { return $ value ; } ; return array_reduce ( $ array , function ( $ buckets , $ value ) use ( $ callback ) { $ key = $ callback ( $ value ) ; if ( ! array_key_exists ( $ key , $ bucke... | Separates elements from an array into groups . The function maps an element to the key that will be used for grouping . If no function is passed the element itself will be used as key . |
52,459 | public static function flatten ( array $ array , string $ separator = null , string $ prepend = '' ) : array { $ flattened = [ ] ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ flattened = array_merge ( $ flattened , static :: flatten ( $ value , $ separator , $ prepend . $ key . $ separator... | Flatten a nested array to a separated key . |
52,460 | public static function expand ( array $ array , string $ prepend = '' ) : array { $ results = [ ] ; if ( $ prepend ) { $ prepend .= '.' ; } foreach ( $ array as $ key => $ value ) { if ( $ prepend ) { $ pos = strpos ( $ key , $ prepend ) ; if ( $ pos === 0 ) { $ key = substr ( $ key , strlen ( $ prepend ) ) ; } } $ res... | Expand a flattened array with dots to a multi - dimensional associative array . |
52,461 | public static function extendDistinct ( ) { $ merged = [ ] ; foreach ( func_get_args ( ) as $ array ) { foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) && static :: has ( $ merged , $ key ) && is_array ( $ merged [ $ key ] ) ) { if ( static :: isAssoc ( $ value ) && static :: isAssoc ( $ merged [ $ ... | Extend one array with another . Non associative arrays will not be merged but rather replaced . |
52,462 | public static function sort ( array $ array , callable $ callback , int $ options = SORT_REGULAR , bool $ descending = false ) : array { $ results = [ ] ; foreach ( $ array as $ key => $ value ) { $ results [ $ key ] = $ callback ( $ value , $ key ) ; } $ descending ? arsort ( $ results , $ options ) : asort ( $ result... | Sort the array using the given callback . |
52,463 | public static function map ( array $ array , callable $ callback ) { $ newArray = [ ] ; foreach ( $ array as $ key => $ item ) { $ result = $ callback ( $ item , $ key ) ; $ newArray = is_array ( $ result ) ? array_replace_recursive ( $ array , $ result ) : array_merge_recursive ( $ array , ( array ) $ result ) ; } ret... | Applies the callback to the elements of the given arrays |
52,464 | public static function all ( array $ array , callable $ predicate ) { foreach ( $ array as $ key => $ value ) { if ( ! $ predicate ( $ value , $ key , $ array ) ) { return false ; } } return true ; } | Returns whether every element of the array satisfies the given predicate or not . Works with Iterators too . |
52,465 | public static function writeJSON ( $ obj , $ buf = null ) { $ output = json_encode ( $ obj ) ; if ( $ output === false && json_last_error ( ) === JSON_ERROR_UTF8 ) { $ obj_fixed = Encoding :: fixUTF8 ( $ obj ) ; $ output = json_encode ( $ obj_fixed ) ; if ( $ output === false && json_last_error ( ) === JSON_ERROR_UTF8 ... | Encode the specified entity catching UTF8 errors . |
52,466 | public static function pprintJSON ( $ obj , $ indent = 0 , $ json_array = null , $ buf = null ) { if ( ! is_object ( $ obj ) && ! is_array ( $ obj ) ) return self :: writeJSON ( $ obj , $ buf ) ; if ( method_exists ( $ obj , "jsonSerialize" ) ) { $ obj = $ obj -> jsonSerialize ( ) ; } elseif ( ! WF :: is_array_like ( $... | PrettyPrint the specified output . |
52,467 | private function createFileLocator ( $ modelDir , $ mixinDir , $ embedDir ) { $ definition = new Definition ( Utility :: getLibraryClass ( 'Metadata\Driver\FileLocator' ) , [ $ modelDir , $ mixinDir , $ embedDir ] ) ; $ definition -> setPublic ( false ) ; return $ definition ; } | Creates the file locator service definition . |
52,468 | private function createYmlDriver ( $ driverName , array $ driverConfig , ContainerBuilder $ container ) { list ( $ modelDir , $ mixinDir , $ embedDir ) = $ this -> getDefinitionDirs ( $ driverConfig , $ container ) ; Utility :: appendParameter ( 'dirs' , sprintf ( '%s.model_dir' , $ driverName ) , $ modelDir , $ contai... | Creates the YAML metadata driver service definition . |
52,469 | private function getDefinitionDir ( $ type , array $ driverConfig , ContainerBuilder $ container ) { $ defaultDir = sprintf ( '%s/Resources/As3ModlrBundle' , $ container -> getParameter ( 'kernel.root_dir' ) ) ; $ folder = sprintf ( '%ss' , $ type ) ; $ key = sprintf ( '%s_dir' , $ type ) ; return isset ( $ driverConfi... | Gets the directory for a definition type . |
52,470 | private function getDefinitionDirs ( array $ driverConfig , ContainerBuilder $ container ) { $ modelDir = $ this -> getDefinitionDir ( 'model' , $ driverConfig , $ container ) ; $ mixinDir = $ this -> getDefinitionDir ( 'mixin' , $ driverConfig , $ container ) ; $ embedDir = $ this -> getDefinitionDir ( 'embed' , $ dri... | Gets the definition directories for models and mixins and returns as a tuple . |
52,471 | public function bodyFormat ( string $ format ) : self { return tap ( $ this , function ( $ request ) use ( $ format ) { $ this -> bodyFormat = $ format ; } ) ; } | Set the request body fomrat . |
52,472 | public function withBaseUri ( string $ uri ) : self { return tap ( $ this , function ( $ request ) use ( $ uri ) { return $ this -> options = array_merge_recursive ( $ this -> options , [ 'base_uri' => $ uri , ] ) ; } ) ; } | Set the base uri for all requests . |
52,473 | public function withHeaders ( array $ headers ) : self { return tap ( $ this , function ( $ request ) use ( $ headers ) { return $ this -> options = array_merge_recursive ( $ this -> options , [ 'headers' => $ headers , ] ) ; } ) ; } | Send headers with the request . |
52,474 | public function withCookies ( ) : self { return tap ( $ this , function ( $ request ) { return $ this -> options = array_merge_recursive ( $ this -> options , [ 'cookies' => static :: getCookieJar ( ) , ] ) ; } ) ; } | Store any cookies in a cookie jar . |
52,475 | public function withHandler ( $ handler ) : self { return tap ( $ this , function ( $ request ) use ( $ handler ) { return $ this -> handler = $ handler ; } ) ; } | Handle requests with the given class . |
52,476 | public function timeout ( int $ seconds ) : self { return tap ( $ this , function ( ) use ( $ seconds ) { return $ this -> options = array_merge_recursive ( $ this -> options , [ 'timeout' => $ seconds , ] ) ; } ) ; } | Timeout of the request in seconds . |
52,477 | public function beforeSending ( Closure $ callback ) : self { return tap ( $ this , function ( ) use ( $ callback ) { $ this -> beforeSendingCallbacks [ ] = $ callback ; } ) ; } | Set the pre - request Callback . |
52,478 | public function post ( string $ url , $ params = null ) : HttpResponse { return $ this -> send ( 'POST' , $ url , [ $ this -> bodyFormat => $ params , ] ) ; } | Create and send an Http POST request . |
52,479 | public function delete ( string $ url , array $ params = [ ] ) : HttpResponse { return $ this -> send ( 'DELETE' , $ url , [ $ this -> bodyFormat => $ params , ] ) ; } | Create and send an Http DELETE request . |
52,480 | public function send ( string $ method , string $ url , array $ options ) : HttpResponse { try { return new HttpResponse ( $ this -> buildClient ( ) -> request ( $ method , $ url , $ this -> mergeOptions ( [ 'query' => $ this -> parseQueryParams ( $ url ) , ] , $ options ) ) ) ; } catch ( \ GuzzleHttp \ Exception \ Con... | Create and send an Http request . |
52,481 | public function buildHandlerStack ( ) : HandlerStack { static $ handler ; if ( ! $ handler ) { $ handler = $ this -> handler ?? \ GuzzleHttp \ choose_handler ( ) ; } if ( $ handler instanceof HandlerStack ) { $ stack = $ handler ; } return tap ( $ stack ?? HandlerStack :: create ( ) , function ( $ stack ) { $ stack -> ... | Create a new Guzzle HandlerStack instance . |
52,482 | public function runBeforeSendingCallbacks ( Request $ request ) : Request { return tap ( $ request , function ( $ request ) { $ this -> beforeSendingCallbacks -> each -> __invoke ( new HttpRequest ( $ request ) ) ; } ) ; } | Run the pre - request callback . |
52,483 | public function parseQueryParams ( string $ url ) : array { return tap ( [ ] , function ( & $ query ) use ( $ url ) { parse_str ( parse_url ( $ url , PHP_URL_QUERY ) ?? '' , $ query ) ; } ) ; } | Parse the given URL and return its query . |
52,484 | public function createFromComposer ( $ file = 'composer.json' ) { $ composer = $ this -> readComposerDotJson ( $ file ) ; $ this -> setNamespace ( '' ) ; $ this -> setDestinationFolder ( 'generated\\' ) ; if ( isset ( $ composer [ 'extra' ] ) && isset ( $ composer [ 'extra' ] [ 'paris-model-generator' ] ) ) { $ configu... | Set parameters from the given composer . json file path . |
52,485 | public function cmdUpdateImageStyle ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ th... | Callback for imagestyle - update |
52,486 | public function cmdDeleteImageStyle ( ) { $ id = $ this -> getParam ( 0 ) ; if ( empty ( $ id ) || ! is_numeric ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } if ( ! $ this -> image_style -> delete ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ th... | Callback for imagestyle - delete command |
52,487 | public function cmdClearImageStyle ( ) { $ id = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( ! isset ( $ id ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ result = false ; if ( isset ( $ id ) ) { if ( ! is_numeric ( $ id ) ) { $ this -> errorAndE... | Callback for imagestyle - clear command |
52,488 | public function cmdGetImageStyle ( ) { $ list = $ this -> getListImageStyle ( ) ; $ this -> outputFormat ( $ list ) ; $ this -> outputFormatTableImageStyle ( $ list ) ; $ this -> output ( ) ; } | Callback for imagestyle - get command |
52,489 | protected function submitAddImageStyle ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> setSubmittedList ( 'actions' ) ; $ this -> validateComponent ( 'image_style' ) ; $ this -> addImageStyle ( ) ; } | Add an image style at once |
52,490 | protected function wizardAddImageStyle ( ) { $ this -> validatePrompt ( 'name' , $ this -> text ( 'Name' ) , 'image_style' ) ; $ this -> validatePromptList ( 'actions' , $ this -> text ( 'Actions' ) , 'image_style' ) ; $ this -> validatePrompt ( 'status' , $ this -> text ( 'Status' ) , 'image_style' , 0 ) ; $ this -> s... | Adds an image style step - by - step |
52,491 | public function set ( $ key , $ value ) { $ this -> checkReadOnly ( ) ; self :: setFromKey ( $ this -> data , $ key , $ value , $ this -> separator ) ; } | Set data inside |
52,492 | private static function recursiveGetFromKey ( $ data , $ key , $ default ) { if ( empty ( $ key ) ) { return $ data ; } else { $ currentKey = array_shift ( $ key ) ; return isset ( $ data [ $ currentKey ] ) ? self :: recursiveGetFromKey ( $ data [ $ currentKey ] , $ key , $ default ) : $ default ; } } | Private unsecured function for getFromKey |
52,493 | public static function setFromKey ( & $ data , $ key , $ value , $ separator = '/' ) { if ( is_string ( $ key ) ) { $ key = explode ( $ separator , $ key ) ; } $ data = self :: recursiveSetFromKey ( $ data , $ key , $ value ) ; } | Set data inside an array |
52,494 | private static function recursiveSetFromKey ( $ data , $ key , $ value ) { if ( empty ( $ key ) ) { return $ value ; } else { if ( ! is_array ( $ data ) ) { $ data = [ ] ; } $ currentKey = array_shift ( $ key ) ; if ( ! isset ( $ data [ $ currentKey ] ) ) { $ data [ $ currentKey ] = [ ] ; } $ data [ $ currentKey ] = se... | Private unsecured method to set data in array |
52,495 | public function id ( ) { if ( $ this -> loggedOut ) return null ; $ id = $ this -> session -> get ( $ this -> getName ( ) ) ; if ( is_null ( $ id ) && $ this -> acct ( ) ) $ id = $ this -> acct ( ) -> getId ( ) ; return $ id ; } | Get the ID for the currently authenticated acct . |
52,496 | protected function getAcctByRecaller ( $ recaller ) { if ( $ this -> validRecaller ( $ recaller ) && ! $ this -> tokenRetrievalAttempted ) { $ this -> tokenRetrievalAttempted = true ; list ( $ id , $ token ) = explode ( '|' , $ recaller , 2 ) ; $ this -> viaRemember = ! is_null ( $ acct = $ this -> auth -> retrieveByTo... | Pull a acct from the repository by its recaller ID . |
52,497 | protected function getRecallerId ( ) { if ( $ this -> validRecaller ( $ recaller = $ this -> getRecaller ( ) ) ) return head ( explode ( '|' , $ recaller ) ) ; return null ; } | Get the acct ID from the recaller cookie . |
52,498 | public function once ( array $ credentials = [ ] ) { if ( $ this -> validate ( $ credentials ) ) { $ this -> setAcct ( $ this -> lastAttempted ) ; return true ; } return false ; } | Log a acct into the application without sessions or cookies . |
52,499 | protected function hasValidCredentials ( $ acct , $ credentials ) { return ! is_null ( $ acct ) && $ this -> auth -> validateCredentials ( $ acct , $ credentials ) ; } | Determine if the acct matches the credentials . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.