idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
4,100
public static function Apcs ( $ date1 , $ date2 , array $ pv , array $ ebpv , array $ ehp , iauASTROM & $ astrom ) { $ AUDMS = DAU / DAYSEC ; $ CR = AULT / DAYSEC ; $ i ; $ dp ; $ dv ; $ pb = [ ] ; $ vb = [ ] ; $ ph = [ ] ; $ v2 ; $ w ; $ astrom -> pmt = ( ( $ date1 - DJ00 ) + $ date2 ) / DJY ; for ( $ i = 0 ; $ i < 3 ...
- - - - - - - - i a u A p c s - - - - - - - -
4,101
protected function createSocket ( $ hostname , $ port , $ timeout ) { $ socketHandle = @ fsockopen ( $ hostname , $ port , $ errno , $ errstr , $ timeout ) ? : null ; if ( null === $ socketHandle ) { throw new \ RuntimeException ( sprintf ( 'Could not connect to socket. (%s)' , $ errstr ) ) ; } return $ socketHandle ; ...
This method strictly doesn t need to exist but can act as a seam for substituting fake sockets in test . This would require a subclass that overloads the method and returns the fake socket .
4,102
protected function buildHttpRequest ( $ path , $ hostname ) { $ r = array ( ) ; $ r [ ] = "GET {$path} HTTP/1.1" ; $ r [ ] = "Host: {$hostname}" ; $ r [ ] = "Connection: Close" ; $ r [ ] = "User-Agent: HttpAdapter PHP-Library" ; $ r [ ] = "\r\n" ; return implode ( "\r\n" , $ r ) ; }
Build the HTTP 1 . 1 request headers from the given inputs .
4,103
public function authenticate ( $ password ) { $ packet = $ this -> createPacket ( Packet :: SERVERDATA_AUTH , $ password ) ; $ response = $ this -> sendPacket ( $ packet ) ; if ( $ response -> getType ( ) !== Packet :: SERVERDATA_AUTH_RESPONSE ) { throw new Exception \ AuthenticationFailed ( 'Invalid packet type return...
Authenticates the connection
4,104
public function sendPacket ( Packet $ packet ) { $ rawPacket = $ packet -> convertToRcon ( ) ; $ rawPacket = pack ( 'V' , mb_strlen ( $ rawPacket ) ) . $ rawPacket ; $ this -> socket -> write ( $ rawPacket ) ; $ packetSize = $ this -> socket -> read ( 4 ) ; $ packetSize = unpack ( 'V' , $ packetSize ) ; $ packetSize = ...
Sends a packet through the connection
4,105
public function mirror ( $ map ) { $ fs = $ this -> getFS ( ) ; $ root = $ this -> finder -> getSourceRoot ( ) ; foreach ( $ map as $ type => $ pathMap ) { foreach ( $ pathMap as $ sourcePath => $ destinationPath ) { if ( $ fs -> exists ( $ root . DIRECTORY_SEPARATOR . $ sourcePath ) ) { if ( $ type === 'core' ) { $ fs...
Given the source and destination path map build the Drupal root .
4,106
protected function initConsole ( ) { $ consoles = $ this -> setConsoles ( ) ; foreach ( $ consoles as $ console ) { if ( $ console [ 0 ] == $ this -> consoleArguments [ 0 ] ) { Console :: add ( $ console [ 1 ] , $ this -> consoleArguments ) ; } } Console :: dispatch ( ) ; }
Initialize the console
4,107
protected function initRouter ( ) { $ routes = $ this -> setRoutes ( ) ; foreach ( $ routes as $ route ) { if ( $ route [ 0 ] == 'any' ) { Router :: any ( $ route [ 1 ] , $ route [ 2 ] ) ; } elseif ( $ route [ 0 ] == 'get' ) { Router :: get ( $ route [ 1 ] , $ route [ 2 ] ) ; } elseif ( $ route [ 0 ] == 'post' ) { Rout...
Initialize the router
4,108
protected function initLogger ( ) : self { $ settings = $ this -> container -> get ( "settings" ) ; $ logger = new Logger ( $ settings [ "logger" ] [ "channel" ] ) ; $ logger -> pushHandler ( new $ settings [ "logger" ] [ "class" ] [ 0 ] ( ... $ settings [ "logger" ] [ "class" ] [ 1 ] ) ) ; $ this -> container -> set (...
Initializes Core logger .
4,109
protected function loadRoutingTable ( string $ routing_table_filepath ) : Core { if ( file_exists ( $ routing_table_filepath ) === false ) { throw new RoutingTableNotFoundException ( ) ; } $ loadedRoutes = require ( $ routing_table_filepath ) ; if ( is_array ( $ loadedRoutes ) === false ) { throw new InvalidRoutingTabl...
Loads application routing table .
4,110
protected function loadSettings ( string $ settings_filepath ) : Core { if ( file_exists ( $ settings_filepath ) === false ) { throw new SettingsNotFoundException ( ) ; } $ settings = require ( $ settings_filepath ) ; if ( is_array ( $ settings ) === false ) { throw new InvalidSettingsException ( ) ; } $ this -> contai...
Loads Core settings
4,111
public function run ( bool $ return_response = false ) { try { $ dispatchResult = $ this -> dispatch ( ) ; if ( $ dispatchResult instanceof ResponseInterface ) { $ response = $ dispatchResult ; } else { $ requestHandler = new RequestHandler ( $ this -> container ) ; $ response = $ requestHandler -> handle ( $ this -> c...
Core main method to be called by entry script .
4,112
public static function Nut06a ( $ date1 , $ date2 , & $ dpsi , & $ deps ) { $ t ; $ fj2 ; $ dp ; $ de ; $ t = ( ( $ date1 - DJ00 ) + $ date2 ) / DJC ; $ fj2 = - 2.7774e-6 * $ t ; IAU :: Nut00a ( $ date1 , $ date2 , $ dp , $ de ) ; $ dpsi = $ dp + $ dp * ( 0.4697e-6 + $ fj2 ) ; $ deps = $ de + $ de * $ fj2 ; return ; }
- - - - - - - - - - i a u N u t 0 6 a - - - - - - - - - -
4,113
public function build ( $ name = null , array $ attributes = [ ] , $ callback = null ) { if ( ! $ this -> validator -> isValid ( $ attributes ) ) { throw new Exception \ InvalidAttributesException ( 'Invalid validator class' ) ; } unset ( $ attributes [ 'form' ] ) ; $ field = new Fluent ( [ 'name' => $ name , 'value' =...
builds form element container
4,114
protected function memorize ( Fluent $ field ) { if ( ! isset ( $ field -> attributes [ 'executor' ] ) ) { return false ; } $ component = $ this -> extractor -> extractForm ( $ field -> attributes [ 'executor' ] ) ; $ attributes = array_merge ( $ component , [ 'name' => $ field -> get ( 'name' ) ] , $ field -> attribut...
insert properties into memory
4,115
public function editDownload ( ) { $ this -> downloadErrorsDownload ( ) ; $ this -> setTitleEditDownload ( ) ; $ this -> setBreadcrumbEditDownload ( ) ; $ this -> submitDownload ( ) ; $ sources = $ this -> getData ( 'download.sources' ) ; if ( is_array ( $ sources ) ) { $ this -> setData ( 'download.sources' , implode ...
Route page callback to display the module download page
4,116
protected function setBreadcrumbEditDownload ( ) { $ breadcrumbs = array ( ) ; $ breadcrumbs [ ] = array ( 'text' => $ this -> text ( 'Dashboard' ) , 'url' => $ this -> url ( 'admin' ) ) ; $ breadcrumbs [ ] = array ( 'text' => $ this -> text ( 'Modules' ) , 'url' => $ this -> url ( 'admin/module/list' ) ) ; $ this -> s...
Set breadcrumbs on the module download page
4,117
protected function downloadErrorsDownload ( ) { $ file = $ this -> install_model -> getErrorLogFile ( ) ; if ( $ this -> isQuery ( 'download_errors' ) && is_file ( $ file ) ) { $ this -> download ( $ file ) ; } }
Downloads an error log file
4,118
protected function submitDownload ( ) { if ( $ this -> isPosted ( 'install' ) && $ this -> validateDownload ( ) ) { $ this -> controlAccess ( 'module_installer_download' ) ; $ this -> install_model -> fromUrl ( $ this -> getSubmitted ( 'sources' ) ) ; } }
Handles submitted data
4,119
protected function validateDownload ( ) { $ this -> setSubmitted ( 'download' ) ; $ this -> setSubmittedArray ( 'sources' ) ; $ this -> validateElement ( 'sources' , 'required' ) ; $ this -> validateUrlDownload ( ) ; return ! $ this -> hasErrors ( ) ; }
Validate an array of submitted data
4,120
protected function validateUrlDownload ( ) { $ invalid = array ( ) ; foreach ( $ this -> getSubmitted ( 'sources' ) as $ line => $ url ) { $ line ++ ; if ( filter_var ( $ url , FILTER_VALIDATE_URL ) === false ) { $ invalid [ ] = $ line ; } } if ( ! empty ( $ invalid ) ) { $ this -> setError ( 'sources' , $ this -> text...
Validates an array of submitted source URLs
4,121
function ajouter ( $ elem ) { echo "ajouter" ; if ( is_array ( $ elem ) ) { foreach ( $ elem as $ e ) { $ array_messages [ ] = $ e ; } } else { $ array_messages [ ] = $ elem ; } }
Add a message to the array
4,122
public static function setReportLevel ( string $ level ) : Matcha { if ( ReportLevel :: has ( $ level ) === false ) { throw new InvalidArgumentException ( sprintf ( 'The report level should be one of the following: %s, %s given' , implode ( ', ' , ReportLevel :: availables ( ) ) , $ level ) ) ; } static :: $ reportLeve...
Manually set the report level .
4,123
public static function run ( ) : int { $ startOfRun = microtime ( true ) ; $ testDurationInMicroseconds = 0 ; $ reporter = new ConsoleReporter ; $ reporter -> setMaxEntries ( static :: $ numberOfTest ) ; $ reporter -> doNotClearProgress ( ) ; $ reporter -> displaySeverityWithIcons ( ) ; $ reporter -> setProgressBarSize...
Run each test and report the errors if there is any .
4,124
public function getColumns ( string $ line ) : array { $ columns = [ ] ; $ columnStart = 0 ; $ lastColumnIndex = count ( $ this -> columnWidths ) - 1 ; foreach ( $ this -> columnWidths as $ i => $ columnWidth ) { $ actualWidth = $ i === $ lastColumnIndex ? strlen ( $ line ) : $ columnWidth ; $ columns [ ] = trim ( subs...
Fetches the data from the line using the column widths to split the data .
4,125
protected function filterExistingFiles ( array $ files , array $ existingFiles ) { return array_where ( $ files , function ( $ value , $ key ) use ( $ existingFiles ) { if ( is_array ( $ value ) ) { return in_array ( $ key , $ existingFiles ) ; } return in_array ( $ value , $ existingFiles ) ; } ) ; }
Filters files array and returns values ony for existing files
4,126
public function validate ( $ section , Constraint $ constraint ) { $ check = $ this -> container -> get ( 'admin.configuration.configsection_manager' ) -> getRepository ( ) -> findOneByName ( $ section -> getName ( ) ) ; if ( $ check && $ check -> getId ( ) !== $ section -> getId ( ) ) { $ message = $ this -> container...
Validate the section
4,127
public function email ( ) { $ this -> debug -> groupCollapsed ( __METHOD__ ) ; $ cfg = $ this -> form -> cfg ; $ this -> emailHeaders = $ cfg [ 'email' ] [ 'headers' ] ; $ this -> debug -> log ( 'emailHeaders' , $ this -> emailHeaders ) ; $ emailBody = '' ; $ this -> collected = array ( 'email' => '' , 'name' => '' , )...
Email form results
4,128
private function emailGetMetaInfo ( ) { $ cfg = $ this -> from -> cfg ; $ meta = array ( 'Submitted on ' . \ date ( 'F j, Y, g:ia' ) , 'URL' => Html :: getSelfUrl ( array ( ) , array ( 'fullUrl' => true , 'chars' => false ) ) , ! empty ( $ _COOKIE [ 'referer' ] ) ? 'Came to ' . $ _SERVER [ 'HTTP_HOST' ] . ' via: ' . $ ...
Build Meta Info
4,129
public function log ( ) { $ this -> debug -> groupCollapsed ( __METHOD__ ) ; $ this -> columns = array ( array ( 'key' => 'Date' , 'value' => \ date ( 'F j, Y' ) ) , array ( 'key' => 'Time' , 'value' => \ date ( 'g:ia' ) ) , array ( 'key' => 'IP Address' , 'value' => $ _SERVER [ 'REMOTE_ADDR' ] ) , ) ; $ typesSkip = ar...
Log to form values to file
4,130
private function logWriteFile ( ) { $ cfg = $ this -> form -> cfg ; $ file = $ cfg [ 'logFile' ] ; $ keys = \ array_column ( $ this -> columns , 'key' ) ; $ values = \ array_column ( $ this -> columns , 'values' ) ; $ appendFile = false ; $ keyCounts = array ( ) ; foreach ( $ keys as $ k => $ key ) { $ key = \ trim ( \...
Write log to file
4,131
public function setController ( ) { if ( count ( $ this -> urlComponentsArray ) > 0 ) { $ this -> controller = $ this -> urlComponentsArray [ 0 ] ; return $ this ; } else { $ this -> controller = null ; return $ this ; } }
This defines the infered controller from the url string
4,132
public function setMethod ( ) { if ( count ( $ this -> urlComponentsArray ) > 1 ) { $ this -> method = $ this -> urlComponentsArray [ 1 ] ; return $ this ; } else { $ this -> method = null ; return $ this ; } }
This method sets the value of the method infered from the input string
4,133
public function setParameters ( $ value = null , $ appendParameter = true ) { $ this -> parameters = ( count ( $ this -> urlComponentsArray ) > 2 ) ? ArrayHelper :: slice ( $ this -> urlComponentsArray , 2 ) -> get ( ) : array ( ) ; if ( $ value !== null ) { if ( $ appendParameter === true ) { $ this -> parameters [ ] ...
This method sets the url string request parameters for this input string
4,134
public function getHttpClient ( $ uri = null ) { $ client = clone $ this -> httpClient ; if ( $ uri ) { $ client -> setUri ( $ uri ) ; } return $ client ; }
Get http client
4,135
public function getUserByEmail ( $ email ) { if ( ! array_key_exists ( $ email , static :: $ userCache ) ) { static :: $ userCache [ $ email ] = $ this -> getUserMapper ( ) -> findByEmail ( $ email ) ; } return static :: $ userCache [ $ email ] ; }
Get user by email
4,136
protected static function getLockData ( ) { if ( null === static :: $ lockData ) { $ data = Json :: decode ( file_get_contents ( static :: LOCK_FILE ) , Json :: TYPE_ARRAY ) ; if ( empty ( $ data ) ) { static :: $ lockData = array ( ) ; } else { static :: $ lockData = ( array ) $ data ; } } return static :: $ lockData ...
Lazy - load lock data
4,137
protected function queryJson ( $ uri ) { $ response = $ this -> getHttpClient ( $ uri ) -> send ( ) ; if ( $ response -> isOk ( ) ) { $ headers = $ response -> getHeaders ( ) ; if ( $ headers -> has ( 'Content-Type' ) && preg_match ( '#^(application|text)/(.*\+)?json(\s*;.*)?$#' , $ headers -> get ( 'Content-Type' ) ->...
Query JSON data by uri
4,138
private function contains ( $ query , $ name , $ description , array $ keywords ) { $ endResult = true ; $ query = mb_strtolower ( $ query ) ; $ name = mb_strtolower ( $ name ) ; $ description = mb_strtolower ( $ description ) ; foreach ( $ keywords as & $ keyword ) { $ keyword = mb_strtolower ( $ keyword ) ; } foreach...
Query by contains some words
4,139
public function find ( $ name ) { if ( ! $ this -> getEnabledList ( ) -> isEnabled ( $ name ) ) { return null ; } $ data = $ this -> queryData ( $ name ) ; if ( $ data ) { $ structure = new Structure ( $ data ) ; $ structure -> setMapper ( $ this ) ; return $ structure ; } return null ; }
Find a structure by name
4,140
public function findAll ( $ where = null , $ order = null , $ limit = null , $ offset = null ) { $ iterator = $ this -> findIterator ( $ where , $ order ) ; if ( $ limit || $ offset ) { $ iterator = new LimitIterator ( $ iterator , ( int ) $ offset , ( int ) $ limit ? : null ) ; } return $ iterator ; }
Find multiple structures
4,141
public function findOne ( $ where = null , $ order = null ) { foreach ( $ this -> findIterator ( $ where , $ order ) as $ structure ) { if ( $ structure ) { return $ structure ; } } return null ; }
Find one structure
4,142
public static function normalizePath ( $ path , $ filter = [ '' , '.' , '..' ] , $ separator = '/' ) { $ parts = explode ( '/' , trim ( str_replace ( '\\' , '/' , $ path ) , '/' ) ) ; $ filterMethod = function ( $ segment ) use ( $ filter ) { return ! in_array ( $ segment , $ filter ) ; } ; return join ( $ separator , ...
Normalize path string . Will remove slash at the beginning if presented .
4,143
protected function getBaseTemplate ( Request $ request = null ) { $ request = $ this -> resolveRequest ( $ request ) ; if ( $ request -> get ( '_pjax' ) ) { return 'GlavwebCmsCoreBundle::sonata_admin_pajax_layout.html.twig' ; } if ( $ this -> isXmlHttpRequest ( $ request ) ) { return $ this -> admin -> getTemplate ( 'a...
Returns the base template name .
4,144
public static function makeZipArchiver ( $ file , $ pclZip = false , $ write = false ) { if ( $ pclZip ) { include_once dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'ArchiverPclZip.php' ; return new ArchiverPclZip ( $ file ) ; } else { include_once dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . 'ArchiverZipArchive.php' ;...
Create instance of Zip or Pcl archiver
4,145
public static function create ( $ file ) { $ zipArchive = class_exists ( 'ZipArchive' ) ; try { return self :: makeZipArchiver ( $ file , ! $ zipArchive , true ) ; } catch ( Exception $ e ) { return self :: makeZipArchiver ( $ file , $ zipArchive , true ) ; } }
Create Zip archive
4,146
public static function open ( $ file ) { $ zipArchive = class_exists ( 'ZipArchive' ) ; try { return self :: makeZipArchiver ( $ file , ! $ zipArchive , false ) ; } catch ( Exception $ e ) { return self :: makeZipArchiver ( $ file , $ zipArchive , false ) ; } }
Open Zip archive
4,147
public static function getResponder ( Request $ request ) { if ( $ request instanceof HttpRequest ) { return self :: getHttpResponder ( $ request ) ; } else { $ requestType = get_class ( $ request ) ; throw new \ InvalidArgumentException ( "Requests of type '{$requestType}' are not supported." ) ; } }
Returns a responder that can deal with the specified request .
4,148
public static function getErrorResponder ( Request $ request , \ Exception $ exception ) { if ( $ request instanceof HttpRequest ) { return self :: getHttpErrorResponder ( $ exception , $ request ) ; } else { $ requestType = get_class ( $ request ) ; throw new \ InvalidArgumentException ( "Requests of type '{$requestTy...
Returns a responder that produces a response that informs about an error condition .
4,149
private static function getHttpResponder ( HttpRequest $ request ) { $ responder = null ; $ responderClassName = $ request -> getResponderClassName ( ) ; if ( class_exists ( $ responderClassName ) ) { $ responder = new $ responderClassName ( $ request ) ; Logger :: get ( ) -> debug ( "Responder '$responderClassName' is...
Returns a responder that supports HTTP requests .
4,150
private static function getHttpErrorResponder ( \ Throwable $ throwable , HttpRequest $ request = null ) { $ responder = new \ Eix \ Core \ Responders \ Http \ Error ( $ request ) ; $ responder -> setThrowable ( $ throwable ) ; return $ responder ; }
Returns a responder that deals with failed HTTP requests .
4,151
public function track ( $ alias , $ field , Closure $ scope = null ) { $ this -> _counters [ $ alias ] = [ 'field' => $ field , 'scope' => $ scope ] ; return $ this ; }
Add a counter for a relation .
4,152
public function syncCounters ( $ ids ) { foreach ( $ this -> getCounters ( ) as $ alias => $ counter ) { $ relation = $ this -> getModel ( ) -> getRelation ( $ alias ) ; switch ( $ relation -> getType ( ) ) { case Relation :: MANY_TO_MANY : $ this -> _syncManyToMany ( $ relation , $ ids , $ counter ) ; break ; case Rel...
Sync the count fields in the related table . Loop over each counter and loop over each modified record ID . Determine the count while applying scope and update the relation record .
4,153
public function render ( ) { $ table = new TableWidget ( $ this -> input , $ this -> output ) ; $ table -> setTitle ( "<header>Global options:</header>" ) ; foreach ( $ this -> console -> getCommands ( ) as $ command ) { if ( $ command -> isGlobal ( ) ) { foreach ( $ command -> getOptions ( ) as $ option ) { $ name = $...
Render options .
4,154
private static function buildTag ( string $ name , ? string $ content = null , array $ attributes = [ ] , bool $ contentIsEncoded = false ) { $ result = '<' . htmlspecialchars ( $ name ) ; foreach ( $ attributes as $ attributeName => $ attributeValue ) { if ( $ attributeValue === null || $ attributeValue === false ) { ...
Builds a tag from a name and attributes array .
4,155
public static function getMessage ( int $ code , string $ format = null ) { $ fields = [ 'c' => $ code , 'm' => self :: $ messages [ $ code ] , ] ; return str_replace ( array_keys ( $ fields ) , $ fields , $ format ?? 'c m' ) ; }
Returns message for a HTTP status code
4,156
public static function addSubmenu ( $ extension ) { if ( $ extension == 'com_categories' ) { return ; } $ parts = explode ( '.' , $ extension ) ; $ component = $ parts [ 0 ] ; if ( count ( $ parts ) > 1 ) { $ section = $ parts [ 1 ] ; } $ eName = str_replace ( 'com_' , '' , $ component ) ; $ file = JPath :: clean ( JPA...
Configure the Submenu links .
4,157
public static function getActions ( $ extension , $ categoryId = 0 ) { JLog :: add ( __METHOD__ . '() is deprecated, use JHelperContent::getActions() with new arguments order instead.' , JLog :: WARNING , 'deprecated' ) ; return JHelperContent :: getActions ( $ extension , 'category' , $ categoryId ) ; }
Gets a list of the actions that can be performed .
4,158
public static function getAssociations ( $ pk , $ extension = 'com_content' ) { $ langAssociations = JLanguageAssociations :: getAssociations ( $ extension , '#__categories' , 'com_categories.item' , $ pk , 'id' , 'alias' , '' ) ; $ associations = array ( ) ; foreach ( $ langAssociations as $ langAssociation ) { $ asso...
Gets a list of associations for a given item .
4,159
public static function validateCategoryId ( $ catid , $ extension ) { JTable :: addIncludePath ( JPATH_ADMINISTRATOR . '/components/com_categories/tables' ) ; $ categoryTable = JTable :: getInstance ( 'Category' ) ; $ data = array ( ) ; $ data [ 'id' ] = $ catid ; $ data [ 'extension' ] = $ extension ; if ( ! $ categor...
Check if Category ID exists otherwise assign to ROOT category .
4,160
public static function createCategory ( $ data ) { JModelLegacy :: addIncludePath ( JPATH_ADMINISTRATOR . '/components/com_categories/models' ) ; JTable :: addIncludePath ( JPATH_ADMINISTRATOR . '/components/com_categories/tables' ) ; $ categoryModel = JModelLegacy :: getInstance ( 'Category' , 'CategoriesModel' , arra...
Create new Category from within item view .
4,161
public function execute ( $ url , $ queueOptions = array ( ) ) { $ queue = new ZendJobQueue ( ) ; $ queueOptions = array_merge ( array ( 'name' => get_class ( $ this ) ) , $ queueOptions ) ; $ id = $ queue -> createHttpJob ( $ url , array ( 'obj' => base64_encode ( serialize ( $ this ) ) ) , $ queueOptions ) ; return $...
Execute the task on the Zend Server Job Queue
4,162
public function run ( ) { foreach ( $ this -> commands as $ command ) { $ this -> consoleApp -> add ( $ command ) ; } $ this -> consoleApp -> run ( ) ; }
Run tiga console .
4,163
public function import ( array $ data ) { if ( count ( $ data ) !== 4 ) { throw new \ InvalidArgumentException ( "Invalid footprint array" ) ; } $ this -> _type = $ data [ 0 ] ; $ this -> _constants = $ data [ 1 ] ; $ this -> _interfaces = $ data [ 2 ] ; $ this -> _parent = $ data [ 3 ] ; return $ this ; }
Import from array
4,164
public static function saveAppRoutes ( $ app = null ) { $ app = empty ( $ app ) ? Yii :: $ app : $ app ; $ appKey = UniApplication :: appKey ( $ app ) ; if ( $ app -> cache instanceof Cache && isset ( static :: $ _routes [ $ appKey ] ) ) { $ app -> cache -> set ( $ appKey , static :: $ _routes [ $ appKey ] , static :: ...
Save all application s routes .
4,165
private function makeViews ( ) { foreach ( $ this -> views as $ view ) { new MakeView ( $ this , $ this -> files , $ view ) ; } $ this -> info ( 'Views created successfully.' ) ; $ this -> info ( 'Dump-autoload...' ) ; $ this -> composer -> dumpAutoloads ( ) ; $ this -> info ( 'Route::resource("' . $ this -> getObjName...
Setup views and assets
4,166
public function & __get ( $ name ) { if ( in_array ( $ name , [ 'container' , 'arguments' ] ) ) { $ method = 'get' . ucfirst ( $ name ) ; trigger_error ( "Property '$name' is deprecated, use method $method() instead." , E_USER_WARNING ) ; $ var = $ this -> $ method ( ) ; return $ var ; } trigger_error ( E_USER_WARNING ...
Back compatibility .
4,167
protected function registerExceptionHandler ( ) { $ previousHandler = null ; if ( $ this -> app -> bound ( ExceptionHandlerInterface :: class ) === true ) { $ previousHandler = $ this -> app -> make ( ExceptionHandlerInterface :: class ) ; } $ this -> app -> singleton ( ExceptionHandlerInterface :: class , function ( )...
Register exception handler .
4,168
protected function lang ( $ fileKey , $ changeLang = false ) : string { $ lang = ( ! $ changeLang ) ? $ this -> header ( 'lang' ) : $ changeLang ; $ search = explode ( '.' , $ fileKey ) ; $ file = $ search [ 0 ] . '.php' ; $ key = isset ( $ search [ 1 ] ) ? $ search [ 1 ] : '' ; $ route = $ this -> config ( 'paths.i18n...
Get lang key in file . key format .
4,169
protected function config ( string $ key ) { $ config = json_decode ( $ this -> header ( 'config' ) , true ) ; $ definition = explode ( '.' , $ key ) ; $ item = isset ( $ config [ $ definition [ 0 ] ] ) ? $ config [ $ definition [ 0 ] ] : null ; $ numberOfDefinitions = count ( $ definition ) ; for ( $ i = 1 ; $ i < $ n...
Get config item .
4,170
protected function view ( string $ template , array $ data = [ ] ) : string { if ( ! $ this -> mustacheInstance ) { $ viewsRoute = $ this -> config ( 'paths.view' ) ; $ options = [ 'extension' => '.hbs' ] ; $ this -> mustacheInstance = new Mustache_Engine ( array ( 'loader' => new Mustache_Loader_FilesystemLoader ( $ v...
Get view .
4,171
private function mapData ( array $ data ) : array { $ assets = [ 'js' => false , 'css' => false , ] ; $ assets_path = $ this -> config ( 'paths.assets_manifest' ) ; if ( file_exists ( $ assets_path ) ) { $ assets_data = json_decode ( file_get_contents ( $ assets_path ) , true ) ; $ assets = [ 'js' => $ assets_data [ '/...
Map data to output .
4,172
protected function arrayDot ( $ array , $ prepend = '' ) { $ results = array ( ) ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ results = array_merge ( $ results , $ this -> arrayDot ( $ value , $ prepend . $ key . '.' ) ) ; } else { $ results [ $ prepend . $ key ] = $ value ; } } return $ ...
Build an array dot notation
4,173
public static function buildMessage ( ResultException $ result ) { $ translateKey = self :: TRANSLATE_KEY_PREFIX . $ result -> globalCode ; $ message = self :: translate ( $ translateKey ) ; return empty ( $ message ) ? $ result -> getAlias ( ) : $ message ; }
Try to translate message using translator otherwise returns alias or constant name
4,174
protected function executeCommand ( CommandInterface $ command ) { try { return $ command -> execute ( ) ; } catch ( ServerErrorResponseException $ ex ) { throw new ApiException ( $ ex -> getResponse ( ) -> getBody ( true ) , $ ex -> getResponse ( ) -> getStatusCode ( ) , $ ex ) ; } catch ( ClientErrorResponseException...
Execute the command in server
4,175
public function register ( $ username , $ email , $ new_password , $ repeat_new_password , $ client_id , $ ip , $ country , $ city , $ language = null , $ facebookId = null , $ enabled = false ) { if ( ! is_string ( $ username ) || 0 >= strlen ( $ username ) ) { throw new InvalidArgumentException ( "username must be a ...
Register new user at server
4,176
public function showChannels ( $ limit = null , $ offset = null , array $ filter = null , array $ order = null ) { if ( $ limit != null && $ limit < 1 ) { throw new InvalidArgumentException ( "Api::showChannels() limit must be a min 1 " ) ; } if ( $ offset != null && $ offset < 0 ) { throw new InvalidArgumentException ...
List all channels register in Server
4,177
public function incrementChannelVisits ( $ channel_id ) { if ( ! is_numeric ( $ channel_id ) || 0 >= $ channel_id ) { throw new InvalidArgumentException ( "ApiException::incrementChannelVisits channel_id field should be positive integer" ) ; } $ command = $ this -> client -> getCommand ( 'IncrementChannelVisits' , arra...
Increment visits of a channel
4,178
public function findBySlug ( $ slug ) { $ command = $ this -> client -> getCommand ( 'FindBySlug' , array ( 'slug' => $ slug ) ) ; return $ this -> executeCommand ( $ command ) ; }
Get channel . Show data channel by slug
4,179
public function showChannel ( $ channel_id ) { $ command = $ this -> client -> getCommand ( 'GetChannel' , array ( 'id' => $ channel_id ) ) ; return $ this -> executeCommand ( $ command ) ; }
Get channel . Show data channel by id
4,180
public function showChannelsTypes ( $ limit = null , $ offset = null ) { if ( $ limit != null && $ limit < 1 ) { throw new InvalidArgumentException ( "Api::showChannelsTypes() limit must be a min 1 " ) ; } if ( $ offset != null && $ offset < 0 ) { throw new InvalidArgumentException ( "Api::showChannelsTypes() $offset m...
Get Channles types
4,181
public function showUserChannelsFan ( $ user_id , $ limit = null , $ offset = null ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "ApiException::showUserChannelsFan user_id field should be positive integer" ) ; } if ( $ limit != null && $ limit < 1 ) { throw new InvalidAr...
Show channels favorites one user
4,182
public function addUserChannelFan ( $ channel_id , $ user_id ) { if ( ! is_numeric ( $ channel_id ) || 0 >= $ channel_id ) { throw new InvalidArgumentException ( "ApiException::addUserChannelFan channel_id field should be positive integer" ) ; } if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArg...
Make channel s fan one user
4,183
public function addFriends ( $ user_id , $ friend_id ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::addFriends user_id field should be positive integer" ) ; } if ( ! is_numeric ( $ friend_id ) || 0 >= $ friend_id ) { throw new InvalidArgumentException ( "Api::addFri...
Sends a friendship request between two users
4,184
public function addFriendshipRequest ( $ user_id , $ user_accept_id ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::addFriendshipRequest user_id field should be positive integer" ) ; } if ( ! is_numeric ( $ user_accept_id ) || 0 >= $ user_accept_id ) { throw new Inva...
Accept request new Friend
4,185
public function delFriendshipRequest ( $ user_id , $ user_decline_id ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::addFriendshipRequest user_id field should be positive integer" ) ; } if ( ! is_numeric ( $ user_decline_id ) || 0 >= $ user_decline_id ) { throw new I...
Decline a friendship request
4,186
public function delFriend ( $ user_id , $ user_delete_id ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "delFriend user_id field should be positive integer" ) ; } if ( ! is_numeric ( $ user_delete_id ) || 0 >= $ user_delete_id ) { throw new InvalidArgumentException ( "del...
Delete friends between two users
4,187
public function updateMe ( $ email , $ current_password ) { if ( ! is_string ( $ email ) || 0 >= strlen ( $ email ) ) { throw new InvalidArgumentException ( "ApiException::updateProfile email field needs to be a non-empty string" ) ; } if ( ! is_string ( $ current_password ) || 0 >= strlen ( $ current_password ) ) { th...
Update a profile of me user
4,188
public function showPhotoAlbum ( $ album_id , $ limit = null , $ offset = null ) { if ( ! is_numeric ( $ album_id ) || 0 >= $ album_id ) { throw new InvalidArgumentException ( "Api::showPhotoAlbum album_id field should be positive integer" ) ; } if ( $ limit != null && $ limit < 1 ) { throw new InvalidArgumentException...
List all photos of an album
4,189
public function addReportPhoto ( $ photo_id , $ reason ) { if ( ! is_numeric ( $ photo_id ) || 0 >= $ photo_id ) { throw new InvalidArgumentException ( "Api::addReportPhoto photo_id field should be positive integer" ) ; } if ( ! is_string ( $ reason ) || 0 >= strlen ( $ reason ) ) { throw new InvalidArgumentException (...
Report a photo
4,190
public function delPhoto ( $ photo_id ) { if ( ! is_numeric ( $ photo_id ) || 0 >= $ photo_id ) { throw new InvalidArgumentException ( "Api::delPhoto photo_id field should be positive integer" ) ; } $ command = $ this -> client -> getCommand ( 'DeletePhoto' , array ( 'photo_id' => $ photo_id ) ) ; return $ this -> exec...
Delete a Photo
4,191
public function reportPhoto ( $ photo_id , $ reason ) { if ( ! is_numeric ( $ photo_id ) || 0 >= $ photo_id ) { throw new InvalidArgumentException ( "Api::reportPhoto photo_id field should be positive integer" ) ; } if ( trim ( $ reason ) == '' ) { throw new InvalidArgumentException ( "Api::reportPhoto reason field sho...
Report a Photo
4,192
public function addAlbum ( $ user_id , $ title , $ description = '' ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::addAlbum user_id field should be positive integer" ) ; } if ( ! is_string ( $ title ) || 0 >= strlen ( $ title ) ) { throw new InvalidArgumentException...
Add new Photo Album in user accont
4,193
public function addPhoto ( $ user_id , $ imageFile , $ imageTile = '' ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::addPhoto user_id field should be positive integer" ) ; } if ( ! is_string ( $ imageTile ) || 0 >= strlen ( $ imageTile ) ) { throw new InvalidArgumen...
upload new photo at server api
4,194
public function addPhotoVote ( $ user_id , $ photo_id , $ score = 1 ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::addPhotoVote user_id field should be positive integer" ) ; } if ( ! is_numeric ( $ photo_id ) || 0 >= $ photo_id ) { throw new InvalidArgumentException...
Add one vote at photo
4,195
public function delPhotoVote ( $ user_id , $ photo_id ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::delPhotoVote user_id field should be positive integer" ) ; } if ( ! is_numeric ( $ photo_id ) || 0 >= $ photo_id ) { throw new InvalidArgumentException ( "Api::delPh...
Delete one vote of one photo
4,196
public function showAlbum ( $ user_id , $ album_id ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::showUserAlbum user_id field should be positive integer" ) ; } if ( ! is_numeric ( $ album_id ) || 0 >= $ album_id ) { throw new InvalidArgumentException ( "Api::showUse...
Show one album of user
4,197
public function addAlbumPhoto ( $ user_id , $ photo_id , $ album_id ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::addAlbumPhoto user_id field should be positive integer" ) ; } if ( ! is_numeric ( $ photo_id ) || 0 >= $ photo_id ) { throw new InvalidArgumentExceptio...
Insert a photo entity into album id
4,198
public function showReport ( $ report_id ) { if ( ! is_numeric ( $ report_id ) || 0 >= $ report_id ) { throw new InvalidArgumentException ( "Api::showReport report_id field should be positive integer" ) ; } $ command = $ this -> client -> getCommand ( 'ShowReport' , array ( 'id' => $ report_id ) ) ; return $ this -> ex...
Shows the details of a report
4,199
public function addThread ( $ user_id , $ recipient_name , $ subject , $ body ) { if ( ! is_numeric ( $ user_id ) || 0 >= $ user_id ) { throw new InvalidArgumentException ( "Api::addThread user_id field should be positive integer" ) ; } if ( ! is_string ( $ recipient_name ) || 0 >= strlen ( $ recipient_name ) ) { throw...
Create new thread