idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
2,000
public static function createContactFromStdClass ( \ stdClass $ stdContact ) : Contact { if ( empty ( $ stdContact -> FirstName ) ) { throw new \ InvalidArgumentException ( "stdClass argument must contain FirstName attribute" ) ; } if ( empty ( $ stdContact -> Phone ) ) { throw new \ InvalidArgumentException ( "stdClas...
Creates a Contact using the stdClass given .
2,001
public static function createContactFromAttributes ( string $ firstName , string $ phoneNumber , ? string $ lastName = null , ? string $ title = null , ? string $ organization = null , ? string $ email = null , ? string $ notes = null ) : Contact { return new Contact ( $ firstName , $ phoneNumber , $ lastName , $ title...
Creates a Contact using the parameters given .
2,002
public static function createProcessedContactFromStdClassArray ( array $ contactArray ) : ClassValidationArray { $ contacts = new ClassValidationArray ( ) ; foreach ( $ contactArray as $ c ) { $ contacts [ ] = self :: createProcessedContactFromStdClass ( $ c ) ; } return $ contacts ; }
Take an array filled with contact stdClasses and returns a ClassValidationArray filled with ProcessedContact .
2,003
public static function createProcessedContactFromStdClass ( \ stdClass $ stdContact ) : ProcessedContact { if ( empty ( $ stdContact -> FirstName ) ) { throw new \ InvalidArgumentException ( "stdClass argument must contain FirstName attribute" ) ; } if ( empty ( $ stdContact -> Phone ) ) { throw new \ InvalidArgumentEx...
Creates a ProcessedContact using the stdClass given .
2,004
public static function createProcessedGroupFromStdClass ( \ stdClass $ stdGroup ) : ProcessedGroup { return new ProcessedGroup ( $ stdGroup -> Name , $ stdGroup -> Color , $ stdGroup -> ID , $ stdGroup -> OwnerID , new \ DateTime ( $ stdGroup -> Created ) , new \ DateTime ( $ stdGroup -> Modified ) ) ; }
Takes a stdClass group and returns a ProcessedGroup .
2,005
public static function createProcessedOutGoingSMSFromStdClass ( \ stdClass $ stdClassSMS ) : ProcessedOutGoingSMS { return new ProcessedOutGoingSMS ( $ stdClassSMS -> From , $ stdClassSMS -> Message , $ stdClassSMS -> To , $ stdClassSMS -> ID , new \ DateTime ( $ stdClassSMS -> Created ?? null ) , new \ DateTime ( $ st...
Creates a ProcessedOutGoingSMS from an stdClass object .
2,006
public static function createProcessedOutGoingSMSFromStdClassArray ( array $ stdClassArray ) : ClassValidationArray { $ array = new ClassValidationArray ( ProcessedOutGoingSMS :: class ) ; foreach ( $ stdClassArray as $ stdClass ) { $ array [ ] = self :: createProcessedOutGoingSMSFromStdClass ( $ stdClass ) ; } return ...
Creates a ClassValidationArray filled with ProcessedOutGoingSMS given an array of stdClass .
2,007
public function fetchConfig ( ) { if ( Cache :: has ( $ this -> getCacheKey ( ) ) ) { return Cache :: get ( $ this -> getCacheKey ( ) ) ; } return null ; }
Fetch the stored config from the cache .
2,008
public function loadEnvironment ( ) { $ this -> environment = app ( ) -> environment ( ) ; $ this -> website_id = null ; $ website_data = WebsiteModel :: currentWebsiteData ( ) ; if ( ! empty ( $ website_data ) ) { if ( ! empty ( $ website_data [ 'environment' ] ) ) { $ this -> environment = $ website_data [ 'environme...
Loads the internal website_id and environment
2,009
public function loadConfiguration ( ) { $ repository = $ this -> loadEnvironment ( ) ; $ cache = $ repository -> fetchConfig ( ) ; if ( ! empty ( $ cache ) ) { return $ cache ; } $ config = [ ] ; foreach ( $ repository -> fetchAllGroups ( ) as $ group ) { $ groupConfig = ConfigModel :: fetchSettings ( $ repository -> g...
Load the database backed configuration .
2,010
public function setRunningConfiguration ( RepositoryContract $ config ) { foreach ( $ this -> loadConfiguration ( ) as $ group => $ groupConfig ) { $ config -> set ( $ group , $ groupConfig ) ; } }
Load the database backed configuration and save it
2,011
public static function matchFilter ( array & $ datas , array $ get ) { if ( sizeof ( $ get ) > 0 ) { $ datas = array_filter ( $ datas , function ( $ obj ) use ( $ get ) { return array_intersect_assoc ( ( array ) $ obj , $ get ) == $ get ; } ) ; } }
Return mathing objects with get filter
2,012
private function registerErrorRenderer ( ) { if ( $ this -> kernel ( ) -> isCli ( ) ) { $ this -> container ( ) -> bind ( ErrorRendererContract :: class , ConsoleErrorRenderer :: class ) ; } else { $ this -> container ( ) -> bind ( ErrorRendererContract :: class , HttpErrorRenderer :: class ) ; } }
Registers the default error renderer .
2,013
private function registerErrorReporters ( ) { $ this -> container ( ) -> factory ( ErrorReporterAggregateContract :: class , function ( ) { $ reporters = new ErrorReporterAggregate ( $ this -> container ( ) ) ; $ reporters -> push ( LogErrorReporter :: class ) ; return $ reporters ; } , true ) ; }
Registers default error reporters .
2,014
private function freezeExpiration ( DateTimeInterface $ expires ) : DateTimeImmutable { if ( ! $ expires instanceof DateTimeImmutable ) { $ expires = new DateTimeImmutable ( $ expires -> format ( DateTime :: ISO8601 ) , $ expires -> getTimezone ( ) ) ; } return $ expires ; }
Creates immutable date time instance from the provided one .
2,015
private function shuffleAssoc ( array $ values ) { $ keys = array_keys ( $ values ) ; shuffle ( $ keys ) ; $ output = [ ] ; foreach ( $ keys as $ key ) { $ output [ $ key ] = $ values [ $ key ] ; } return $ output ; }
Shuffle an array while preserving keys .
2,016
final public function updateUserAgentsWithDeviceIDMap ( $ userAgent , $ deviceID ) { if ( isset ( $ this -> userAgentsWithDeviceID [ $ this -> normalizeUserAgent ( $ userAgent ) ] ) ) { $ this -> logger -> debug ( $ this -> userAgentsWithDeviceID [ $ this -> normalizeUserAgent ( $ userAgent ) ] . "\t" ) ; $ this -> log...
Updates the map containing the classified user agents . These are stored in the associative array userAgentsWithDeviceID like user_agent = > deviceID . Before adding the user agent to the map it normalizes by using the normalizeUserAgent function .
2,017
public function getUserAgentsForBucket ( ) { if ( empty ( $ this -> userAgents ) ) { $ this -> userAgents = $ this -> persistenceProvider -> load ( $ this -> getPrefix ( self :: PREFIX_UA_BUCKET ) ) ; } return $ this -> userAgents ; }
Returns a list of User Agents associated with the bucket
2,018
private static function normalizeBrowser ( Device $ device ) { if ( $ device -> getBrowser ( ) -> name === 'IE' && preg_match ( '#Trident/([\d\.]+)#' , $ device -> getDeviceUa ( ) , $ matches ) ) { if ( array_key_exists ( $ matches [ 1 ] , self :: $ trident_map ) ) { $ compatibilityViewCheck = self :: $ trident_map [ $...
normalize the Browser Information
2,019
public function add ( string $ type , RowFieldNormalizerInterface $ normalizer ) { $ this -> normalizers [ $ type ] = $ normalizer ; return $ this ; }
Add a new normalized field
2,020
public function addModule ( $ module ) { $ this -> registerModule ( $ module ) ; if ( is_object ( $ module ) ) $ module = $ module -> name ; $ this -> userModules [ ] = $ module ; }
Adds a module to the current doctype by first registering it and then tacking it on to the active doctype
2,021
public function getElements ( ) { $ elements = array ( ) ; foreach ( $ this -> modules as $ module ) { if ( ! $ this -> trusted && ! $ module -> safe ) continue ; foreach ( $ module -> info as $ name => $ v ) { if ( isset ( $ elements [ $ name ] ) ) continue ; $ elements [ $ name ] = $ this -> getElement ( $ name ) ; }...
Retrieves merged element definitions .
2,022
public function trans ( $ message ) { $ theme = wp_get_theme ( ) ; $ domain = $ theme -> get ( 'TextDomain' ) ; return __ ( $ message , $ domain ) ; }
Translate message .
2,023
public static function loadFile ( $ path ) { if ( ! realpath ( $ path ) ) { throw new \ RuntimeException ( 'Unable to load configuration file from ' . $ path ) ; } $ data = Yaml :: parse ( $ path ) ; return new static ( pathinfo ( $ path , PATHINFO_DIRNAME ) , $ data ) ; }
Load configuration data from the specified file
2,024
public function getParam ( $ name ) { if ( ! $ this -> parsed ) { $ this -> parseParams ( ) ; } $ longName = strlen ( $ name ) === 1 ? $ this -> definitions -> getLongName ( $ name ) : $ name ; if ( isset ( $ this -> params [ $ longName ] ) ) { return $ this -> params [ $ longName ] ; } else { if ( $ this -> definition...
returns parameter matching provided name
2,025
public static function get ( $ url , $ parameters = [ ] , $ host = null , $ protocol = null ) { if ( empty ( $ url ) ) { throw new InvalidArgumentException ( __METHOD__ . ': The given url is empty.' ) ; } $ urlInfo = static :: info ( $ url ) ; $ finalUrl = ArrayHelper :: get ( $ urlInfo , 'path.plain' , '' , true ) ; $...
Creates and returns a url with parameters in url encoding .
2,026
public function addFiles ( $ type , $ fileArray ) { $ method = 'add' . ucfirst ( $ type ) . "Files" ; if ( method_exists ( $ this , $ method ) ) { $ this -> $ method ( $ fileArray ) ; } else { $ this -> say ( 'Missing method: ' . $ method ) ; } return true ; }
Add files to array
2,027
public function getFiles ( $ type ) { $ f = $ type . 'Files' ; if ( property_exists ( $ this , $ f ) ) { return self :: $ { $ f } ; } $ this -> say ( 'Missing Files: ' . $ type ) ; return "" ; }
Retrieve the files
2,028
protected function copyTarget ( $ path , $ tar ) { $ map = array ( ) ; $ hdl = opendir ( $ path ) ; while ( $ entry = readdir ( $ hdl ) ) { $ p = $ path . "/" . $ entry ; if ( substr ( $ entry , 0 , 1 ) != '.' ) { if ( isset ( $ this -> getJConfig ( ) -> exclude ) && in_array ( $ entry , explode ( ',' , $ this -> getJC...
Copies the files and maps them into an array
2,029
public function generatePluginFileList ( $ files , $ plugin ) { if ( ! count ( $ files ) ) { return "" ; } $ text = array ( ) ; foreach ( $ files as $ f ) { foreach ( $ f as $ type => $ value ) { $ p = "" ; if ( $ value == $ plugin . ".php" ) { $ p = ' plugin="' . $ plugin . '"' ; } $ text [ ] = "<" . $ type . $ p . ">...
Generate a list of files for plugins
2,030
public function generateModuleFileList ( $ files , $ module ) { if ( ! count ( $ files ) ) { return "" ; } $ text = array ( ) ; foreach ( $ files as $ f ) { foreach ( $ f as $ type => $ value ) { $ p = "" ; if ( $ value == $ module . ".php" ) { $ p = ' module="' . $ module . '"' ; } $ text [ ] = "<" . $ type . $ p . ">...
Generate a list of files for modules
2,031
public function resetFiles ( ) { self :: $ backendFiles = array ( ) ; self :: $ backendLanguageFiles = array ( ) ; self :: $ frontendFiles = array ( ) ; self :: $ frontendLanguageFiles = array ( ) ; self :: $ mediaFiles = array ( ) ; }
Reset the files list before build another part
2,032
public static function findByResource ( $ resourceName , $ optParams = [ ] ) { $ optParams = ( $ optParams ) ? $ optParams : [ 'personFields' => self :: $ personFields , ] ; self :: $ person = self :: getService ( ) -> people -> get ( $ resourceName , $ optParams ) ; self :: $ resourceName = $ resourceName ; return new...
find a contact to cache
2,033
public static function listPeopleConnections ( $ optParams = [ ] ) { $ optParams = ( $ optParams ) ? $ optParams : [ 'pageSize' => 0 , 'personFields' => self :: $ personFields , ] ; return self :: getService ( ) -> people_connections -> listPeopleConnections ( 'people/me' , $ optParams ) ; }
list People Connections
2,034
public static function getSimpleContacts ( ) { $ contactObj = self :: listPeopleConnections ( ) ; $ contacts = [ ] ; if ( count ( $ contactObj -> getConnections ( ) ) != 0 ) { foreach ( $ contactObj -> getConnections ( ) as $ person ) { $ data = [ ] ; $ data [ 'id' ] = $ person -> getResourceName ( ) ; $ data [ 'name' ...
Get simple contact data with parser
2,035
public static function createContact ( ) { $ person = self :: getPerson ( ) ; if ( isset ( $ person -> resourceName ) ) { throw new Exception ( "You should use newPeron() before create" , 500 ) ; } return self :: getService ( ) -> people -> createContact ( $ person ) ; }
Create a People Contact
2,036
public static function updateContact ( $ optParams = null ) { self :: checkFind ( ) ; $ optParams = ( is_null ( $ optParams ) ) ? [ 'updatePersonFields' => self :: $ personFields ] : $ optParams ; return self :: getService ( ) -> people -> updateContact ( self :: $ resourceName , self :: getPerson ( ) , $ optParams ) ;...
Update a People Contact
2,037
public function beforeSave ( $ insert ) { if ( ! $ this -> sort_order ) { $ property = Property :: findById ( $ this -> property_id ) ; $ this -> sort_order = count ( static :: valuesForProperty ( $ property ) ) ; } return parent :: beforeSave ( $ insert ) ; }
Performs beforeSave event
2,038
public function actions ( ) { return [ 'add-model-property-group' => [ 'class' => AddModelPropertyGroup :: class , ] , 'delete-model-property-group' => [ 'class' => DeleteModelPropertyGroup :: class , ] , 'list-property-groups' => [ 'class' => ListPropertyGroups :: class , ] , 'edit-property-group' => [ 'class' => Edit...
This controller just uses actions in extension
2,039
public function setTimestamp ( $ unixTs ) { $ this -> ts = strtotime ( date ( 'Y-m-d' , $ unixTs ) ) ; $ this -> month = date ( 'n' , $ this -> ts ) ; $ this -> year = date ( 'Y' , $ this -> ts ) ; $ this -> monthTs = strtotime ( date ( 'Y-m-01' , $ unixTs ) ) ; }
Set the timestamp which will be used to store the data . By default current time is used .
2,040
public function save ( ) { $ entries = $ this -> logBuffer -> getEntries ( ) ; $ entrySkeleton = [ 'ts' => $ this -> ts , 'month' => $ this -> month , 'year' => $ this -> year ] ; $ dimensionSkeleton = [ 'ts' => $ this -> ts , 'month' => $ this -> month , 'year' => $ this -> year ] ; foreach ( $ entries as $ e ) { $ en...
Save all the entries from the buffer .
2,041
public function query ( $ entity , $ ref = 0 , array $ dateRange ) { return new Query ( $ this -> mongo , $ entity , $ ref , $ dateRange ) ; }
Query the analytics data .
2,042
private function createCollections ( ) { $ collections = $ this -> mongo -> listCollections ( ) ; $ collectionsCreated = false ; foreach ( $ collections as $ collection ) { if ( $ collection -> getName ( ) == self :: ADB_STATS_DAILY ) { $ collectionsCreated = true ; break ; } } if ( ! $ collectionsCreated ) { $ this ->...
Creates the necessary indexes and collections if they don t exist .
2,043
public static function uploadImage ( UploadedFile $ uploadedFile , $ context , $ storage = 'local' , $ fileName = null ) { $ file = Facades \ File :: get ( $ uploadedFile ) ; $ processor = app ( 'icr.processor' ) ; return $ processor -> upload ( $ context , $ file , $ uploadedFile -> getClientOriginalExtension ( ) , Fa...
Handles upload image . Returns exception instance on error or file name on success .
2,044
public static function deleteImage ( $ fileName , $ context , $ storage = 'local' ) { $ processor = app ( 'icr.processor' ) ; return $ processor -> delete ( $ fileName , $ context , Facades \ Storage :: disk ( $ storage ) ) ; }
Handles delete image . Returns exception instance on error .
2,045
public static function renameImage ( $ oldFileName , $ newFileName , $ context , $ storage = 'local' ) { $ filesystemAdapter = Facades \ Storage :: disk ( $ storage ) ; $ processor = app ( 'icr.processor' ) ; return $ processor -> rename ( $ oldFileName , $ newFileName , $ context , $ filesystemAdapter ) ; }
Renames existing image
2,046
protected function handleProcedures ( array $ procedures ) { foreach ( $ procedures as $ procedure ) { $ this -> handleProcedureOuter ( $ procedure ) ; if ( $ procedure -> hasChildren ( ) ) { $ this -> handleProcedures ( $ procedure -> getChildren ( ) ) ; } } }
Handles procedures .
2,047
protected function handleSource ( SourceAdapterInterface $ adapter , Request $ request ) { $ this -> injectDependencies ( $ adapter ) ; $ response = $ adapter -> receive ( $ request ) ; if ( $ response === null ) { throw new MissingResponseException ( $ adapter ) ; } return $ response ; }
Handles source .
2,048
protected function handleSources ( array $ sources ) { $ responses = array ( ) ; foreach ( $ sources as $ source ) { list ( $ adapter , $ request ) = $ source ; $ responses [ ] = $ this -> handleSource ( $ adapter , $ request ) ; } $ iterator = new \ AppendIterator ( ) ; foreach ( $ responses as $ response ) { $ iterat...
Handles sources .
2,049
protected function handleWorker ( WorkerInterface $ worker , $ object , StorageInterface $ storage ) { $ this -> injectDependencies ( $ worker ) ; $ modifiedObject = $ worker -> handle ( $ object ) ; if ( $ modifiedObject === null && $ object !== null ) { $ storage -> remove ( $ object ) ; } elseif ( $ modifiedObject !...
Handles worker .
2,050
protected function handleWorkers ( array $ workers , StorageInterface $ storage ) { foreach ( $ workers as $ worker ) { foreach ( $ storage -> all ( ) as $ element ) { $ this -> handleWorker ( $ worker , $ element , $ storage ) ; } } }
Handles workers .
2,051
protected function handleTarget ( TargetAdapterInterface $ adapter , Request $ request ) { $ this -> injectDependencies ( $ adapter ) ; $ response = $ adapter -> send ( $ request ) ; if ( $ response === null ) { throw new MissingResponseException ( $ adapter ) ; } return $ response ; }
Handles target .
2,052
protected function handleTargets ( array $ targets , Request $ request ) { $ responses = array ( ) ; foreach ( $ targets as $ target ) { $ responses [ ] = $ this -> handleTarget ( $ target , $ request ) ; } return $ responses ; }
Handles targets .
2,053
protected function nextObject ( \ Iterator $ iterator ) { if ( $ iterator -> valid ( ) ) { $ object = $ iterator -> current ( ) ; $ iterator -> next ( ) ; return $ object ; } return false ; }
Returns next object for an iterator .
2,054
protected function createStorage ( $ scope ) { $ storage = new InMemoryStorage ( ) ; $ this -> stack -> setScope ( $ scope , $ storage ) ; return $ storage ; }
Creates scoped storage .
2,055
protected function injectDependencies ( $ component ) { if ( $ component instanceof StorageStackAwareInterface ) { $ component -> setStorageStack ( $ this -> stack ) ; } if ( $ component instanceof LoggerAwareInterface && $ this -> logger instanceof LoggerInterface ) { $ component -> setLogger ( $ this -> logger ) ; } ...
Injects dependencies .
2,056
protected function mergeStorage ( StorageInterface $ storage ) { foreach ( $ storage -> all ( ) as $ id => $ object ) { $ this -> stack -> getScope ( 'global' ) -> add ( $ object ) ; } }
Merges local storage with global storage .
2,057
public function process ( EventInterface $ event ) { $ events = $ this -> getEventManager ( ) ; $ mapper = $ this -> getMapper ( ) ; $ optionsProvider = $ this -> getOptionsProvider ( ) ; $ translator = $ this -> getTranslator ( ) ; $ pane = $ event -> getParam ( 'pane' ) ; if ( ! $ optionsProvider -> hasIdentifier ( $...
Emptying the trash
2,058
public function acquire ( bool $ blocker = false ) : bool { if ( ! is_resource ( $ this -> lock ) ) { return false ; } return flock ( $ this -> lock , ( $ blocker ) ? LOCK_EX : LOCK_EX | LOCK_NB ) ; }
Acquires the lock .
2,059
public function actionTreeMove ( $ id , $ pid ) { $ child = $ this -> findModel ( $ id ) ; $ oldParent = $ this -> findModel ( $ pid ) ; $ newParent = $ this -> findModel ( Yii :: $ app -> request -> post ( 'pid' ) ) ; $ child -> move ( $ oldParent , $ newParent ) ; echo json_encode ( $ child -> nodeAttributes ( $ chil...
Detaches model from old parent . And attaches to the new one .
2,060
public function addToken ( $ name , $ position ) { $ token = new Token ( $ name , $ position ) ; $ this -> tokens [ ] = $ token ; switch ( substr ( $ name , - 4 ) ) { case AbstractBlockRule :: OPEN : $ this -> openedTokens [ ] = substr ( $ name , 0 , - 5 ) ; break ; case AbstractBlockRule :: CLOSE : while ( count ( $ t...
Add token to token list
2,061
public function getTokenAt ( $ index ) { if ( $ index < 0 ) { $ index = count ( $ this -> tokens ) + $ index ; } return $ this -> tokens [ $ index ] ; }
Get token at given position
2,062
public function insertTokenAt ( $ name , $ position , $ index ) { array_splice ( $ this -> tokens , $ index , 0 , [ $ token = new Token ( $ name , $ position ) ] ) ; return $ token ; }
Add token to specific index position
2,063
public function removeTokenAt ( $ index ) { if ( $ index < 0 ) { $ index = count ( $ this -> tokens ) + $ index ; } array_splice ( $ this -> tokens , $ index , 1 ) ; }
Remove token at specific index position
2,064
public function lastByName ( $ name ) { for ( $ i = count ( $ this -> tokens ) - 1 ; $ i >= 0 ; $ i -- ) { if ( $ this -> tokens [ $ i ] -> getName ( ) === $ name ) { return $ this -> tokens [ $ i ] ; } } return null ; }
Get last token that match provided name
2,065
public function lastIndexByName ( $ name ) { for ( $ i = count ( $ this -> tokens ) - 1 ; $ i >= 0 ; $ i -- ) { if ( $ this -> tokens [ $ i ] -> getName ( ) === $ name ) { return $ i ; } } return null ; }
Get last token index that match provided name
2,066
public function merge ( TokenList $ tokenList ) { $ tokenList -> closeOpenTokens ( ) ; $ lastTokenPosition = $ this -> last ( ) === null ? 0 : $ this -> last ( ) -> getPosition ( ) ; foreach ( $ tokenList -> getTokens ( ) as $ token ) { $ token -> setPosition ( $ token -> getPosition ( ) + $ lastTokenPosition ) ; $ thi...
Merge two token list
2,067
public function closeOpenTokens ( ) { $ lastToken = $ this -> last ( ) ; while ( count ( $ this -> openedTokens ) > 0 ) { $ lastOpenToken = array_pop ( $ this -> openedTokens ) ; $ this -> tokens [ ] = new Token ( $ lastOpenToken . AbstractBlockRule :: CLOSE , $ lastToken -> getPosition ( ) ) ; } }
Automatically close unclosed tags
2,068
public static function connection ( $ name ) { $ schema = static :: $ app [ 'db' ] -> connection ( $ name ) -> getSchemaBuilder ( ) ; $ schema -> blueprintResolver ( function ( $ table , $ callback ) { return new Blueprint ( $ table , $ callback ) ; } ) ; return $ schema ; }
Get a schema builder instance for a connection .
2,069
public static function userAssignments ( $ user ) { $ names = self :: find ( ) -> where ( [ 'user_id' => $ user -> id ] ) -> select ( 'item_name' ) -> column ( ) ; return AuthItem :: find ( ) -> where ( [ 'in' , 'name' , $ names ] ) ; }
Searches all user assignments .
2,070
public function setCheckboxAttribute ( $ a , $ v ) { foreach ( $ this -> checkboxes as $ checkbox ) { $ checkbox -> setAttribute ( $ a , $ v ) ; if ( $ a == 'tabindex' ) { $ v ++ ; } } return $ this ; }
Set an attribute for the input checkbox elements
2,071
public function setCheckboxAttributes ( array $ a ) { foreach ( $ this -> checkboxes as $ checkbox ) { $ checkbox -> setAttributes ( $ a ) ; if ( isset ( $ a [ 'tabindex' ] ) ) { $ a [ 'tabindex' ] ++ ; } } return $ this ; }
Set an attribute or attributes for the input checkbox elements
2,072
public function setValue ( $ value ) { $ this -> checked = ( ! is_array ( $ value ) ) ? [ $ value ] : $ value ; if ( ( count ( $ this -> checked ) > 0 ) && ( $ this -> hasChildren ( ) ) ) { foreach ( $ this -> childNodes as $ child ) { if ( $ child instanceof Input \ Checkbox ) { if ( in_array ( $ child -> getValue ( )...
Set the checked value of the checkbox form elements
2,073
public function render ( $ depth = 0 , $ indent = null , $ inner = false ) { if ( ! empty ( $ this -> legend ) ) { $ this -> addChild ( new Child ( 'legend' , $ this -> legend ) ) ; } return parent :: render ( $ depth , $ indent , $ inner ) ; }
Render the child and its child nodes
2,074
public function getDataInInterval ( $ coordinatesRequest , DateTime $ date , $ timeMinuteLimit = 30 , $ sorted = true ) { $ parameters = [ ] ; $ queriedStations = [ ] ; $ date = Carbon :: instance ( $ date ) -> setTimezone ( 'utc' ) ; foreach ( $ this -> services as $ var => $ hourlyService ) { $ stations = $ this -> g...
Retrieve data from one of the nearest stations . This method retrieves all stations in a specific diameter around the location . It then queries the stations one by one until one station s results could be found .
2,075
public function getDataByDay ( Coordinate $ coordinatesRequest , DateTime $ day ) { $ parameters = [ ] ; $ queriedStations = [ ] ; $ day = Carbon :: instance ( $ day ) -> setTimezone ( 'utc' ) ; foreach ( $ this -> services as $ var => $ hourlyService ) { $ stations = $ this -> getStations ( $ hourlyService , true ) ; ...
Get all data for the given day . The parameter day is converted to UTC!
2,076
public function getStations ( AbstractHourlyService $ controller , bool $ activeOnly = false , bool $ forceDownloadFile = false ) { $ downloadFile = false || $ forceDownloadFile ; $ stationsFTPPath = DWDConfiguration :: getHourlyConfiguration ( ) -> parameters ; $ stationsFTPPath = get_object_vars ( $ stationsFTPPath )...
Retrieves the correct stations file can be filtered to only show stations that are flagges as active . Conditions for this can be
2,077
public function retrieveFile ( AbstractHourlyService $ service , DWDStation $ nearestStation , $ forceDownloadFile = false ) { $ config = DWDConfiguration :: getConfiguration ( ) ; $ ftpConfig = $ config -> ftp ; $ fileName = $ service -> getFileName ( $ nearestStation -> getId ( ) ) ; $ ftpPath = $ service -> getFileF...
Retrieves a file for the controller by querying the nearest station .
2,078
private function retrieveData ( $ content , DWDStation $ nearestStation , Coordinate $ coordinate , AbstractHourlyService $ hourlyController , DateTime $ dateTime , $ timeMinuteLimit ) { $ timeBefore = Carbon :: instance ( $ dateTime ) ; $ timeAfter = Carbon :: instance ( $ dateTime ) ; $ timeBefore -> addMinute ( $ ti...
DWD Hourly data is not really hourly as such first try to query with the specified limit then if the limit is smaller than + - 1 . 5h or + - 3 . 5h Query those values and return them .
2,079
public function sendCodeceptionOutputToSlack ( $ slackChannel , $ slackToken = null , $ codeceptionOutputFolder = null ) { if ( is_null ( $ slackToken ) ) { $ this -> say ( 'we are in Travis environment, getting token from ENV' ) ; $ slackToken = getenv ( 'SLACK_ENCRYPTED_TOKEN' ) ; } $ result = $ this -> taskSendCodec...
Sends Codeception errors to Slack
2,080
public function input ( $ key , $ default = false ) { return $ this -> getRequestInputByType ( ) -> has ( $ key ) ? $ this -> getRequestInputByType ( ) -> get ( $ key ) : $ default ; }
Get a request parameter by key .
2,081
public function getRequestInputByType ( ) { $ data = $ this -> instance -> getRealMethod ( ) == 'GET' ? HttpFoundation :: createFromGlobals ( ) -> query : HttpFoundation :: createFromGlobals ( ) -> request ; if ( $ data ) { foreach ( $ data -> all ( ) as $ key => $ value ) { session ( ) -> createFlashMessage ( $ key , ...
get the request data base on request method .
2,082
public function getHeader ( $ key , $ default = false ) { return $ this -> headers -> has ( $ key ) ? $ this -> headers -> get ( $ key ) : $ default ; }
Get specific header .
2,083
public static function old ( $ key = null ) { if ( is_null ( $ key ) ) { return session ( ) -> getFlashMessage ( 'request' ) ? : '' ; } return session ( ) -> getFlashMessage ( $ key ) ? : '' ; }
Get old request value from session .
2,084
public static function createFromDefinition ( array $ definition , Procedure $ parent = null ) { $ procedure = new self ( $ definition [ 'name' ] , $ definition [ 'sources' ] , $ definition [ 'workers' ] , $ definition [ 'targets' ] , $ parent ) ; foreach ( $ definition [ 'children' ] as $ child ) { $ procedure -> addC...
Creates a procedure from a definition .
2,085
private function getParentSettings ( $ type , $ context = null ) { $ context = $ this -> normalizeContext ( $ context ) ; $ methods = array ( 'source' => 'getSources' , 'worker' => 'getWorkers' , 'target' => 'getTargets' , ) ; if ( ! array_key_exists ( $ type , $ methods ) || $ context -> getParent ( ) === null ) { ret...
Returns parent settings .
2,086
protected function path ( ) { if ( $ this -> parent ) { return $ this -> parent -> path ( ) . '/devices' ; } $ class = static :: $ resourceClass ; $ path = $ class :: $ path ; if ( $ this -> catalog ) { $ path .= '/catalog' ; } return $ path ; }
Return the API path for the query
2,087
public function getAttribute ( int $ index ) : ? Node { return isset ( $ this -> attributes [ $ index ] ) ? $ this -> attributes [ $ index ] : null ; }
Gets an attribute node
2,088
public function getChild ( int $ index ) : Node { if ( ! isset ( $ this -> children [ $ index ] ) ) { throw new AegisError ( 'Could not get child from node, because there\'s no child at index ' . $ i ) ; } return $ this -> children [ $ index ] ; }
Gets the child at the given index
2,089
public function removeChild ( int $ index ) { if ( ! isset ( $ this -> children [ $ index ] ) ) { throw new AegisError ( 'Could remove child from node, because there\'s no child at index ' . $ index ) ; } unset ( $ this -> children [ $ index ] ) ; }
Removes the child node at the given index
2,090
public function setValue ( $ value ) { if ( $ value == $ this -> getAttribute ( 'value' ) ) { $ this -> check ( ) ; } else { $ this -> uncheck ( ) ; } return $ this ; }
Set the value of the form input element object
2,091
public function isSubmitted ( ) { $ postParams = $ this -> request -> getParsedBody ( ) ; if ( count ( $ postParams ) > 0 ) { $ this -> setFieldValues ( $ postParams ) ; } return ( count ( $ postParams ) > 0 ) ; }
Method to verify a form isSubmitted
2,092
public function createFieldset ( $ legend = null , $ container = null ) { $ fieldset = new Fieldset ( ) ; if ( null !== $ legend ) { $ fieldset -> setLegend ( $ legend ) ; } if ( null !== $ container ) { $ fieldset -> setContainer ( $ container ) ; } $ this -> addFieldset ( $ fieldset ) ; $ id = ( null !== $ this -> ge...
Method to create a new fieldset object
2,093
public function setAttribute ( $ a , $ v ) { parent :: setAttribute ( $ a , $ v ) ; if ( $ a == 'id' ) { foreach ( $ this -> fieldsets as $ i => $ fieldset ) { $ id = $ v . '-fieldset-' . ( $ i + 1 ) ; $ fieldset -> setAttribute ( 'id' , $ id ) ; } } else if ( $ a == 'class' ) { foreach ( $ this -> fieldsets as $ i => ...
Method to set an attribute
2,094
public function setAttributes ( array $ a ) { foreach ( $ a as $ name => $ value ) { $ this -> setAttribute ( $ name , $ value ) ; } return $ this ; }
Method to set attributes
2,095
public function addFieldset ( Fieldset $ fieldset ) { $ this -> fieldsets [ ] = $ fieldset ; $ this -> current = count ( $ this -> fieldsets ) - 1 ; return $ this ; }
Method to add fieldset
2,096
public function removeFieldset ( $ i ) { if ( isset ( $ this -> fieldsets [ ( int ) $ i ] ) ) { unset ( $ this -> fieldsets [ ( int ) $ i ] ) ; } $ this -> fieldsets = array_values ( $ this -> fieldsets ) ; if ( ! isset ( $ this -> fieldsets [ $ this -> current ] ) ) { $ this -> current = ( count ( $ this -> fieldsets ...
Method to remove fieldset
2,097
public function getFieldset ( ) { return ( isset ( $ this -> fieldsets [ $ this -> current ] ) ) ? $ this -> fieldsets [ $ this -> current ] : null ; }
Method to get current fieldset
2,098
public function addColumn ( $ fieldsets , $ class = null ) { if ( ! is_array ( $ fieldsets ) ) { $ fieldsets = [ $ fieldsets ] ; } foreach ( $ fieldsets as $ i => $ num ) { $ fieldsets [ $ i ] = ( int ) $ num - 1 ; } if ( null === $ class ) { $ class = 'pop-form-column-' . ( count ( $ this -> columns ) + 1 ) ; } $ this...
Method to add form column
2,099
public function setCurrent ( $ i ) { $ this -> current = ( int ) $ i ; if ( ! isset ( $ this -> fieldsets [ $ this -> current ] ) ) { $ this -> fieldsets [ $ this -> current ] = $ this -> createFieldset ( ) ; } return $ this ; }
Method to get current fieldset index