idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
17,600 | public function deleteFrom ( $ namespace , $ key ) { if ( isset ( $ _SESSION [ $ namespace ] ) ) { $ oldNamespace = $ this -> namespace ; $ this -> setNamespace ( $ namespace ) ; $ this -> delete ( $ key ) ; $ this -> setNamespace ( $ oldNamespace ) ; } } | Delete session key or array of keys from specific namespace |
17,601 | public function clearFrom ( $ namespace , $ key = null ) { $ oldNamespace = $ this -> namespace ; $ this -> setNamespace ( $ namespace ) ; $ this -> clear ( $ key ) ; $ this -> setNamespace ( $ oldNamespace ) ; } | Delete all session values from specific namespace |
17,602 | private function _processFile ( $ filePath ) { $ hasProblems = false ; $ hasVisibilityProblems = false ; $ fileName = basename ( $ filePath ) ; $ inputLines = @ file ( $ filePath ) ; $ outputLines = [ ] ; if ( $ inputLines === false ) { if ( is_link ( $ filePath ) ) { return false ; } else { echo "- {$filePath}: UNABLE... | Process single file . |
17,603 | public function getByTrackingId ( $ id ) { $ this -> request [ 'SelectionDetails' ] = array ( 'PackageIdentifier' => array ( 'Type' => 'TRACKING_NUMBER_OR_DOORTAG' , 'Value' => $ id ) ) ; $ req = $ this -> buildRequest ( $ this -> request ) ; return $ this -> getSoapClient ( ) -> track ( $ req ) ; ; } | Gets the tracking detials for the given tracking number and returns the FedEx request as an object . |
17,604 | public function javascriptIncludeTag ( $ sources = "application" , $ attributes = [ ] ) { $ args = func_get_args ( ) ; if ( is_array ( last ( $ args ) ) ) { $ attributes = array_pop ( $ args ) ; } else { $ attributes = [ ] ; } $ sources = is_array ( $ sources ) ? $ sources : $ args ; if ( empty ( $ sources ) ) { $ sour... | Returns an HTML script tag for the sources and attributes specified as arguments . |
17,605 | public function stylesheetLinkTag ( $ sources = "application" , $ attributes = [ ] ) { $ args = func_get_args ( ) ; if ( is_array ( last ( $ args ) ) ) { $ attributes = array_pop ( $ args ) ; } else { $ attributes = [ ] ; } $ sources = is_array ( $ sources ) ? $ sources : $ args ; if ( empty ( $ sources ) ) { $ sources... | Returns a HTML stylesheet link tag for the sources and attributes specified as arguments . |
17,606 | public function faviconLinkTag ( $ source = null , $ attributes = [ ] ) { $ source = $ source ? : "favicon.ico" ; $ assetsOptions = [ 'host' => array_pull ( $ attributes , 'host' , $ this -> assetsHost ) ] ; $ defaults = [ 'rel' => 'shortcut icon' , 'type' => 'image/vnd.microsoft.icon' ] ; $ attributes = $ attributes +... | Returns a HTML favicon link tag for the source and attributes specified as arguments . |
17,607 | public function imageTag ( $ source , $ alt = null , $ attributes = [ ] ) { $ assetsOptions = [ 'host' => array_pull ( $ attributes , 'host' , $ this -> assetsHost ) ] ; $ alt = $ alt ? : humanize ( basename ( $ source , "." . File :: extension ( $ source ) ) ) ; return app ( 'html' ) -> image ( $ this -> assetPath ( $... | Returns an HTML image element for the source and attributes specified as arguments from the assets pipeline . |
17,608 | public function assetPath ( $ source , array $ options = [ ] ) { $ source = ( string ) $ source ; if ( ! $ source ) { return "" ; } if ( preg_match ( static :: URI_REGEXP , $ source ) ) { return $ source ; } $ assetPrefix = array_get ( $ options , 'prefix' , $ this -> assetsPrefix ) ; if ( is_callable ( $ assetPrefix )... | Computes the path to asset in public directory . |
17,609 | protected function copyCommand ( ) { $ sys = strtoupper ( PHP_OS ) ; if ( substr ( $ sys , 0 , 3 ) == "WIN" ) { $ copyCommand = "xcopy" ; } elseif ( $ sys == "LINUX" ) { $ copyCommand = "cp" ; } else { $ copyCommand = "cp" ; } return $ copyCommand ; } | Returns the copy comment specific to your OS |
17,610 | protected function start ( Request $ request ) { $ settings = $ this -> settings ; ini_set ( 'session.use_strict_mode' , 1 ) ; ini_set ( 'session.use_cookies' , 1 ) ; ini_set ( 'session.use_only_cookies' , 1 ) ; ini_set ( 'session.use_trans_sid' , 0 ) ; if ( is_string ( $ settings [ 'lifetime' ] ) ) { $ settings [ 'lif... | Configure and start session |
17,611 | private function _compile ( ) { if ( isset ( $ this -> _propertyMapCache -> classMaps [ $ this -> _solveClassName ] ) ) { return ; } $ this -> _reflectSolveClassHierarchy ( ) ; $ this -> _checkCurrentLocks ( ) ; $ this -> _lockUncompiledClasses ( ) ; try { foreach ( $ this -> _classHierarchy as $ classInfo ) { $ this -... | The real internal compiler algorithm entry point . |
17,612 | private function _reflectSolveClassHierarchy ( ) { if ( ! empty ( $ this -> _classHierarchy ) ) { throw new BadPropertyMapException ( 'Detected multiple calls to _reflectSolveClassHierarchy().' ) ; } try { $ reflector = new ReflectionClass ( $ this -> _strictSolveClassName ) ; if ( $ this -> _solveClassName !== $ refle... | Reflect all classes in the solve - class hierarchy . |
17,613 | private function _checkCurrentLocks ( ) { foreach ( $ this -> _classHierarchy as $ classInfo ) { if ( isset ( $ this -> _propertyMapCache -> compilerLocks [ $ classInfo [ 'className' ] ] ) ) { throw new CircularPropertyMapException ( $ classInfo [ 'strictClassName' ] , $ this -> _strictSolveClassName ) ; } } } | Check for already - locked classes in the solve - class hierarchy . |
17,614 | private function _lockUncompiledClasses ( ) { if ( ! empty ( $ this -> _ourCompilerClassLocks ) ) { throw new BadPropertyMapException ( 'Detected multiple calls to _lockUncompiledClasses().' ) ; } foreach ( $ this -> _classHierarchy as $ classInfo ) { if ( ! isset ( $ this -> _propertyMapCache -> classMaps [ $ classInf... | Lock all uncompiled classes in the solve - class hierarchy . |
17,615 | private function _processCurrentClass ( ) { try { $ foundConstant = false ; if ( version_compare ( PHP_VERSION , '7.1.0' ) >= 0 ) { $ reflectionConstant = $ this -> _currentClassInfo [ 'reflector' ] -> getReflectionConstant ( 'JSON_PROPERTY_MAP' ) ; if ( $ reflectionConstant !== false ) { $ foundConstant = true ; $ raw... | Process the current class in the solve - class hierarchy . |
17,616 | private function _processPropertyMapEntry ( $ propName , $ propDefStr ) { if ( is_string ( $ propName ) && is_string ( $ propDefStr ) ) { $ this -> _processPropertyDefinitionString ( $ propName , $ propDefStr ) ; } else { $ isImportCommand = false ; if ( is_int ( $ propName ) && is_string ( $ propDefStr ) ) { $ strictI... | Process a property map entry for the current class . |
17,617 | private function _processPropertyDefinitionString ( $ propName , $ propDefStr ) { try { $ propDefObj = new PropertyDefinition ( $ propDefStr , $ this -> _currentClassInfo [ 'namespace' ] ) ; if ( ! isset ( $ this -> _currentClassPropertyMap [ $ propName ] ) || ! $ propDefObj -> equals ( $ this -> _currentClassPropertyM... | Compile a property definition string and add it to the current class . |
17,618 | private function _importClassMap ( $ strictImportClassName ) { try { $ reflector = new ReflectionClass ( $ strictImportClassName ) ; $ importClassName = $ reflector -> getName ( ) ; $ strictImportClassName = Utilities :: createStrictClassPath ( $ importClassName ) ; } catch ( ReflectionException $ e ) { throw new BadPr... | Import another class map into the current class . |
17,619 | private function _subcompile ( $ className ) { $ subCompiler = new self ( false , $ this -> _propertyMapCache , $ className ) ; $ subCompiler -> compile ( ) ; $ this -> compiledClasses = array_merge ( $ this -> compiledClasses , $ subCompiler -> compiledClasses ) ; $ this -> uncompiledPropertyClasses = array_merge ( $ ... | Used internally when this compiler needs to run a sub - compilation . |
17,620 | public static function splitFunctionName ( $ functionName ) { $ chunks = preg_split ( '/(?=[^a-z])/' , $ functionName , 2 ) ; if ( count ( $ chunks ) === 2 && $ chunks [ 0 ] !== '' ) { return $ chunks ; } static $ invalidChunks = [ null , null ] ; return $ invalidChunks ; } | Split a function name into its function - type and FuncCase components . |
17,621 | protected function _funcCaseToProperties ( $ funcCase ) { if ( ! strlen ( $ funcCase ) ) { return false ; } $ funcCase = SpecialOperators :: decodeOperators ( $ funcCase ) ; $ result = ltrim ( $ funcCase , '_' ) ; $ leadingUnderscores = strlen ( $ funcCase ) - strlen ( $ result ) ; if ( preg_match ( '/^[a-z]/' , $ resu... | Converts a FunctionCase name to snake and camel properties . |
17,622 | public function manager ( ) { if ( ! isset ( $ this -> manager ) ) { $ this -> manager = new Manager ( $ this -> client ) ; } return $ this -> manager ; } | Returns trello manager instance |
17,623 | public function toString ( ) : string { return 'has the key ' . $ this -> exporter -> export ( $ this -> key ) . ' with the value ' . $ this -> exporter -> export ( $ this -> value ) ; } | Returns a string representation of the constraint . |
17,624 | public function createMessageFromView ( $ view , $ params = [ ] , $ viewsDir = null ) { $ message = $ this -> createMessage ( ) ; $ message -> content ( $ this -> renderView ( $ view , $ params , $ viewsDir ) , $ message :: CONTENT_TYPE_HTML ) ; return $ message ; } | Create a new Message instance . For the body of the message uses the result of render of view |
17,625 | protected function registerSwiftTransport ( ) { switch ( $ driver = $ this -> getConfig ( 'driver' ) ) { case 'smtp' : $ this -> transport = $ this -> registerTransportSmtp ( ) ; break ; case 'mail' : $ this -> transport = $ this -> registerTransportMail ( ) ; break ; case 'sendmail' : $ this -> transport = $ this -> r... | Create a new Driver - mail of SwiftTransport instance . |
17,626 | protected function registerTransportSmtp ( ) { $ config = $ this -> getConfig ( ) ; $ transport = $ this -> getDI ( ) -> get ( '\Swift_SmtpTransport' ) ; if ( isset ( $ config [ 'encryption' ] ) ) { $ transport -> setEncryption ( $ config [ 'encryption' ] ) ; } if ( isset ( $ config [ 'host' ] ) ) { $ transport -> setH... | Create a new SmtpTransport instance . |
17,627 | public function setDefault ( $ default ) { $ entry_builder = new EntryBuilder ( ) ; $ entry_builder -> with ( $ this -> anything ( ) ) -> will ( $ default ) ; $ this -> default_entry = $ entry_builder -> build ( ) ; return $ this ; } | Sets the default return value . |
17,628 | public function replyTo ( $ email , $ name = null ) { $ email = $ this -> normalizeEmail ( $ email ) ; $ this -> getSwiftMessage ( ) -> setReplyTo ( $ email , $ name ) ; return $ this ; } | Set the reply - to address of this message . |
17,629 | public function to ( $ email , $ name = null ) { $ email = $ this -> normalizeEmail ( $ email ) ; $ this -> getSwiftMessage ( ) -> setTo ( $ email , $ name ) ; return $ this ; } | Set the to addresses of this message . |
17,630 | public function cc ( $ email , $ name = null ) { $ email = $ this -> normalizeEmail ( $ email ) ; $ this -> getSwiftMessage ( ) -> setCc ( $ email , $ name ) ; return $ this ; } | Set the Cc addresses of this message . |
17,631 | public function bcc ( $ email , $ name = null ) { $ email = $ this -> normalizeEmail ( $ email ) ; $ this -> getSwiftMessage ( ) -> setBcc ( $ email , $ name ) ; return $ this ; } | Set the Bcc addresses of this message . |
17,632 | public function contentAlternative ( $ content , $ contentType = null , $ charset = null ) { $ this -> getSwiftMessage ( ) -> addPart ( $ content , $ contentType , $ charset ) ; return $ this ; } | Add optionally an alternative body |
17,633 | protected function createAttachmentViaPath ( $ file ) { $ byteStream = $ this -> getManager ( ) -> getDI ( ) -> get ( '\Swift_ByteStream_FileByteStream' , [ $ file ] ) ; $ attachment = $ this -> getManager ( ) -> getDI ( ) -> get ( '\Swift_Attachment' ) -> setFile ( $ byteStream ) ; return $ attachment ; } | Create a Swift new Attachment from a filesystem path . |
17,634 | protected function createEmbedViaPath ( $ file ) { $ byteStream = $ this -> getManager ( ) -> getDI ( ) -> get ( '\Swift_ByteStream_FileByteStream' , [ $ file ] ) ; $ image = $ this -> getManager ( ) -> getDI ( ) -> get ( '\Swift_Image' ) -> setFile ( $ byteStream ) ; return $ image ; } | Create a Swift new Image from a filesystem path . |
17,635 | protected function createEmbedViaData ( $ data , $ filename = null , $ contentType = null ) { return $ this -> getManager ( ) -> getDI ( ) -> get ( '\Swift_Image' , [ $ data , $ filename , $ contentType ] ) ; } | Create a Swift new Image . |
17,636 | public static function assertHasItems ( $ expected , $ actual , $ message = '' ) { Assert :: assertThat ( $ actual , new HasItems ( $ expected ) , $ message ) ; } | Asserts that the actual array contains at least one occurence of each of the values in the expected array . |
17,637 | public static function assertArrayEqualsNoOrder ( $ expected , $ actual , $ message = '' ) { Assert :: assertThat ( $ actual , new ArrayEqualsNoOrder ( $ expected ) , $ message ) ; } | Asserts that the two arrays contain the same exact contents but are not necessarily the same order . |
17,638 | public static function assertStringMatchIgnoreWhitespace ( $ expected , $ actual , $ message = '' ) { Assert :: assertThat ( $ actual , new StringMatchIgnoreWhitespace ( $ expected ) , $ message ) ; } | Asserts that the two strings match but that all whitespaces are not necessarily equal . |
17,639 | protected function deep_merge_recursive ( $ arrays ) { $ result = array ( ) ; foreach ( $ arrays as $ array ) { foreach ( $ array as $ key => $ value ) { if ( is_integer ( $ key ) ) { $ result [ ] = $ value ; } elseif ( isset ( $ result [ $ key ] ) && is_array ( $ result [ $ key ] ) && is_array ( $ value ) ) { $ result... | but also handle embeded objects |
17,640 | function binary ( $ path ) { if ( function_exists ( 'exec' ) ) { exec ( $ path . ' -v 2>&1' , $ out , $ ret ) ; if ( $ ret == 0 && preg_match ( '/cli/' , @ $ out [ 0 ] , $ out ) ) $ this -> binary = $ path ; } return $ this -> binary ; } | Set binary path after checking that it can be executed and is CLI |
17,641 | function set ( $ job , $ handler , $ expr ) { if ( ! preg_match ( '/^[\w\-]+$/' , $ job ) ) user_error ( sprintf ( self :: E_Invalid , $ job ) , E_USER_ERROR ) ; $ this -> jobs [ $ job ] = array ( $ handler , $ expr ) ; } | Schedule a job |
17,642 | function isDue ( $ job , $ time ) { if ( ! isset ( $ this -> jobs [ $ job ] ) || ! $ parts = $ this -> parseExpr ( $ this -> jobs [ $ job ] [ 1 ] ) ) return FALSE ; foreach ( $ this -> parseTimestamp ( $ time ) as $ i => $ k ) if ( ! in_array ( $ k , $ parts [ $ i ] ) ) return FALSE ; return TRUE ; } | Returns TRUE if the requested job is due at the given time |
17,643 | function execute ( $ job , $ async = TRUE ) { if ( ! isset ( $ this -> jobs [ $ job ] ) ) user_error ( sprintf ( self :: E_NotFound , $ job ) , E_USER_ERROR ) ; $ f3 = \ Base :: instance ( ) ; if ( is_string ( $ func = $ this -> jobs [ $ job ] [ 0 ] ) ) $ func = $ f3 -> grab ( $ func ) ; if ( ! is_callable ( $ func ) )... | Execute a job |
17,644 | function run ( $ time = NULL , $ async = TRUE ) { if ( ! isset ( $ time ) ) $ time = time ( ) ; $ exec = array ( ) ; foreach ( array_keys ( $ this -> jobs ) as $ job ) if ( $ this -> isDue ( $ job , $ time ) ) $ exec [ $ job ] = $ this -> execute ( $ job , $ async ) ; return $ exec ; } | Run scheduler i . e executes all due jobs at a given time |
17,645 | function route ( $ f3 , $ params ) { if ( PHP_SAPI != 'cli' && ! $ this -> web ) $ f3 -> error ( 404 ) ; $ exec = isset ( $ params [ 'job' ] ) ? array ( $ params [ 'job' ] => $ this -> execute ( $ params [ 'job' ] , FALSE ) ) : $ this -> run ( ) ; if ( ! $ this -> silent ) { if ( PHP_SAPI != 'cli' ) header ( 'Content-T... | Route controller code |
17,646 | function parseTimestamp ( $ time ) { return array ( ( int ) date ( 'i' , $ time ) , ( int ) date ( 'H' , $ time ) , ( int ) date ( 'd' , $ time ) , ( int ) date ( 'm' , $ time ) , ( int ) date ( 'w' , $ time ) , ) ; } | Parse a timestamp |
17,647 | function parseExpr ( $ expr ) { $ parts = array ( ) ; if ( preg_match ( '/^@(\w+)$/' , $ expr , $ m ) ) { if ( ! isset ( $ this -> presets [ $ m [ 1 ] ] ) ) return FALSE ; $ expr = $ this -> presets [ $ m [ 1 ] ] ; } $ expr = preg_split ( '/\s+/' , $ expr , - 1 , PREG_SPLIT_NO_EMPTY ) ; $ ranges = array ( 0 => 59 , 1 =... | Parse a cron expression |
17,648 | protected function configureClientOptions ( ) { $ assetBundle = StarRatingAsset :: register ( $ this -> view ) ; if ( ! isset ( $ this -> clientOptions [ 'score' ] ) ) { $ this -> clientOptions [ 'score' ] = $ this -> hasModel ( ) ? Html :: getAttributeValue ( $ this -> model , $ this -> attribute ) : $ this -> value ;... | Configure client options |
17,649 | private static function parseQuery ( $ str , $ urlEncoding = true ) { $ result = [ ] ; if ( $ str === '' ) { return $ result ; } if ( $ urlEncoding === true ) { $ decoder = function ( $ value ) { return rawurldecode ( str_replace ( '+' , ' ' , $ value ) ) ; } ; } elseif ( $ urlEncoding == PHP_QUERY_RFC3986 ) { $ decode... | Parse a query string into an associative array . |
17,650 | function createHttpRequest ( ) { $ headers = [ 'User-Agent' => $ this -> getContext ( ) -> getUserAgent ( ) , 'Content-Type' => 'application/x-www-form-urlencoded' ] ; $ body = $ this -> buildQuery ( $ this -> getRequestParameters ( ) ) ; return $ this -> getContext ( ) -> getMessageFactory ( ) -> createRequest ( 'POST... | Converts the request to a PSR - 7 RequestInterface |
17,651 | function createResponse ( \ Psr \ Http \ Message \ ResponseInterface $ response ) { return WirecardResponse :: fromHttpResponse ( $ response , $ this -> resultClass ) ; } | Converts the PSR - 7 ResponseInterface to a Wirecard Response |
17,652 | protected function getRawParameters ( ) { $ params = $ this -> parameters ; $ context = $ this -> getContext ( ) ; if ( empty ( $ params [ 'customerId' ] ) ) { $ params [ 'customerId' ] = $ context -> getCustomerId ( ) ; } if ( $ context -> getShopId ( ) and empty ( $ params [ 'shopId' ] ) ) { $ params [ 'shopId' ] = $... | Returns the request parameters without calculated fingerprint |
17,653 | protected function assertParametersAreValid ( array $ parameters , array $ requiredParameters ) { foreach ( $ requiredParameters as $ parameter ) { if ( empty ( $ parameters [ $ parameter ] ) ) { throw RequiredParameterMissingException :: withParameter ( $ parameter ) ; } } } | Validates that all required parameters are set otherwise throws an exception |
17,654 | protected function buildQuery ( array $ params , $ encoding = PHP_QUERY_RFC3986 ) { if ( ! $ params ) { return '' ; } if ( $ encoding === false ) { $ encoder = function ( $ str ) { return $ str ; } ; } elseif ( $ encoding == PHP_QUERY_RFC3986 ) { $ encoder = 'rawurlencode' ; } elseif ( $ encoding == PHP_QUERY_RFC1738 )... | Build a query string from an array of key value pairs . |
17,655 | function send ( WirecardRequestInterface $ wirecardRequest ) { $ wirecardRequest -> setContext ( $ this -> getContext ( ) ) ; $ httpRequest = $ wirecardRequest -> createHttpRequest ( ) ; $ httpResponse = call_user_func ( $ this -> client , $ httpRequest ) ; return $ wirecardRequest -> createResponse ( $ httpResponse ) ... | Synchronously sends the request with the configured client |
17,656 | public function lookup ( $ asin ) { $ params = $ this -> buildRequestParams ( 'ItemLookup' , array ( 'ItemId' => $ asin , ) ) ; return $ this -> returnData ( $ this -> performSoapRequest ( "ItemLookup" , $ params ) ) ; } | execute ItemLookup request |
17,657 | public function similarityLookup ( $ asin ) { $ params = $ this -> buildRequestParams ( 'SimilarityLookup' , array ( 'ItemId' => $ asin ) ) ; return $ this -> returnData ( $ this -> performSoapRequest ( "SimilarityLookup" , $ params ) ) ; } | Implementation of SimilarityLookup This allows to fetch information about product related to the parameter product |
17,658 | protected function buildRequestParams ( $ function , array $ params ) { $ associateTag = array ( ) ; if ( false === empty ( $ this -> requestConfig [ 'associateTag' ] ) ) { $ associateTag = array ( 'AssociateTag' => $ this -> requestConfig [ 'associateTag' ] ) ; } return array_merge ( $ associateTag , array ( 'AWSAcces... | Builds the request parameters |
17,659 | protected function prepareResponseGroup ( ) { if ( false === strstr ( $ this -> responseConfig [ 'responseGroup' ] , ',' ) ) return $ this -> responseConfig [ 'responseGroup' ] ; return explode ( ',' , $ this -> responseConfig [ 'responseGroup' ] ) ; } | Prepares the responsegroups and returns them as array |
17,660 | protected function buildSoapHeader ( $ function ) { $ timeStamp = $ this -> getTimestamp ( ) ; $ signature = $ this -> buildSignature ( $ function . $ timeStamp ) ; return array ( new SoapHeader ( 'http://security.amazonaws.com/doc/2007-01-01/' , 'AWSAccessKeyId' , $ this -> requestConfig [ 'accessKey' ] ) , new SoapHe... | Provides some necessary soap headers |
17,661 | protected function objectToArray ( $ object ) { $ out = array ( ) ; foreach ( $ object as $ key => $ value ) { switch ( true ) { case is_object ( $ value ) : $ out [ $ key ] = $ this -> objectToArray ( $ value ) ; break ; case is_array ( $ value ) : $ out [ $ key ] = $ this -> objectToArray ( $ value ) ; break ; defaul... | Transforms the responseobject to an array |
17,662 | public function optionalParameters ( $ params = null ) { if ( null === $ params ) { return $ this -> responseConfig [ 'optionalParameters' ] ; } if ( false === is_array ( $ params ) ) { throw new InvalidArgumentException ( sprintf ( "%s is no valid parameter: Use an array with Key => Value Pairs" , $ params ) ) ; } $ t... | set or get optional parameters |
17,663 | public function country ( $ country = null ) { if ( null === $ country ) { return $ this -> responseConfig [ 'country' ] ; } if ( false === in_array ( strtolower ( $ country ) , $ this -> possibleLocations ) ) { throw new InvalidArgumentException ( sprintf ( "Invalid Country-Code: %s! Possible Country-Codes: %s" , $ co... | Set or get the country |
17,664 | public function page ( $ page ) { if ( false === is_numeric ( $ page ) || $ page <= 0 ) { throw new InvalidArgumentException ( sprintf ( '%s is an invalid page value. It has to be numeric and positive' , $ page ) ) ; } $ this -> responseConfig [ 'optionalParameters' ] = array_merge ( $ this -> responseConfig [ 'optiona... | Setting the resultpage to a specified value . Allows to browse resultsets which have more than one page . |
17,665 | function setBasket ( Basket $ basket ) { foreach ( $ basket -> toArray ( ) as $ param => $ value ) { $ this -> addParam ( $ param , $ value ) ; } return $ this ; } | Adds the basket to the payment required for some payment methods |
17,666 | public static function fromResponseParameters ( array $ parameters , Context $ context = null ) { if ( empty ( $ parameters [ 'responseFingerprintOrder' ] ) ) { throw new \ UnexpectedValueException ( 'The responseFingerprintOrder parameter is missing' ) ; } $ self = static :: fromParameters ( $ parameters ) ; $ self ->... | Create a fingerprint based on received response paramaters |
17,667 | public function setContext ( Context $ context ) { $ this -> context = $ context ; if ( empty ( $ this -> parameters [ 'secret' ] ) ) { $ this -> parameters [ 'secret' ] = $ context -> getSecret ( ) ; } return $ this ; } | Sets the context for fingerprint calculation |
17,668 | function addItem ( BasketItem $ item ) { $ basketItems = $ this -> getParam ( 'basketItems' ) ? : 0 ; $ basketItems ++ ; $ this -> items [ $ basketItems ] = $ item ; $ this -> addParam ( 'basketItems' , $ basketItems ) ; foreach ( $ item -> toArray ( ) as $ param => $ value ) { $ this -> addParam ( 'basketItem' . $ bas... | Adds an item to the basket |
17,669 | public function check ( $ rut ) { $ cleanedRut = $ this -> clean ( $ rut ) ; if ( ! $ cleanedRut ) return false ; list ( $ numero , $ digitoVerificador ) = explode ( '-' , $ cleanedRut ) ; if ( ( ( $ digitoVerificador != 'K' ) && ( ! is_numeric ( $ digitoVerificador ) ) ) || ( count ( str_split ( $ numero ) ) > 11 ) ) ... | Valida un RUT |
17,670 | public function clean ( $ originalRut , $ incluyeDigitoVerificador = true ) { $ originalRut = trim ( $ originalRut ) ; $ originalRut = ltrim ( $ originalRut , '0' ) ; $ input = str_split ( $ originalRut ) ; $ cleanedRut = '' ; foreach ( $ input as $ key => $ chr ) { if ( ( ( $ key + 1 ) == count ( $ input ) ) && ( $ in... | Formatea un RUT |
17,671 | public function setAutoSubmitting ( $ value ) { if ( $ this -> autoSubmitting !== ( bool ) $ value ) { $ this -> autoSubmitting = ( bool ) $ value ; $ this -> onAutoSubmittingValueChange ( ) ; } return $ this ; } | Sets auto - submitting option value . |
17,672 | public function enableAutoSubmitting ( ) { if ( $ this -> autoSubmitting === false ) { $ this -> autoSubmitting = true ; $ this -> onAutoSubmittingValueChange ( ) ; } return $ this ; } | Enables auto - submitting . |
17,673 | public function disableAutoSubmitting ( ) { if ( $ this -> autoSubmitting === true ) { $ this -> autoSubmitting = false ; $ this -> onAutoSubmittingValueChange ( ) ; } return $ this ; } | Disables auto - submitting . |
17,674 | public function getProcessor ( OperationInterface $ operation ) { $ operationClass = get_class ( $ operation ) ; if ( ! array_key_exists ( $ operationClass , $ this -> processors ) ) { throw new ProcessorNotFoundException ( $ operationClass , get_class ( $ this ) ) ; } $ processorClass = $ this -> processors [ $ operat... | Returns operation processor instance . |
17,675 | public function getSql ( ) { $ where = ( count ( $ this -> conditions ) === 0 ) ? '' : 'WHERE ' . implode ( ' and ' , $ this -> conditions ) ; $ sql = "SELECT $this->select FROM $this->table $where $this->order $this->limit $this->offset" ; return $ sql ; } | Returns generated SQL . |
17,676 | protected function getPdoStatement ( ) { $ statement = $ this -> connection -> prepare ( $ this -> getSql ( ) ) ; if ( $ this -> dataRowClass !== null ) { $ statement -> setFetchMode ( PDO :: FETCH_CLASS , $ this -> dataRowClass ) ; } else { $ statement -> setFetchMode ( PDO :: FETCH_OBJ ) ; } return $ statement ; } | Prepares a PDOStatement for execution and returns it . |
17,677 | public function execute ( ) { $ statement = $ this -> getPdoStatement ( ) ; $ result = $ statement -> execute ( $ this -> bindings ) ; if ( ! $ result ) { $ errorInfo = $ statement -> errorInfo ( ) ; throw new RuntimeException ( $ errorInfo [ 1 ] , $ errorInfo [ 2 ] ) ; } return $ statement ; } | Executes query . |
17,678 | public function count ( ) { $ query = clone $ this ; $ query -> select = 'count(*)' ; return ( int ) $ query -> execute ( ) -> fetch ( PDO :: FETCH_NUM ) [ 0 ] ; } | Returns records count . Executes separate SQL query to count records . |
17,679 | public static function modifyQuery ( $ uri , array $ newQueryParams ) { if ( $ uri === null ) { $ uri = static :: getCurrentRequestUri ( ) ; } $ query = parse_url ( $ uri , PHP_URL_QUERY ) ; $ queryParams = [ ] ; parse_str ( $ query , $ queryParams ) ; $ newQuery = http_build_query ( array_merge ( $ queryParams , $ new... | Modifies query string and returns updated request part of the URI . |
17,680 | public static function replaceFragment ( $ uri , $ newFragment = '' ) { if ( $ uri === null ) { $ uri = static :: getCurrentRequestUri ( ) ; } $ oldFragment = parse_url ( $ uri , PHP_URL_FRAGMENT ) ; return $ oldFragment ? str_replace ( '#' . $ oldFragment , '#' . $ newFragment , $ uri ) : ( $ newFragment ? $ uri . '#'... | Replaces fragment part and return updated request part of the URI . |
17,681 | public function js ( $ aliasOrUrl ) { $ url = $ this -> getJsUrl ( $ aliasOrUrl ) ; if ( ! $ this -> included -> isIncluded ( $ url ) ) { $ this -> included -> markAsIncluded ( $ url ) ; $ type = 'text/javascript' ; return new Tag ( 'script' , [ 'src' => $ url , 'type' => $ type ] ) ; } else { return new DataView ( ) ;... | Returns component that renders html script tag for including specified javascript resource or component that renders empty string if resource was already included . |
17,682 | public function css ( $ aliasOrUrl , array $ attributes = [ ] ) { $ url = $ this -> getCssUrl ( $ aliasOrUrl ) ; if ( ! $ this -> included -> isIncluded ( $ url ) ) { $ this -> included -> markAsIncluded ( $ url ) ; return new Tag ( 'link' , array_merge ( [ 'type' => 'text/css' , 'rel' => 'stylesheet' , 'href' => $ url... | Returns component that includes CSS resource to html page or component that renders empty string if resource was already included . |
17,683 | public function inlineJs ( $ jsCode , $ uniqueId = null ) { if ( $ uniqueId !== null ) { if ( $ this -> included -> isIncluded ( $ uniqueId ) ) { return new DataView ( ) ; } else { $ this -> included -> markAsIncluded ( $ uniqueId ) ; } } return new TagWithText ( 'script' , $ jsCode ) ; } | Returns component that renders script tag with js code . |
17,684 | public function inlineCss ( $ cssCode , $ uniqueId = null ) { if ( $ uniqueId !== null ) { if ( $ this -> included -> isIncluded ( $ uniqueId ) ) { return new DataView ( ) ; } else { $ this -> included -> markAsIncluded ( $ uniqueId ) ; } } return new TagWithText ( 'style' , $ cssCode ) ; } | Returns component that renders style tag with css code . |
17,685 | public function process ( $ src , OperationInterface $ operation ) { $ callable = $ operation -> getCallback ( ) ; $ arguments = array_merge ( [ $ src ] , $ operation -> getArguments ( ) ) ; $ res = call_user_func_array ( $ callable , $ arguments ) ; return $ res ? : $ src ; } | Applies operation to data source and returns modified data source . |
17,686 | public function resolveTemplate ( ) { if ( strpos ( $ this -> template , '*' ) !== false ) { return str_replace ( '*' , $ this -> getTheme ( ) , $ this -> template ) ; } return $ this -> template ; } | Returns template name considering used theme . |
17,687 | public function setPaginationControl ( PaginationControl $ paginationControl = null ) { $ this -> paginationControl = $ paginationControl ; $ paginationControl && $ this -> updatePagination ( ) ; return $ this ; } | Sets pagination control affected by page size select control . |
17,688 | public function render ( $ template , array $ viewData = [ ] ) { $ filePath = $ this -> finder -> getTemplatePath ( $ template ) ; if ( $ filePath == false ) { throw new InvalidArgumentException ( "Can't load template '$template'" ) ; } ob_start ( ) ; extract ( $ viewData ) ; include ( $ filePath ) ; $ contents = ob_ge... | Renders template and returns output . |
17,689 | public function mergeData ( $ data , $ overridePrevious = true ) { $ oldData = $ this -> getData ( ) ; if ( $ oldData === null ) { $ oldData = [ ] ; } if ( is_object ( $ data ) ) { $ data = get_object_vars ( $ data ) ; } $ this -> setData ( $ overridePrevious ? array_merge ( $ oldData , $ data ) : array_merge ( $ data ... | Merges new data if possible . |
17,690 | public function setView ( ViewComponentInterface $ view = null ) { if ( $ view === $ this -> view ) { return $ this ; } $ this -> view && $ this -> view -> detach ( ) ; $ view && $ view -> attachTo ( $ this ) ; $ this -> view = $ view ; return $ this ; } | Sets view component . |
17,691 | public function get ( $ name , $ default = null ) { if ( array_key_exists ( $ name , $ this -> aliases ) ) { return $ this -> aliases [ $ name ] ; } else { return $ default ; } } | Returns aliased value or default value if requested alias does not exists . |
17,692 | public function getRenderer ( ) { if ( $ this -> renderer === null ) { $ this -> renderer = Services :: renderer ( ) ; } return $ this -> renderer ; } | Returns renderer instance used to render template . |
17,693 | private function makeRowObjects ( $ src ) { $ newSrc = [ ] ; foreach ( $ src as $ row ) { $ newSrc [ ] = is_array ( $ row ) ? ( object ) $ row : $ row ; } return $ newSrc ; } | Makes array of objects from array of arrays . |
17,694 | public static function renderAttributes ( array $ attributes ) { $ html = [ ] ; foreach ( $ attributes as $ key => $ value ) { $ escaped = htmlentities ( $ value , ENT_QUOTES , 'UTF-8' , false ) ; $ html [ ] = is_numeric ( $ key ) ? ( $ escaped . '="' . $ escaped . '""' ) : ( "$key=\"$escaped\"" ) ; } return count ( $ ... | Renders HTML tag attributes . |
17,695 | public static function getContainer ( ) { if ( ! self :: $ container ) { self :: $ container = new ServiceContainer ( ) ; self :: provideServices ( ) ; } return self :: $ container ; } | Returns service container used with presentation framework . |
17,696 | public static function registerServiceProvider ( $ serviceProvider ) { if ( is_callable ( $ serviceProvider ) ) { $ serviceProvider = new CustomServiceProvider ( $ serviceProvider ) ; } elseif ( ! is_a ( $ serviceProvider , ServiceProviderInterface :: class , true ) ) { throw new BootstrapException ( "Error registering... | Registers service provider . |
17,697 | public function set ( $ id , callable $ callback ) { if ( $ this -> has ( $ id ) ) { throw new Exception \ AlreadyExistsException ; } $ this -> callbacks [ $ id ] = $ callback ; } | Defines service . |
17,698 | public function get ( $ id ) { if ( ! $ this -> has ( $ id ) ) { throw new Exception \ NotFoundException ; } if ( ! $ this -> isReady ( $ id ) ) { $ this -> instantiate ( $ id ) ; } return $ this -> instances [ $ id ] ; } | Returns specified service . Throws exception if requested service not exists . |
17,699 | public function extend ( $ id , callable $ callback ) { if ( ! $ this -> has ( $ id ) ) { throw new Exception \ NotFoundException ; } $ oldCallback = $ this -> callbacks [ $ id ] ; $ this -> callbacks [ $ id ] = function ( ) use ( $ oldCallback , $ callback , $ id ) { if ( ! $ this -> isReady ( $ id ) ) { $ thisFunctio... | Extends existing service . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.