idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
54,200 | public function validateapiAction ( ) { $ request = $ this -> getRequest ( ) ; $ configMap = Mage :: getModel ( 'radial_core/config' ) ; $ hostname = $ this -> _validatorHelper -> getParamOrFallbackValue ( $ request , self :: HOSTNAME_PARAM , self :: HOSTNAME_USE_DEFAULT_PARAM , $ configMap -> getPathForKey ( 'api_host... | Validate the API configuration by making a test address validation request and ensuring the response that is returned is valid . |
54,201 | public function validatesftpAction ( ) { $ request = $ this -> getRequest ( ) ; $ configMap = Mage :: getModel ( 'radial_core/config' ) ; $ host = $ this -> _validatorHelper -> getParamOrFallbackValue ( $ request , self :: SFTP_HOSTNAME_PARAM , self :: SFTP_HOSTNAME_USE_DEFAULT_PARAM , $ configMap -> getPathForKey ( 's... | Validate the SFTP configurations and set the response body to a JSON response including the success of the test connection and any messages to be displayed to the user . |
54,202 | private function registerOAuthServer ( ) { $ this -> app -> bind ( 'League\OAuth2\Server\Storage\ClientInterface' , 'Sule\Api\OAuth2\Repositories\FluentClient' ) ; $ this -> app -> bind ( 'League\OAuth2\Server\Storage\ScopeInterface' , 'Sule\Api\OAuth2\Repositories\FluentScope' ) ; $ this -> app -> bind ( 'League\OAuth... | Register the OAuth server . |
54,203 | public function registerApi ( ) { $ this -> app [ 'api' ] = $ this -> app -> share ( function ( $ app ) { $ config = $ app [ 'config' ] -> get ( 'sule/api::config' ) ; $ config [ 'oauth2' ] = $ app [ 'config' ] -> get ( 'sule/api::oauth2' ) ; return new Api ( $ config , $ app [ 'request' ] , new Response ( ) , $ app [ ... | Register the Api . |
54,204 | private function createPhpProcessBuilder ( OutputInterface $ output , $ address ) { $ router = realpath ( __DIR__ . '/../../Resources/bin/router.php' ) ; $ finder = new PhpExecutableFinder ( ) ; if ( false === $ binary = $ finder -> find ( ) ) { $ output -> writeln ( '<error>Unable to find PHP binary to run server</err... | Get a ProcessBuilder instance |
54,205 | protected function isOtherServerProcessRunning ( $ address ) { if ( file_exists ( sys_get_temp_dir ( ) . '/' . strtr ( $ address , '.:' , '--' ) . '.pid' ) ) { return true ; } list ( $ hostname , $ port ) = explode ( ':' , $ address ) ; if ( false !== $ fp = @ fsockopen ( $ hostname , $ port , $ errno , $ errstr , 5 ) ... | Is another service already using the given address? |
54,206 | protected function getCredentials ( ) { $ credentialArgs = [ '--host=%s --port=%s --user=%s --password=%s %s' , escapeshellarg ( $ this -> config [ 'host' ] ) , escapeshellarg ( $ this -> config [ 'port' ] ) , escapeshellarg ( $ this -> config [ 'user' ] ) , escapeshellarg ( $ this -> config [ 'pass' ] ) , escapeshella... | Get the credential options for the command . |
54,207 | protected function getTables ( ) { if ( empty ( $ this -> config [ 'tables' ] ) ) { return '' ; } $ tables = [ ] ; $ allTables = array_diff ( $ this -> config [ 'tables' ] , $ this -> config [ 'structureTables' ] ) ; foreach ( $ allTables as $ table ) { $ tables [ ] = escapeshellarg ( $ table ) ; } return implode ( $ t... | Get the table arguments for the command . |
54,208 | protected function getOptions ( ) { $ options = [ '--routines' , ] ; if ( $ this -> config [ 'dataOnly' ] ) { $ options [ ] = '--no-create-info' ; } if ( $ this -> config [ 'orderedDump' ] ) { $ options [ ] = '--skip-extended-insert' ; $ options [ ] = '--order-by-primary' ; } if ( $ this -> config [ 'singleTransaction'... | Get the command options for the command . |
54,209 | protected function getIgnore ( ) { if ( ! empty ( $ this -> config [ 'tables' ] ) ) { return '' ; } $ ignoreTables = array_merge ( $ this -> config [ 'structureTables' ] , $ this -> config [ 'ignoreTables' ] ) ; $ ignoreArgs = [ ] ; foreach ( $ ignoreTables as $ table ) { $ ignoreArgs [ ] = escapeshellarg ( $ this -> c... | Get the ignore table options for the command . |
54,210 | protected function getStructureTables ( ) { if ( empty ( $ this -> config [ 'structureTables' ] ) ) { return '' ; } $ structureTables = [ ] ; foreach ( $ this -> config [ 'structureTables' ] as $ table ) { $ structureTables [ ] = escapeshellarg ( $ table ) ; } return implode ( ' ' , $ structureTables ) ; } | Get the structure tables for the command . |
54,211 | public function load ( ICategory $ category ) { $ this -> template -> set ( 'title' , $ category -> getTitle ( ) ) ; $ this -> template -> set ( 'meta_title' , $ category -> metaTitle ( ) ) ; $ this -> template -> set ( 'meta_keywords' , $ category -> metaKeywords ( ) ) ; $ this -> template -> set ( 'meta_description' ... | Load category data to the template . |
54,212 | public function addEmbed ( EmbeddedPropMetadata $ embed ) { $ this -> validateEmbed ( $ embed ) ; $ this -> embeds [ $ embed -> getKey ( ) ] = $ embed ; ksort ( $ this -> embeds ) ; return $ this ; } | Adds an embed field . |
54,213 | public function getEmbed ( $ key ) { if ( ! isset ( $ this -> embeds [ $ key ] ) ) { return null ; } return $ this -> embeds [ $ key ] ; } | Gets an embed field . Returns null if the embed does not exist . |
54,214 | private function getResourcesSection ( ) { $ builder = new TreeBuilder ( ) ; $ node = $ builder -> root ( 'resources' ) ; $ node -> useAttributeAsKey ( 'prefix' ) -> prototype ( 'array' ) -> useAttributeAsKey ( 'name' ) -> prototype ( 'array' ) -> children ( ) -> variableNode ( 'templates' ) -> end ( ) -> scalarNode ( ... | Returns the resources configuration definition . |
54,215 | private function getMenusSection ( ) { $ builder = new TreeBuilder ( ) ; $ node = $ builder -> root ( 'menus' ) ; $ node -> useAttributeAsKey ( 'name' ) -> prototype ( 'array' ) -> children ( ) -> scalarNode ( 'label' ) -> isRequired ( ) -> cannotBeEmpty ( ) -> end ( ) -> scalarNode ( 'icon' ) -> isRequired ( ) -> cann... | Returns the menu configuration definition . |
54,216 | private function getDashboardSection ( ) { $ builder = new TreeBuilder ( ) ; $ node = $ builder -> root ( 'dashboard' ) ; $ node -> useAttributeAsKey ( 'name' ) -> prototype ( 'array' ) -> children ( ) -> scalarNode ( 'type' ) -> isRequired ( ) -> cannotBeEmpty ( ) -> end ( ) -> arrayNode ( 'options' ) -> useAttributeA... | Returns the dashboard configuration definition . |
54,217 | public function rest_api_init ( ) { $ args = [ ] ; foreach ( [ 'GET' , 'POST' , 'PUT' , 'DELETE' , 'PATCH' , 'OPTIONS' , 'HEAD' ] as $ http_method ) { $ method_name = 'handle_' . strtolower ( $ http_method ) ; if ( method_exists ( $ this , $ method_name ) ) { $ arg = [ 'methods' => $ http_method , 'callback' => [ $ thi... | Register rest route . |
54,218 | public function createNewEmbed ( ) { $ embed = $ this -> store -> loadEmbed ( $ this -> getMetadata ( ) , [ ] ) ; $ embed -> getState ( ) -> setNew ( ) ; return $ embed ; } | Creates a new Embed model instance based on the collection |
54,219 | public function getHash ( ) { $ hash = [ ] ; foreach ( $ this as $ embed ) { $ hash [ ] = $ embed -> getHash ( ) ; } sort ( $ hash ) ; return md5 ( serialize ( $ hash ) ) ; } | Gets the unique hash for this collection . |
54,220 | public static function make ( array $ options = [ ] , $ driver = null ) { $ class = null ; if ( ! $ driver && isset ( $ options [ 'driver' ] ) ) { $ driver = $ options [ 'driver' ] ; unset ( $ options [ 'driver' ] ) ; } if ( isset ( self :: $ driverMap [ $ driver ] ) ) { $ class = self :: $ driverMap [ $ driver ] ; } e... | Lock constructor . |
54,221 | public function post ( $ params = null , $ url = null , $ contenttype = 'application/x-www-form-urlencoded' , $ user = null , $ password = null , $ raw = false ) { return $ this -> request ( $ params , $ url , 'POST' , $ contenttype , $ user , $ password , $ raw ) ; } | Convenience method wrapping a commom POST call |
54,222 | public static function initResult ( $ res ) { if ( ! is_array ( $ res ) ) throw new Exception ( 'Invalid datatype. Array expected!' ) ; elseif ( isset ( $ res [ 'error' ] ) ) throw new Exception ( 'Server error: ' . $ res [ 'error' ] ) ; elseif ( ! isset ( $ res [ 'result' ] ) ) throw new Exception ( 'Server returned n... | Initializes and checks a server result |
54,223 | public static function getArrayItemByPointSeparatedKey ( array & $ aData , $ sKey ) { if ( strpos ( $ sKey , '.' ) !== false ) { preg_match ( '/([a-zA-Z0-9_\-]+)\.([a-zA-Z0-9_\-\.]+)/' , $ sKey , $ aKey ) ; if ( ! isset ( $ aData [ $ aKey [ 1 ] ] ) ) { throw new Exception ( 'Undefined index: ' . $ aKey [ 1 ] ) ; } if (... | The method returns a tree element by a key which is formed as a string separated by points and reflecting the nesting hierarchy . |
54,224 | public function addRule ( $ sName , $ funcCall , $ mErrorMsg = null ) { if ( is_callable ( $ funcCall ) ) { $ this -> rules [ $ sName ] = array ( $ funcCall , $ mErrorMsg ) ; } else { throw new Exception ( "Rule isn't callable." ) ; } return $ this ; } | The method adds a validation rule to the stack of validator rulesets . |
54,225 | private function applyRuleToField ( $ sFieldName , $ sRuleName , array $ aOpt = array ( ) ) { if ( ! isset ( $ this -> rules [ $ sRuleName ] ) ) { throw new Exception ( 'Undefined rule name.' ) ; } $ funcCall = $ this -> rules [ $ sRuleName ] [ 0 ] ; if ( ! $ funcCall ( $ sFieldName , $ aOpt ) ) { if ( isset ( $ this -... | The method applies the validation rule to the validable field . |
54,226 | public function run ( ) { if ( ! $ this -> isRan ) { $ this -> isRan = true ; foreach ( $ this -> items as $ aItem ) { $ mOpt = isset ( $ aItem [ 2 ] ) ? $ aItem [ 2 ] : array ( ) ; $ sRuleName = $ aItem [ 1 ] ; foreach ( is_array ( $ aItem [ 0 ] ) ? $ aItem [ 0 ] : array ( $ aItem [ 0 ] ) as $ sFieldName ) { self :: a... | The main executable method . |
54,227 | protected function showErrorAndDie ( \ Exception $ e ) { $ this -> error ( 'And error occurs connecting to the api url: ' . $ this -> url ) ; if ( $ e -> getResponse ( ) ) { $ this -> error ( 'Status code: ' . $ e -> getResponse ( ) -> getStatusCode ( ) . ' | Reason : ' . $ e -> getResponse ( ) -> getReasonPhrase ( ) )... | Show error and die . |
54,228 | protected function processOptions ( array $ options ) { foreach ( $ options as $ name => $ value ) { if ( is_callable ( $ value ) ) { $ options [ $ name ] = call_user_func ( $ value , $ this -> data , $ options ) ; } elseif ( is_object ( $ value ) && ! method_exists ( $ value , '__toString' ) ) { throw new \ InvalidArg... | processes the passed options based on the data set for the column |
54,229 | public function getResourceRepository ( ) { if ( $ this -> resourceRepository === null ) { $ this -> resourceRepository = $ this -> getPuliFactory ( ) -> createRepository ( ) ; } return $ this -> resourceRepository ; } | Returns an instance to the puli repository |
54,230 | public function getResourceDiscovery ( ) { if ( $ this -> resourceDiscovery === null ) { $ repo = $ this -> getResourceRepository ( ) ; $ this -> resourceDiscovery = $ this -> getPuliFactory ( ) -> createDiscovery ( $ repo ) ; } return $ this -> resourceDiscovery ; } | Returns an instance to the puli discovery |
54,231 | public function getUrlGenerator ( ) { if ( $ this -> urlGenerator === null ) { $ discovery = $ this -> getResourceDiscovery ( ) ; $ this -> urlGenerator = $ this -> getPuliFactory ( ) -> createUrlGenerator ( $ discovery ) ; } return $ this -> urlGenerator ; } | Returns the url generator for puli resources |
54,232 | public function generateProxyClass ( $ entity , $ config ) { if ( ! is_array ( $ config ) && ! $ config instanceof \ ArrayAccess ) { throw new Exception \ InvalidArgumentException ( 'Invalid proxy class configuration; array or instance of ArrayAccess expected' ) ; } if ( ! is_object ( $ entity ) ) { if ( ( is_string ( ... | Generate proxy class for entity |
54,233 | public function getProxyClassName ( $ className ) { $ suffix = ltrim ( $ className , '\\' ) ; if ( $ this -> proxyClassSuffix !== null ) { $ suffix .= $ this -> proxyClassSuffix ; } return rtrim ( $ this -> proxyNamespace , '\\' ) . '\\' . self :: MARKER . '\\' . $ suffix ; } | Get proxy class name for service class name |
54,234 | public function getProxyFilename ( $ className ) { $ baseDirectory = $ this -> proxyDirectory ; $ suffix = str_replace ( '\\' , '' , $ className ) ; if ( $ this -> proxyClassSuffix !== null ) { $ suffix .= $ this -> proxyClassSuffix ; } return rtrim ( $ baseDirectory , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR . self... | Get proxy class filename for service class name |
54,235 | public function createProxyClassInstance ( $ service ) { $ file = $ this -> getProxyFilename ( get_class ( $ service ) ) ; if ( file_exists ( $ file ) ) { require_once $ file ; } else { throw new Exception \ RuntimeException ( sprintf ( 'Proxy class for service "%s" has not been initialized' , get_class ( $ service ) )... | Create a new instance of the proxy class |
54,236 | public function getProxyNamespace ( $ className ) { $ proxyClassName = $ this -> getProxyClassName ( $ className ) ; $ parts = explode ( '\\' , strrev ( $ proxyClassName ) , 2 ) ; return strrev ( $ parts [ 1 ] ) ; } | Get proxy namespace for service class name |
54,237 | protected function generateMethods ( ReflectionClass $ reflectionClass ) { $ methods = array ( ) ; $ methods [ ] = $ this -> generateConstructor ( $ reflectionClass ) ; $ methods [ ] = $ this -> generateInvoker ( $ reflectionClass ) ; $ methods [ ] = $ this -> generateOperationNotFound ( $ reflectionClass ) ; $ methods... | Generate methods for ClassGenerator |
54,238 | protected function getOperationConfig ( $ name , $ param = null , $ default = null ) { $ config = isset ( $ this -> serviceConfig [ 'operations' ] [ $ name ] ) ? $ this -> serviceConfig [ 'operations' ] [ $ name ] : null ; if ( $ param === null || $ config === null ) { return $ config ; } else { return isset ( $ config... | Get configurations for named operation |
54,239 | protected function generateTriggerEventCode ( $ operationName , $ params , $ type , $ paramsExist = false ) { $ config = $ this -> getOperationConfig ( $ operationName , 'events' , array ( ) ) ; $ code = '' ; $ serviceId = strtolower ( $ this -> serviceConfig [ 'service_id' ] ) ; $ responseInjected = false ; if ( ! emp... | Generate event trigger code |
54,240 | public function onClientHandlerMessage ( ClientHandlerJobRequest $ msg ) { $ request = new Request ( $ msg -> getRequestId ( ) , $ msg -> getActionName ( ) , $ msg -> getParameters ( ) ) ; $ this -> addRequest ( $ request ) ; $ this -> getStream ( 'clientHandler' ) -> send ( new ClientHandlerJobResponse ( $ msg -> getR... | Handles a request from the ClientHandler . |
54,241 | protected function handleWorkerInit ( Worker $ worker , Register $ msg ) { $ actionCount = intval ( count ( $ msg -> getActions ( ) ) ) ; if ( $ actionCount <= 0 ) { $ this -> getLogger ( ) -> error ( 'Invalid init, invalid action count.' ) ; return ; } foreach ( $ msg -> getActions ( ) as $ actionName ) { $ worker -> ... | Handles an init message from the worker . |
54,242 | protected function handleGetJobRequest ( Worker $ worker ) { $ this -> getLogger ( ) -> debug ( 'Worker ' . $ worker -> getHexId ( ) . ' is requesting a Job.' ) ; if ( ! $ worker -> isValid ( ) ) { return ; } $ actions = $ worker -> getActionList ( ) ; foreach ( $ actions as $ action ) { if ( isset ( $ this -> notAvail... | Sets the Worker object and its actions to be available again . |
54,243 | public function reply ( Worker $ worker , MessageInterface $ msg ) { if ( ! $ worker -> isReady ( ) ) { $ this -> getLogger ( ) -> debug ( 'Worker ' . $ worker -> getHexId ( ) . ' is not ready to receive data.' ) ; return ; } $ worker -> setReady ( false ) ; if ( ! $ worker -> isValid ( ) ) { $ this -> getLogger ( ) ->... | Send a reply to the Worker . |
54,244 | public function sendRequest ( Worker $ worker , Request $ request ) { $ worker -> setRequest ( $ request ) ; $ this -> reply ( $ worker , new ExecuteJobRequest ( $ request -> getId ( ) , $ request -> getActionName ( ) , $ request -> getParams ( ) ) ) ; } | Sends the request to the worker . |
54,245 | public function getWorker ( $ id ) { if ( ! isset ( $ this -> workers [ $ id ] ) ) { $ this -> workers [ $ id ] = new Worker ( $ id ) ; } return $ this -> workers [ $ id ] ; } | Retrieves the worker by id if it is not available a new one will be created . |
54,246 | public function getActionName ( $ name ) { if ( ! isset ( $ this -> actionList [ $ name ] ) ) { $ this -> actionList [ $ name ] = new Action ( $ name ) ; } return $ this -> actionList [ $ name ] ; } | Gets a action by name . If it does not exist it is created . |
54,247 | public function notifyActions ( Worker $ worker ) { $ actionList = $ worker -> getActionList ( ) ; foreach ( $ actionList as $ actionName ) { $ action = $ this -> getActionName ( $ actionName ) ; if ( $ worker -> isReady ( ) ) { $ action -> addWaitingWorker ( $ worker ) ; } elseif ( ! $ worker -> isValid ( ) ) { $ acti... | Notify actions that the worker state is changed . If the worker is valid it will be added to the actions . If it is invalid it will be removed . |
54,248 | protected function handleRequests ( ) { $ actions = array_keys ( $ this -> clientRequests ) ; foreach ( $ actions as $ actionName ) { $ this -> dispatchRequestsForAction ( $ actionName ) ; } } | Searches the requestQueue for new jobs . |
54,249 | public function storeResult ( $ worker , $ requestId , $ result ) { $ request = $ worker -> getRequest ( ) ; if ( $ request === null ) { return ; } if ( $ request -> getId ( ) != $ requestId ) { $ this -> getLogger ( ) -> error ( 'RequestId mismatch (' . $ requestId . ' => ' . $ request -> getId ( ) . ').' ) ; return ;... | Store a result in the Storage |
54,250 | public function handle ( ) { $ this -> getStream ( 'clientHandler' ) -> handle ( new TimeoutTimer ( AlphaRPC :: WORKER_HANDLER_TIMEOUT / 3 ) ) ; $ this -> getStream ( 'worker' ) -> handle ( new TimeoutTimer ( AlphaRPC :: WORKER_HANDLER_TIMEOUT / 3 ) ) ; $ this -> purgeWorkers ( ) ; $ this -> handleRequests ( ) ; $ this... | Perform one round of the loop . |
54,251 | public function notify ( $ requestId = null ) { $ this -> getStream ( 'status' ) -> send ( new WorkerHandlerStatus ( $ this -> getId ( ) , $ requestId ) ) ; } | Send a message to notify the client handlers that the workerhandler is still alive . |
54,252 | public static function concat_pdf ( $ path_array , $ target_file_name , $ multiple = false ) { $ cmd = 'pdftk ' ; $ cmd_files = '' ; $ unique = array ( ) ; try { if ( empty ( $ path_array ) ) { throw new FileException ( ( string ) "\$path_array was empty" , ( int ) Config :: get ( 'file_error' ) , ( int ) Config :: get... | Concats multiple pdfs together using the shell program pdftk |
54,253 | protected function stopMaster ( $ pid , $ quit = true ) { $ this -> stdout ( "Stop the manager(PID:$pid)" ) ; ProcessUtil :: killAndWait ( $ pid , SIGTERM , 'manager' ) ; $ this -> stdout ( sprintf ( "\n%s\n" ) , Cli :: color ( 'The manager process stopped' , Cli :: FG_GREEN ) ) ; if ( $ quit ) { $ this -> quit ( ) ; }... | Do shutdown Manager |
54,254 | protected function stopWorkers ( $ signal = SIGTERM ) { if ( ! $ this -> workers ) { $ this -> log ( 'No child process(worker) need to stop' , ProcessLogger :: PROC_INFO ) ; return false ; } return ProcessUtil :: stopChildren ( $ this -> workers , $ signal , [ 'beforeStops' => function ( $ sigText ) { $ this -> log ( "... | Stops all running workers |
54,255 | public function addGoogleAnalytics ( $ boot = false , $ user = '' ) { $ this -> google [ 'boot' ] = $ boot ; $ this -> google [ 'user' ] = $ user ; } | Add google analytics |
54,256 | public function init ( ) { foreach ( $ this -> soilFunc as $ key => $ value ) { if ( is_bool ( $ value ) && $ value === true ) { add_theme_support ( $ key ) ; } } $ google = $ this -> google ; if ( is_bool ( $ google [ 'boot' ] ) && $ google [ 'boot' ] === true ) { add_theme_support ( 'soil-google-analytics' , $ google... | Active soil thme supports . |
54,257 | public static function send ( $ address , $ subject , $ body , $ account = 'default' ) { $ HTML = true ; $ accounts = \ Phramework \ Phramework :: getSetting ( 'email' ) ; if ( ! $ accounts || ! isset ( $ accounts [ 'default' ] ) ) { throw new \ Exception ( 'email setting is required' ) ; } if ( ! isset ( $ accounts [ ... | Send an e - mail |
54,258 | public function apply ( $ testable , array $ config = array ( ) ) { $ lines = $ testable -> lines ( ) ; $ tokens = $ testable -> tokens ( ) ; $ lastBlankLineId = - 2 ; foreach ( $ lines as $ lineId => $ line ) { $ lineNumber = $ lineId + 1 ; $ ignore = false ; $ key = $ testable -> findTokenByLine ( $ lineNumber ) ; if... | Will iterate over each line checking for blank lines |
54,259 | public function getData ( $ field = null ) { if ( empty ( $ field ) ) { return $ this -> data ; } if ( ! empty ( $ this -> data ) && array_key_exists ( $ field , $ this -> data ) ) { return $ this -> data [ $ field ] ; } return null ; } | Retrieve a data element that was validated . |
54,260 | public static function call ( $ state , $ params = array ( ) ) { $ results = array ( ) ; if ( isset ( self :: $ hook [ $ state ] ) ) { $ return = true ; foreach ( self :: $ hook [ $ state ] as $ f ) { if ( is_callable ( $ f ) ) { $ results [ ] = call_user_func ( $ f , array_merge ( array ( 'state' => $ state , 'timesta... | call no yield |
54,261 | public function getOptionsAction ( Request $ request , TranslatorInterface $ translator ) { $ entityAlias = $ request -> request -> get ( 'entity_alias' ) ; $ parentId = $ request -> request -> get ( 'parent_id' ) ; $ emptyValue = $ request -> request -> get ( 'empty_value' ) ; $ entities = $ this -> getParameter ( 'an... | This action handler the ajax call for a dependent field type . |
54,262 | public function send ( $ endpoint , $ options = [ ] , $ body = '' ) { return $ this -> client -> post ( $ endpoint . '?' . http_build_query ( $ options ) , [ 'body' => $ body , ] ) ; } | Send request to Endomondo old api . |
54,263 | public function requestAuthToken ( $ email , $ password ) { return $ this -> send ( self :: URL_AUTH , [ 'email' => $ email , 'password' => $ password , 'country' => 'EN' , 'deviceId' => Uuid :: uuid5 ( Uuid :: NAMESPACE_DNS , gethostname ( ) ) -> toString ( ) , 'action' => 'PAIR' , ] ) ; } | Request auth token from Endomondo . |
54,264 | public function getShortUrl ( $ url ) { $ postData = [ 'longUrl' => $ url ] ; $ jsonData = json_encode ( $ postData ) ; $ token = $ this -> getToken ( ) ; $ url = $ this -> getUrl ( ) ; if ( true === empty ( $ token ) ) { throw new \ LogicException ( "Missing pm_tool.google_link_shortener.token" ) ; } if ( true === emp... | Get Short URL |
54,265 | public function write ( string $ key , $ data , int $ ttl = 0 ) : bool { $ ttl = ( ( int ) $ ttl <= 0 ) ? 0 : ( ( int ) $ ttl + time ( ) ) ; $ file = $ this -> cacheFile ( $ key ) ; $ data = var_export ( [ 'ttl' => $ ttl , 'data' => serialize ( $ data ) ] , true ) ; $ data = "<?php\n\rreturn " . preg_replace ( '/\s=>\s... | Write to cache |
54,266 | public function setInitValues ( array $ values ) { if ( isset ( $ this -> data [ 'isSend' ] ) == false || $ this -> data [ 'isSend' ] != true ) { foreach ( $ this -> elements as $ name => $ element ) { if ( $ element instanceof ElementInterface ) { if ( array_key_exists ( $ name , $ values ) ) { $ element -> setValue (... | Set default values to the form only when the form ist not posted |
54,267 | public function getMethods ( $ order = FALSE ) { if ( ! $ this -> methods || $ order !== FALSE ) { $ class = $ this -> getNamespace ( ) . '\Method' ; $ params [ 'where' ] [ ] = array ( 'module_id' , $ this -> get ( 'id' ) ) ; $ params [ 'orderby' ] = $ order ? : 'ABS(name)' ; $ this -> methods = $ class :: _getObjects ... | Return an array of module method objects |
54,268 | public function getMethod ( $ method ) { $ this -> getMethods ( ) ; foreach ( $ this -> methods as $ obj ) { if ( strtolower ( $ obj -> get ( 'name' ) ) == strtolower ( $ method ) ) { return $ obj ; } } return FALSE ; } | Return a module method if it exists |
54,269 | public function checkMethod ( $ method ) { $ method = strtolower ( $ method ) ; $ class = $ this -> getModuleClass ( ) ; $ this -> getMethods ( ) ; foreach ( $ this -> methods as $ obj ) { if ( strtolower ( $ obj -> get ( 'name' ) ) == $ method && method_exists ( $ class , $ method ) ) { return TRUE ; } } return FALSE ... | Check a module method if it exists |
54,270 | public function callMethod ( & $ api , $ module , $ method , $ args = array ( ) ) { $ class = $ this -> getModuleClass ( $ module ) ; $ obj = new $ class ; $ obj -> api = $ api ; if ( $ obj -> callInit ( $ this , $ method , $ args ) ) { $ return = call_user_func_array ( array ( $ obj , $ method ) , array ( $ args ) ) ;... | Call a module method |
54,271 | public function getModuleClass ( $ name = FALSE ) { if ( $ name === FALSE ) { $ name = $ this -> get ( 'name' ) ; } $ arr = explode ( '.' , $ name ) ; foreach ( $ arr as & $ val ) { $ val = ucfirst ( $ val ) ; } $ name = implode ( '\\' , $ arr ) ; return get_called_class ( ) . '\\' . $ name ; } | Return the class name of the module |
54,272 | public function isClosed ( ) : bool { if ( $ this -> isEmpty ( ) ) { return true ; } $ start = $ this -> getStartPoint ( ) ; $ end = $ this -> getEndPoint ( ) ; return $ start === $ end ; } | Indicates whether the Curve is closed . |
54,273 | public function getLength ( bool $ _3D = false ) : float { $ event = new MeasurementOpEvent ( $ this , [ '3D' => $ _3D ] ) ; $ this -> fireOperationEvent ( MeasurementOpEvent :: LENGTH_EVENT , $ event ) ; return $ event -> getResults ( ) ; } | Gets the length of this Curve in its associated spatial reference . |
54,274 | public function onBootstrap ( EventInterface $ e ) { if ( Console :: isConsole ( ) ) return false ; $ events = $ e -> getApplication ( ) -> getEventManager ( ) ; $ events -> attach ( new AdminRouteListener ( ) ) ; } | Listen to the bootstrap MvcEvent |
54,275 | public function getConfig ( ) { $ conf = [ ] ; foreach ( glob ( __DIR__ . '/../../config/*.config.php' ) as $ conFile ) { $ conFile = include_once $ conFile ; if ( is_array ( $ conFile ) ) $ conf = \ Poirot \ Core \ array_merge ( $ conf , $ conFile ) ; } return $ conf ; } | Returns configuration to merge with application configuration |
54,276 | public function createFromUpload ( $ filename = FALSE , $ newX = FALSE , $ newY = FALSE , $ method = self :: RESIZE_MAX , $ proportional = FALSE , $ replace = FALSE ) { if ( ! $ this -> path ) { new \ Sonic \ Message ( 'error' , 'No absolute path set!' ) ; return FALSE ; } if ( ! ( $ objImage = self :: _Load ( $ this -... | Load resize and save an image from an uploaded file |
54,277 | public static function _Load ( $ path ) { if ( ! parent :: _Exists ( $ path ) ) { return FALSE ; } $ image = FALSE ; switch ( self :: _getMIME ( $ path ) ) { case IMAGETYPE_GIF : $ image = imagecreatefromgif ( $ path ) ; break ; case IMAGETYPE_PNG : $ resImg = imagecreatefrompng ( $ path ) ; break ; default : $ image =... | Load image as a resource |
54,278 | public static function _Save ( $ image , $ path , $ replace = FALSE ) { if ( $ replace === FALSE && parent :: _Exists ( $ path ) ) { return FALSE ; } switch ( parent :: _getExtension ( $ path ) ) { case 'gif' : if ( ! imagegif ( $ image , $ path ) ) { return FALSE ; } break ; case 'png' : if ( ! imagepng ( $ image , $ ... | Save an image resource |
54,279 | public static function _Resize ( $ image , $ newX , $ newY , $ method = self :: RESIZE_MAX , $ proportional = TRUE ) { $ origX = imagesx ( $ image ) ; $ origY = imagesy ( $ image ) ; $ canvasX = $ newX ; $ canvasY = $ newY ; switch ( $ method ) { case self :: RESIZE_MAX : if ( $ origX / $ newX > $ origY / $ newY ) { $ ... | Resize an image resource |
54,280 | public static function _copyResize ( $ originalPath , $ newPath , $ newX , $ newY , $ method = self :: RESIZE_MAX , $ proportional = TRUE ) { if ( ! parent :: _Exists ( $ originalPath ) ) { return FALSE ; } $ image = self :: _Load ( $ originalPath ) ; $ newImage = self :: _Resize ( $ image , $ newX , $ newY , $ method ... | Resize and copy an image |
54,281 | public function createDriver ( ) : Driver { $ classname = '\ntentan\atiaa\drivers\\' . Text :: ucamelize ( $ this -> config [ 'driver' ] ) . 'Driver' ; return new $ classname ( $ this -> config ) ; } | Create a new driver based on the configuration in the factory . |
54,282 | public function remember ( $ key , $ default , $ minutes = 60 , $ function = 'put' ) { $ this -> _cleanCache ( ) ; if ( ! is_null ( $ item = $ this -> get ( $ key , null ) ) ) { return $ item ; } $ this -> $ function ( $ key , $ default = Utils :: value ( $ default ) , $ minutes ) ; return $ default ; } | Get an item from the cache or cache and return the default value . |
54,283 | public function execute ( ServerRequestInterface $ request , string $ eventBaseName ) { $ processEventName = sprintf ( '%s%s' , $ this -> processSuffix , $ eventBaseName ) ; $ this -> logger -> debug ( 'Processing started' , [ 'Request method' => $ request -> getMethod ( ) , 'Event name' => $ processEventName , 'Contro... | Execute a request process . |
54,284 | protected function fixOptionalSlashes ( $ string ) { $ parts = explode ( '/(' , $ string ) ; $ regex = '' ; $ num = count ( $ parts ) ; $ counter = 1 ; foreach ( $ parts as $ part ) { $ regex .= $ part ; if ( $ num > $ counter ) { if ( preg_match ( '/\)\?$/' , $ parts [ $ counter ] ) ) { $ regex .= '(/)?(' ; } else { $... | Takes the input string and splits the params up and fixes the slashes depending on if the param name following the slash is optional or not . If the following param name is optional the slash must also be optional . |
54,285 | private function getMappings ( ) : Iterator { if ( $ this -> mappings === null ) { $ filePaths = [ ] ; foreach ( $ this -> mappingFilePaths as $ mappingFilePath ) { $ newFilePaths = iterator_to_array ( new SplFileObject ( $ mappingFilePath , 'r' ) ) ; $ filePaths = array_merge ( $ filePaths , $ newFilePaths ) ; } $ thi... | Get the mappings . |
54,286 | public function getCreationInstanceName ( ) { return sizeof ( $ this -> instanceNames ) ? $ this -> instanceNames [ sizeof ( $ this -> instanceNames ) - 1 ] : null ; } | Retrieve name of the instance that is currently being created or initialized |
54,287 | public function getCreationInstanceOptions ( ) { return sizeof ( $ this -> instanceOptions ) ? $ this -> instanceOptions [ sizeof ( $ this -> instanceOptions ) - 1 ] : null ; } | Retrieve options for the instance that is currently being created or initialized |
54,288 | public function getCreationInstanceFetchAsService ( ) { return sizeof ( $ this -> instanceAsService ) ? $ this -> instanceAsService [ sizeof ( $ this -> instanceAsService ) - 1 ] : null ; } | Retrieve fetch as service flag for instance that is currently being initialized |
54,289 | public function getProxyGenerator ( ) { if ( ! $ this -> proxyGenerator ) { $ this -> proxyGenerator = new ServiceProxyGenerator ( $ this -> getProxyDir ( ) , $ this -> getProxyNs ( ) ) ; } return $ this -> proxyGenerator ; } | Retrieve proxy generator |
54,290 | public function wrapService ( $ serviceId , $ instance ) { $ serviceId = $ this -> canonicalizeName ( $ serviceId ) ; $ proxy = null ; if ( ( $ fqcn = $ this -> getCache ( ) -> getItem ( self :: CACHE_ID_PREFIX . $ serviceId ) ) && class_exists ( $ fqcn ) && $ this -> getProxyAutoCreateStrategy ( ) !== self :: PROXY_AU... | Wrap service with proxy instance |
54,291 | public function getOptionalProperty ( $ property , $ default = null ) { \ Assert \ that ( $ property ) -> string ( ) -> notEmpty ( ) ; if ( property_exists ( $ this -> description , $ property ) === false ) { return $ default ; } return $ this -> getMandatoryProperty ( $ property ) ; } | Get an optional property . |
54,292 | public function getMandatoryProperty ( $ property ) { \ Assert \ that ( $ property ) -> string ( ) -> notEmpty ( ) ; if ( isset ( $ this -> description -> { $ property } ) === false ) { throw InvalidDescriptionException :: missingMandatoryProperty ( $ property ) ; } if ( $ this -> description -> { $ property } instance... | Get a mandatory property . |
54,293 | public static function getProvider ( $ classname ) { if ( array_key_exists ( $ classname , self :: $ providers ) ) { return self :: $ providers [ $ classname ] ; } $ provider = new $ classname ; if ( ! ( $ provider instanceof ServiceProviderInterface ) ) { throw new \ InvalidArgumentException ( "$classname is not a val... | Obtains a provider class instance |
54,294 | protected function getSourceRow ( ) : array { $ row = $ this -> dictionary -> getRow ( $ this -> sourceId ) ; if ( ! $ row ) { throw new TranslationNotFoundException ( $ this -> getKey ( ) , $ this -> dictionary ) ; } return $ row ; } | Fetch the source row . |
54,295 | protected function getTargetRow ( ) : array { $ row = $ this -> dictionary -> getRow ( $ this -> targetId ) ; if ( ! $ row ) { throw new TranslationNotFoundException ( $ this -> getKey ( ) , $ this -> dictionary ) ; } return $ row ; } | Fetch the target row . |
54,296 | protected function parsePostBody ( $ data ) { if ( ! empty ( $ data [ "body" ] ) && ! empty ( $ data [ "headers" ] [ "Content-Type" ] ) ) { $ matched = preg_match ( "/boundary=(.*)$/" , $ data [ "headers" ] [ "Content-Type" ] , $ matches ) ; if ( ! $ matched ) { parse_str ( urldecode ( $ data [ "body" ] ) , $ params ) ... | Parse raw http request body |
54,297 | public function setPath ( string $ path ) : void { if ( ! is_writable ( $ path ) ) { throw new Exception ( "The path to the cache is not writable." ) ; } $ this -> cachePath = $ path ; } | Set the base for the cache path where all items are stored . |
54,298 | public function fileCacheSet ( $ key , $ value , $ cache_time = 86400 ) { if ( $ this -> isSingle ( ) ) { FilecacheKit :: add ( $ key , $ value , $ cache_time ) ; } } | File Cache Set |
54,299 | public function addEntityReflection ( EntityReflectionInterface $ entityReflection ) { $ slug = $ entityReflection -> getSlug ( ) ; if ( isset ( $ this -> entitiesBySlug [ $ slug ] ) ) { throw new DomainErrorException ( 'Two entities are registered with the same "' . $ slug . '" slug!' ) ; } $ this -> entitiesBySlug [ ... | Add an entity to the pool |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.