idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
4,700 | protected function registerVerifyEmailBroker ( ) { $ this -> app -> singleton ( 'auth.verify_emails' , function ( $ app ) { return new VerifyEmailBrokerManager ( $ app ) ; } ) ; $ this -> app -> bind ( 'auth.verify_emails.broker' , function ( $ app ) { return $ app -> make ( 'auth.verify_emails' ) -> broker ( ) ; } ) ;... | Register the verify email broker instance . |
4,701 | public function render ( ) { $ render = '' ; try { $ render = $ this -> getRenderer ( ) -> render ( 'form' , $ this ) ; } catch ( \ Exception $ e ) { dd ( $ e -> getMessage ( ) ) ; } return $ render ; } | Render the polliwog |
4,702 | public function getValues ( ) { $ values = [ ] ; foreach ( $ this -> getElements ( ) as $ name => $ e ) { if ( $ e -> isDiscreet ( ) ) { continue ; } $ values [ $ name ] = $ e -> getValue ( ) ; } return $ values ; } | Return all values from all elements |
4,703 | public function getFilteredValues ( ) { $ values = [ ] ; foreach ( $ this -> getElements ( ) as $ name => $ e ) { if ( $ e -> isDiscreet ( ) ) { continue ; } $ values [ $ name ] = $ e -> getFilteredValue ( ) ; } return $ values ; } | Return all filtered values from all elements |
4,704 | public function valid ( array $ values , $ populate = true ) { foreach ( $ this -> getElements ( ) as $ index => & $ element ) { if ( ! array_key_exists ( $ index , $ values ) ) { if ( is_a ( $ element , 'FrenchFrogs\Form\Element\Boolean' ) ) { $ values [ $ index ] = 0 ; } else { $ values [ $ index ] = '' ; } } $ eleme... | Valid all the form elements |
4,705 | public function getErrorAsString ( ) { $ errors = [ ] ; foreach ( $ this -> getValidator ( ) -> getErrors ( ) as $ index => $ message ) { $ errors [ ] = sprintf ( '%s:%s %s' , $ index , PHP_EOL , $ message ) ; } return implode ( PHP_EOL , $ errors ) ; } | Return string formated error from the form validation |
4,706 | protected function getObjectReferences ( ObjectManager $ objectManager , $ className ) { $ identifier = $ objectManager -> getClassMetadata ( $ className ) -> getIdentifier ( ) ; $ idField = reset ( $ identifier ) ; $ objectRepository = $ objectManager -> getRepository ( $ className ) ; $ idsResult = $ objectRepository... | Returns array of object references . |
4,707 | protected function getObjectReferencesByIds ( ObjectManager $ objectManager , $ className , array $ ids ) { $ entities = [ ] ; foreach ( $ ids as $ id ) { $ entities [ ] = $ objectManager -> getReference ( $ className , $ id ) ; } return $ entities ; } | Returns array of object references by their ids . It s useful when ids are known and objects are used as other entities relation . |
4,708 | private function applyFilter ( Builder $ query , $ field , $ filter , $ or = false ) { $ filter = explode ( ':' , $ filter ) ; if ( count ( $ filter ) > 1 ) { $ operator = $ this -> getFilterOperator ( $ filter [ 0 ] ) ; $ value = $ this -> replaceWildcards ( $ filter [ 1 ] ) ; } else { $ operator = '=' ; $ value = $ t... | Applies a single filter to the query |
4,709 | private function applyNestedFilter ( Builder $ query , array $ fields , $ operator , $ value , $ or = false ) { $ relation_name = implode ( '.' , array_slice ( $ fields , 0 , count ( $ fields ) - 1 ) ) ; $ relation_field = end ( $ fields ) ; if ( $ relation_name [ 0 ] == '!' ) { $ relation_name = substr ( $ relation_na... | Applies a nested filter . Nested filters are filters on field on related models . |
4,710 | private function applyWhereClause ( Builder $ query , $ field , $ operator , $ value , $ or = false ) { $ verb = $ or ? 'orWhere' : 'where' ; $ null_verb = $ or ? 'orWhereNull' : 'whereNull' ; $ not_null_verb = $ or ? 'orWhereNotNull' : 'whereNotNull' ; $ value = $ this -> base64decodeIfNecessary ( $ value ) ; switch (... | Applies a where clause . Is used by applyFilter and applyNestedFilter to apply the clause to the query . |
4,711 | private function getFilterOperator ( $ filter ) { $ operator = str_replace ( 'notlike' , 'not like' , $ filter ) ; $ operator = str_replace ( 'gt' , '>' , $ operator ) ; $ operator = str_replace ( 'ge' , '>=' , $ operator ) ; $ operator = str_replace ( 'lt' , '<' , $ operator ) ; $ operator = str_replace ( 'le' , '<=' ... | Translates operators to SQL |
4,712 | public function resource ( $ controller , array $ options = array ( ) ) { $ name = isset ( $ options [ "prefix" ] ) ? $ options [ "prefix" ] : "" ; $ name .= $ this -> getResourceName ( $ controller , $ options ) ; $ actions = $ this -> getResourceActions ( $ options ) ; $ resource = new RouteResource ; foreach ( $ act... | Resource routing allows you to quickly declare all of the common routes for a given resourceful controller . Instead of declaring separate routes for your index show new edit create update and destroy actions a resourceful route declares them in a single line of code . |
4,713 | public function resources ( array $ controllers ) { $ resource = new RouteResource ; foreach ( $ controllers as $ controller ) $ resource -> set ( $ this -> resource ( $ controller ) ) ; return $ resource ; } | Collect several resources at same time . |
4,714 | public static function setCookie ( ResponseInterface $ response , $ name , $ value = null , $ ttl = null , $ path = null , $ domain = null , $ secure = false , $ httponly = true ) { $ cookie = urlencode ( $ name ) . '=' . urlencode ( $ value ) ; self :: addExpire ( $ cookie , $ ttl ) ; self :: addDomain ( $ cookie , $ ... | Set a cookie in the response |
4,715 | public static function unsetCookie ( ResponseInterface $ response , $ name , $ path = null ) { return self :: setCookie ( $ response , $ name , '' , time ( ) - 86400 , $ path ) ; } | Unset a cookie |
4,716 | public static function publicCache ( ResponseInterface $ response , $ cacheTime = 120 ) { $ maxAge = $ cacheTime * 60 ; return $ response -> withAddedHeader ( 'Expires' , self :: timeStamp ( $ maxAge ) ) -> withAddedHeader ( 'Cache-Control' , "public, max-age={$maxAge}" ) -> withAddedHeader ( 'Last-Modified' , self :: ... | Set public cache header |
4,717 | public static function privateNoExpireCache ( ResponseInterface $ response , $ cacheTime = 120 ) { $ maxAge = $ cacheTime * 60 ; return $ response -> withAddedHeader ( 'Cache-Control' , "private, max-age={$maxAge}, pre-check={$maxAge}" ) -> withAddedHeader ( 'Last-Modified' , self :: timeStamp ( ) ) ; } | Set private_no_expire cache header |
4,718 | public function getErrorMessage ( ) { if ( is_string ( $ this -> jsonError ) ) { return $ this -> jsonError ; } elseif ( isset ( $ this -> jsonError [ 'message' ] ) ) { return $ this -> jsonError [ 'message' ] ; } return '' ; } | The error message specified in the API or an empty string if not available . |
4,719 | public function reset ( ) { return $ this -> collector -> set ( $ this -> method , $ this -> pattern , $ this -> action ) -> nth ( 0 ) -> setStrategy ( $ this -> strategy ) -> setParams ( $ this -> params ) -> setDefaults ( $ this -> defaults ) -> setMetadataArray ( $ this -> metadata ) ; } | Clone this route and set it into the collector . |
4,720 | public function call ( callable $ container = null ) { $ this -> action = $ this -> buildCallable ( $ this -> action , $ container ) ; if ( $ this -> strategy === null ) { return call_user_func_array ( $ this -> action , array_merge ( $ this -> defaults , $ this -> params ) ) ; } if ( ! is_object ( $ this -> strategy )... | Execute the route action if no strategy was provided the action will be executed by the call_user_func PHP function . |
4,721 | private function parseCallableController ( $ controller , $ container ) { $ controller = rtrim ( $ this -> namespace , "\\" ) . "\\" . $ this -> parseCallablePlaceholders ( $ controller ) ; if ( $ container === null ) { return new $ controller ; } else return $ container ( $ controller ) ; } | Get the controller object . |
4,722 | private function parseCallablePlaceholders ( $ fragment ) { if ( strpos ( $ fragment , "{" ) !== false ) { foreach ( $ this -> params as $ placeholder => $ value ) { if ( strpos ( $ fragment , "{" . $ placeholder . "}" ) !== false ) { $ fragment = str_replace ( "{" . $ placeholder . "}" , ucwords ( str_replace ( "-" , ... | Parse and replace dynamic content on route action . |
4,723 | private function callWithStrategy ( ) { if ( $ this -> strategy instanceof StrategyInterface ) { if ( $ this -> strategy instanceof MatcherAwareInterface ) { $ this -> strategy -> setMatcher ( $ this -> matcher ) ; } return $ this -> strategy -> call ( $ this ) ; } throw new BadRouteException ( str_replace ( "%s" , get... | Execute the route action with the given strategy . |
4,724 | public function setConstraint ( $ token , $ regex ) { $ initPos = strpos ( $ this -> pattern , "{" . $ token ) ; if ( $ initPos !== false ) { $ endPos = strpos ( $ this -> pattern , "}" , $ initPos ) ; $ newPattern = substr_replace ( $ this -> pattern , "{" . "$token:$regex" . "}" , $ initPos , $ endPos - $ initPos + 1... | Set a constraint to a token in the route pattern . |
4,725 | public function addDataTypeClass ( $ dataTypeFQCN , $ classContent , $ replace = false ) { if ( strpos ( $ dataTypeFQCN , "Prooph\\Link\\Application\\DataType\\" ) !== 0 ) { throw new \ InvalidArgumentException ( "Namespace of data type should start with Prooph\\Link\\Application\\DataType\\. Got " . $ dataTypeFQCN ) ;... | Writes the given class content to a class file named after the class . The root directory is defined by the path of ApplicationDataTypeLocation . The namespace of the class should start with Application \ DataType \ If more sub namespaces are defined the method creates a directory for each namespace part if not already... |
4,726 | protected function checkForDuplicateNames ( ) { $ normalized = [ ] ; foreach ( $ this -> data -> rawData [ 'modules' ] as $ moduleId => $ module ) { $ normalized [ $ moduleId ] = $ this -> normalizeName ( array_get ( $ module , 'prefixed_name' ) ? : $ module [ 'name' ] ) ; } return $ this -> getKeysForDuplicates ( $ no... | Checks all modules for conflicting module names and returns modules per duplicate set . |
4,727 | protected function addOrInjectSectionNamePrefix ( $ moduleId ) { $ module = $ this -> data -> rawData [ 'modules' ] [ $ moduleId ] ; $ prefix = $ module [ 'parent_names' ] [ 'section' ] ; $ this -> modulePrefixedSection [ $ moduleId ] = true ; if ( ! $ this -> prefixGroup && ! $ this -> prefixMenu ) { $ this -> data ->... | Prefixes module name with section name keeping into account whether other higher - level prefixes have been applied |
4,728 | protected function addOrInjectGroupNamePrefix ( $ moduleId ) { $ module = $ this -> data -> rawData [ 'modules' ] [ $ moduleId ] ; $ prefix = $ module [ 'parent_names' ] [ 'group' ] ; $ this -> modulePrefixedGroup [ $ moduleId ] = true ; if ( ! $ this -> prefixMenu ) { $ this -> data -> rawData [ 'modules' ] [ $ module... | Prefixes module name with group name keeping into account whether other higher - level prefixes have been applied |
4,729 | protected function addOrInjectMenuNamePrefix ( $ moduleId ) { $ module = $ this -> data -> rawData [ 'modules' ] [ $ moduleId ] ; $ prefix = $ module [ 'parent_names' ] [ 'menu' ] ; $ this -> modulePrefixedMenu [ $ moduleId ] = true ; $ this -> data -> rawData [ 'modules' ] [ $ moduleId ] [ 'prefixed_name' ] = $ this -... | Prefixes module name with menu name keeping into account whether other higher - level prefixes have been applied |
4,730 | protected function addModuleIdPostFix ( $ moduleId ) { $ this -> data -> rawData [ 'modules' ] [ $ moduleId ] [ 'prefixed_name' ] = null ; $ this -> prefixModuleName ( $ moduleId ) ; $ module = $ this -> data -> rawData [ 'modules' ] [ $ moduleId ] ; $ this -> data -> rawData [ 'modules' ] [ $ moduleId ] [ 'prefixed_na... | Postfixes the module name with the module ID as a last resort to making a unique module name . |
4,731 | function getKeysForDuplicates ( array $ array ) { $ duplicates = $ newArray = [ ] ; foreach ( $ array as $ key => $ value ) { if ( ! isset ( $ newArray [ $ value ] ) ) { $ newArray [ $ value ] = $ key ; continue ; } if ( isset ( $ duplicates [ $ value ] ) ) { $ duplicates [ $ value ] [ ] = $ key ; } else { $ duplicates... | Returns the keys for values that occur more than once in an array |
4,732 | public function getPageUrl ( $ page ) { $ qs = '' ; if ( $ _SERVER [ 'QUERY_STRING' ] ) { $ qs = '?' . $ _SERVER [ 'QUERY_STRING' ] ; } return str_replace ( $ this -> fromFormat ( $ this -> currentPage ) , $ this -> fromFormat ( $ page ) , $ this -> uri ) . $ qs ; } | Get the url for a specified page number . |
4,733 | public function getPrevUrls ( $ floor = null ) { if ( $ floor ) { $ floor = $ this -> currentPage - $ floor ; } else { $ floor = 1 ; } return $ this -> getRangeUrls ( $ floor , $ this -> currentPage - 1 ) ; } | Get paginated urls that come before the current page . |
4,734 | public function getNextUrls ( $ max = null ) { if ( $ max ) { $ max = $ this -> currentPage + $ max ; } else { $ max = $ this -> totalPages ; } return $ this -> getRangeUrls ( $ this -> currentPage + 1 , $ max ) ; } | Get paginated urls that come after the current page . |
4,735 | public function getEasyMarkup ( ) { $ markup = '' ; if ( $ this -> prevUrl ) { $ markup .= "<li class='pagination-previous' title='View previous page'><a href='{$this->prevUrl}'>prev</a></li>" ; } $ pages = $ this -> getPrevUrls ( 5 ) ; foreach ( $ pages as $ i => $ page ) { $ markup .= "<li><a href='{$page}' title='Vi... | Get a simple markup for a pagination feed . |
4,736 | public function process ( $ identifier , \ Controller $ controller , $ result = null ) { if ( $ this -> hasProcessor ( $ identifier ) ) { return $ this -> processors [ $ identifier ] -> process ( $ controller , $ result ) ; } else { return false ; } } | Process an output processor by identifier if it exists |
4,737 | protected function getFulfillmentMethodsByType ( $ type ) { if ( ! $ this -> fulfillmentMethodsByType ) { $ this -> loadFulfillmentMethods ( ) ; } return $ this -> fulfillmentMethodsByType -> get ( $ type ) ; } | Retrieve a collection of fulfillment methods by type eg . give back all fulfillment methods for type shipment |
4,738 | protected function loadFulfillmentMethods ( ) { $ this -> fulfillmentMethodsByType = new ArrayCollection ( ) ; foreach ( $ this -> configuration as $ type => $ configurationFulfillmentMethods ) { foreach ( $ configurationFulfillmentMethods as $ configurationFulfillmentMethod ) { if ( array_key_exists ( 'class' , $ conf... | Load fulfillment methods from the configuration |
4,739 | public function unserialize ( $ serialized ) { $ unserialized = unserialize ( $ serialized ) ; $ this -> amount = $ unserialized [ 'amount' ] ; $ this -> currency = unserialize ( $ unserialized [ 'currency' ] ) ; } | Unserializing Money value object |
4,740 | public function multiply ( $ operand , $ roundingMode = self :: ROUND_HALF_UP , $ useGaapPrecision = false ) { $ this -> assertOperand ( $ operand ) ; $ validatedOperand = $ this -> normalizeOperand ( $ operand ) ; if ( $ useGaapPrecision ) { $ amount = Math :: bcround ( bcmul ( $ this -> amount , $ validatedOperand , ... | Multiplying compatible with Verraes Money To use GAAP precision rounding pass true as third argument |
4,741 | public function divide ( $ operand , $ roundingMode = self :: ROUND_HALF_UP , $ useGaapPrecision = false ) { $ this -> assertOperand ( $ operand , true ) ; $ validatedOperand = $ this -> normalizeOperand ( $ operand ) ; if ( $ useGaapPrecision ) { $ amount = Math :: bcround ( bcdiv ( $ this -> amount , $ validatedOpera... | Division compatible with Verraes Money To use GAAP precision rounding pass true as third argument |
4,742 | public function allocate ( array $ ratios , $ useGaapPrecision = false ) { $ useGaapPrecision ? $ precision = self :: GAAP_PRECISION : $ precision = self :: BASIC_PRECISION ; $ remainder = $ this -> amount ; $ results = [ ] ; $ total = array_sum ( $ ratios ) ; foreach ( $ ratios as $ ratio ) { $ share = bcdiv ( bcmul (... | Allocate the money according to a list of ratio s Allocation is compatible with Verraes Money To use GAAP precision rounding pass true as second argument |
4,743 | public function bulkUpdate ( $ values ) { foreach ( $ values as $ property => $ value ) { $ this -> update ( $ property , $ value ) ; } return $ this ; } | Updates the object with multiple values |
4,744 | public function update ( $ using = 'hex' , $ value = false ) { if ( 'hex' == $ using || 'alpha' == $ using ) { $ this -> $ using = $ value ; } $ this -> hex = $ this -> formats -> update ( $ using , $ value , $ this -> hex ) ; return $ this ; } | Updates the object with a value |
4,745 | public function fetch ( ) { $ data = Base :: query ( 'bf2cc si' ) ; $ spl = explode ( "\t" , $ data ) ; $ result = array ( 'name' => $ spl [ 7 ] , 'map' => $ spl [ 5 ] , 'playersCurrent' => $ spl [ 3 ] , 'playersMax' => $ spl [ 2 ] , 'playersJoining' => $ spl [ 4 ] , 'tickets' => array ( $ spl [ 10 ] - $ spl [ 11 ] , $... | Fetches Server Info |
4,746 | public function validator ( $ type , $ validator ) { $ this -> validators [ $ type ] = $ validator ; $ this -> resolver ( $ type , function ( $ data , $ resourceId ) use ( $ type ) { $ validators = Arr :: wrap ( $ this -> validators [ $ type ] ) ; foreach ( $ validators as $ validator ) { $ data [ 'id' ] = $ resourceId... | Add a validator to be ran when the type is found . |
4,747 | public function validate ( array $ input ) { $ result = $ this -> parse ( $ input ) ; if ( $ result === null ) { throw new InvalidJsonException ( 'Parser was unable to process the JSON due to there not being a data key.' ) ; } if ( count ( $ this -> seenTypes ) > 0 ) { array_walk ( $ this -> presenceCheckers , function... | Validate input . |
4,748 | public static function register ( $ code , $ frequency , $ callback , array $ args = array ( ) ) { if ( ! is_callable ( $ callback ) ) { throw new \ RuntimeException ( 'The callback must be callable' ) ; } $ instance = self :: getInstance ( ) ; $ cronRegistry = $ instance -> getCronRegistry ( ) ; $ cronRegistry [ $ cod... | register a cron job |
4,749 | public function jsonResponse ( ) { $ user = Auth :: getUser ( ) ; $ ssoUser = new SSOUser ( ) ; $ ssoUser -> id = $ user -> id ; $ ssoUser -> name = $ user -> username ; $ ssoUser -> email = $ user -> email ; $ ssoUser -> roles = $ user -> roles ; $ ssoUser -> profilepicture = "" ; $ userInfo = $ ssoUser -> toArray ( )... | Produces jsonResponse . |
4,750 | public static function create ( $ class , EntityManager $ entityManager ) { $ rc = new \ ReflectionClass ( $ class ) ; $ interface = 'Blast\CoreBundle\CodeGenerator\CodeGeneratorInterface' ; if ( ! $ rc -> implementsInterface ( $ interface ) ) { throw new \ RuntimeException ( "Class $class should implement $interface" ... | Creates an entity code generator service . |
4,751 | public function pathPart ( $ i ) { if ( isset ( $ this -> pathParts [ $ i ] ) ) { return $ this -> pathParts [ $ i ] ; } return null ; } | Get a part of the path by index . |
4,752 | public static function images ( $ file = null , $ secure = false ) { return asset ( self :: appendToPath ( config ( 'pxlcms.paths.images' ) , $ file ) , $ secure ) ; } | External path to CMS images |
4,753 | public static function imagesInternal ( $ file = null ) { return base_path ( self :: appendToPath ( self :: appendToPath ( config ( 'pxlcms.paths.base_internal' ) , config ( 'pxlcms.paths.images' ) ) , $ file ) ) ; } | Internal path to CMS images |
4,754 | protected static function appendToPath ( $ path , $ file ) { if ( empty ( $ file ) ) return $ path ; return rtrim ( $ path , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR . $ file ; } | Append a subpath or file to a path |
4,755 | public static function get ( $ arr , $ key , $ default = null ) { return self :: exists ( $ arr , $ key ) ? $ arr [ $ key ] : $ default ; } | Return the value of a key or a default value . |
4,756 | public static function exists ( $ arr , $ key ) { if ( is_object ( $ arr ) ) { return $ arr -> offsetExists ( $ key ) ; } if ( is_array ( $ arr ) ) { return array_key_exists ( $ key , $ arr ) ; } return false ; } | Determines whether an array contains a certain key . |
4,757 | public static function pluck ( $ arr , $ path ) { $ ret = [ ] ; $ path = ( array ) $ path ; foreach ( $ arr as $ v ) { $ node = & $ v ; $ ok = true ; foreach ( $ path as $ part ) { if ( ! is_array ( $ node ) || ! array_key_exists ( $ part , $ node ) ) { $ ok = false ; break ; } $ node = & $ node [ $ part ] ; } if ( $ o... | Extract values from an array with the given path . |
4,758 | public function Charset ( ) { return ( $ this -> owner -> config ( ) -> Charset ) ? $ this -> owner -> config ( ) -> Charset : self :: $ Charset ; } | Character set . |
4,759 | public function getTitleFields ( ) { return array ( LabelField :: create ( 'FaviconDescription' , 'A title tag is the main text that describes an online document. Title elements have long been considered one of the most important on-page SEO elements (the most important being overall content), and appear in three key p... | Gets the title fields . |
4,760 | public function load ( ) { $ this -> checkSource ( ) ; $ this -> spammers = $ this -> cacheSpammers ( function ( ) { return SpammerCollection :: load ( file ( $ this -> source , FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ) ) ; } ) ; return $ this ; } | Load spammers . |
4,761 | public function isBlocked ( $ host ) { $ host = parse_url ( $ host , PHP_URL_HOST ) ; $ host = utf8_encode ( trim ( $ host ) ) ; if ( empty ( $ host ) ) return false ; $ fullDomain = $ this -> getFullDomain ( $ host ) ; $ rootDomain = $ this -> getRootDomain ( $ fullDomain ) ; return $ this -> spammers ( ) -> whereHost... | Check if the given host is blocked . |
4,762 | private function getRootDomain ( $ domain ) { $ domainParts = explode ( '.' , $ domain ) ; $ count = count ( $ domainParts ) ; return $ count > 1 ? $ domainParts [ $ count - 2 ] . '.' . $ domainParts [ $ count - 1 ] : $ domainParts [ 0 ] ; } | Get the root domain . |
4,763 | private function cacheSpammers ( Closure $ callback ) { return cache ( ) -> remember ( $ this -> cacheKey , $ this -> cacheExpires , $ callback ) ; } | Cache the spammers . |
4,764 | public static function create ( User $ user , string $ salt ) : self { return new self ( md5 ( $ salt . serialize ( [ $ user -> name ( ) , $ user -> firstName ( ) , $ user -> lastName ( ) , $ user -> mailAddress ( ) , self :: createRandomContent ( ) ] ) ) ) ; } | creates token for given user |
4,765 | public function process ( RequestInterface $ request , ResponseInterface $ response , DelegateInterface $ next = null ) { $ response = $ this -> before ( $ request , $ response ) ; if ( $ next ) { $ response = $ next -> next ( $ request , $ response ) ; } return $ this -> after ( $ request , $ response ) ; } | Make process logic clear ! |
4,766 | protected function createProcessBuilder ( array $ arguments = array ( ) ) { $ pb = new Process ( implode ( ' ' , $ arguments ) ) ; if ( null !== $ this -> timeout ) { $ pb -> setTimeout ( $ this -> timeout ) ; } return $ pb ; } | Creates a new process builder . |
4,767 | protected function setPrefix ( $ prefix ) { if ( is_string ( $ prefix ) ) { $ this -> prefix = $ prefix ; return $ this ; } else { throw new \ InvalidArgumentException ( "Invalid type '" . gettype ( $ prefix ) . "' for argument 'prefix' given." ) ; } } | Sets the namespace prefix . |
4,768 | protected function parseRuleString ( $ ruleString ) { if ( is_string ( $ ruleString ) ) { $ charset = $ this -> getCharset ( ) ; $ ruleString = preg_replace ( '/^[ \r\n\t\f]*@namespace[ \r\n\t\f]+/i' , '' , $ ruleString ) ; $ ruleString = trim ( $ ruleString , " \r\n\t\f" ) ; $ ruleString = rtrim ( $ ruleString , ";" )... | Parses the namespace rule . |
4,769 | public function duplicate ( ) { $ this -> isNewRecord = true ; foreach ( $ this -> primaryKey ( ) as $ key ) { $ this -> $ key = null ; } if ( $ this -> save ( ) ) { return $ this ; } return null ; } | Duplicate entries in the table . |
4,770 | private function setDefaultPreferredProfileAdapters ( $ flags , $ options ) { $ this -> preferredProfilerAdapters = array ( new ProfilerAdapter \ UprofilerAdapter ( $ flags , $ options ) , new ProfilerAdapter \ XhprofAdapter ( $ flags , $ options ) , new ProfilerAdapter \ NullAdapter ( $ flags , $ options ) , ) ; } | Sets default preferred profile adapters |
4,771 | private function addInternalIgnoreFunctions ( $ options ) { if ( isset ( $ options [ 'ignored_functions' ] ) === false ) { $ options [ 'ignored_functions' ] = array ( ) ; } $ options [ 'ignored_functions' ] = array_merge ( $ options [ 'ignored_functions' ] , array ( 'xhprof_disable' , 'Link0\Profiler\ProfilerAdapter\Xh... | Adds internal methods for ignored_functions |
4,772 | public function stop ( ) { $ profile = $ this -> getProfileFactory ( ) -> create ( $ this -> getProfilerAdapter ( ) -> stop ( ) , $ this -> getApplicationData ( ) , $ _SERVER ) ; $ this -> getPersistenceService ( ) -> persist ( $ profile ) ; return $ profile ; } | Stops profiling and persists and returns the Profile object |
4,773 | public function build ( ) { if ( $ this -> updateRequired ) { $ this -> updateRequired = false ; foreach ( $ this -> nodes as $ node ) { if ( $ node -> parent ( ) ) { $ node -> unlock ( ) -> detach ( ) ; } } $ this -> root -> addChildren ( $ this -> builder -> build ( $ this -> hierarchy , $ this -> nodes -> toArray ( ... | Builds tree based on its nodes registry and hierarchy configuration if structure update required . |
4,774 | public function replace ( $ nodeName , ChildNodeInterface $ node ) { $ this -> removeNodeFromList ( $ nodeName ) ; $ this -> nodes -> set ( $ nodeName , $ node ) ; $ this -> updateRequired = true ; return $ this ; } | Replaces named tree node to new one . |
4,775 | public function addMany ( $ parentName , array $ namedItems , $ prepend = false ) { foreach ( $ namedItems as $ name => $ item ) { $ this -> add ( $ parentName , $ name , $ item , $ prepend ) ; } return $ this ; } | Adds multiple nodes to tree . |
4,776 | public function move ( $ nodeName , $ newParentName , $ prepend = false ) { if ( ! $ this -> nodes -> hasKey ( $ nodeName ) ) { throw new NodeNotFoundException ( ) ; } $ node = $ this -> nodes -> get ( $ nodeName ) ; $ this -> remove ( $ nodeName ) ; $ this -> add ( $ newParentName , $ nodeName , $ node , $ prepend ) ;... | Moves node to another parent . |
4,777 | public function remove ( $ nodeName ) { $ children = self :: removeTreeNode ( $ this -> hierarchy , $ nodeName ) ; $ this -> removeNodeFromList ( $ nodeName ) ; $ this -> updateRequired = true ; return $ this ; } | Removes node by its name . |
4,778 | protected function add ( $ parentName = null , $ nodeName , ChildNodeInterface $ node , $ prepend = false ) { if ( ! self :: addTreeNode ( $ this -> hierarchy , $ parentName , $ nodeName , $ prepend ) ) { throw new NodeNotFoundException ( "Can't add '$nodeName' node to '$parentName': '$parentName' node not found." ) ; ... | Adds new tree node . If node exists replaces it . |
4,779 | public static function abs ( $ int ) { if ( ! static :: is ( $ int ) ) { throw new \ InvalidArgumentException ( "The \$int parameter must be of type int (or string representing a big int)." ) ; } if ( Int :: is ( $ int ) ) { return Int :: abs ( $ int ) ; } else { return Str :: replace ( $ int , '-' , '' ) ; } } | Gets the absolute value of the given integer . |
4,780 | protected function validator ( $ varInput ) { if ( is_array ( $ varInput ) ) { return parent :: validator ( $ varInput ) ; } $ varInput = \ Idna :: encodeUrl ( $ varInput ) ; return parent :: validator ( trim ( $ varInput ) ) ; } | Trim the values |
4,781 | private function getRepository ( ) { $ c = $ this -> repository ; if ( $ c instanceof \ Closure ) { $ this -> repository = $ c ( ) ; } return $ this -> repository ; } | Return the wrapped PHPCR Repository |
4,782 | public function getQuery ( ) { $ queryParts = array_map ( function ( $ value ) { return ( $ value instanceof Operator ) ? $ value -> expression ( ) : $ value ; } , $ this -> queryParts ) ; return implode ( '' , $ queryParts ) ; } | builds the query and returns it as a string |
4,783 | public function getDateTimePickerOptions ( ) { if ( ! isset ( $ this -> dateTimePickerOptions [ 'language' ] ) ) $ this -> dateTimePickerOptions [ 'language' ] = config ( 'app.locale' ) ; $ available = [ 'en' , 'pl' , 'sv' , 'de' ] ; $ this -> dateTimePickerOptions [ 'language' ] = in_array ( $ this -> dateTimePickerOp... | Gets the Model datetimepickerOptions . |
4,784 | public function setDateTimePickerOptions ( $ attr , $ option = null ) { $ options = is_array ( $ attr ) ? $ attr : [ $ attr => $ option ] ; foreach ( $ options as $ key => $ value ) $ this -> dateTimePickerOptions [ $ key ] = $ value ; return $ this ; } | Sets the Model datetimepickerOptions . |
4,785 | public static function difference ( int $ stamp1 , int $ stamp2 = null ) : int { if ( ! is_int ( $ stamp2 ) ) { $ stamp2 = time ( ) ; } return $ stamp2 > $ stamp1 ? $ stamp2 - $ stamp1 : $ stamp1 - $ stamp2 ; } | Number of seconds elapsed between 2 timestamps |
4,786 | public function toString ( ) { if ( ! $ this -> getPath ( ) ) { return '' ; } $ path = preg_replace ( '/^\\\/' , '' , $ this -> getPath ( ) ) ; $ namespace = $ this -> getDocBlock ( ) -> setTabulation ( $ this -> getTabulation ( ) ) -> toString ( ) . $ this -> getTabulationFormatted ( ) . 'namespace ' . $ path . ';' . ... | Parse the namespace string ; |
4,787 | public function process ( array $ statementlist , SymbolTable $ table = null ) { if ( is_null ( $ table ) ) { $ table = new SymbolTable ; } $ statementlist = $ this -> optimize ( $ statementlist ) ; $ results = [ ] ; foreach ( $ statementlist as $ statement ) { $ results = array_merge ( $ results , ( array ) $ statemen... | Main entrypoint . |
4,788 | public function checkValue ( & $ value ) { if ( parent :: checkValue ( $ value ) ) { $ value = trim ( $ value , " \r\n\t\f;" ) ; if ( strpos ( $ value , "!" ) !== false ) { $ charset = $ this -> getStyleSheet ( ) -> getCharset ( ) ; if ( mb_strtolower ( mb_substr ( $ value , - 10 , null , $ charset ) , $ charset ) === ... | Checks the value . |
4,789 | public function setIsImportant ( $ isImportant ) { if ( is_bool ( $ isImportant ) ) { $ this -> isImportant = $ isImportant ; } else { throw new \ InvalidArgumentException ( "Invalid type '" . gettype ( $ isImportant ) . "' for argument 'isImportant' given." ) ; } } | Sets the importance status of the declaration . |
4,790 | public function postAction ( Request $ request ) { try { $ data = $ request -> request -> all ( ) ; $ this -> validatePostData ( $ data ) ; $ locale = $ this -> getLocale ( $ request ) ; $ price = $ this -> getPriceCalculationManager ( ) -> retrieveItemPrices ( $ data [ 'items' ] , $ data [ 'currency' ] , $ locale ) ; ... | Calculates total prices of all given items . |
4,791 | private function validatePostData ( $ data ) { $ required = [ 'items' , 'currency' ] ; foreach ( $ required as $ field ) { if ( ! isset ( $ data [ $ field ] ) && ! is_null ( $ data [ $ field ] ) ) { throw new PriceCalculationException ( $ field . ' is required but not set properly' ) ; } } } | Checks if all necessary data for post request is set . |
4,792 | protected function compile ( ) { $ attributes = new Attributes ( ) ; $ this -> setLinkTitle ( $ attributes ) ; $ this -> setHref ( $ attributes ) ; $ this -> setCssClass ( $ attributes ) ; $ this -> enableLightbox ( $ attributes ) ; $ this -> setDataAttributes ( $ attributes ) ; if ( $ this -> target ) { $ attributes -... | Compile button element inspired by ContentHyperlink . |
4,793 | protected function setLinkTitle ( Attributes $ attributes ) { if ( $ this -> linkTitle == '' ) { $ this -> linkTitle = $ this -> url ; } if ( TL_MODE !== 'BE' ) { $ attributes -> setAttribute ( 'title' , $ this -> titleText ? : $ this -> linkTitle ) ; } } | Set title link . |
4,794 | protected function setHref ( Attributes $ attributes ) { if ( substr ( $ this -> url , 0 , 7 ) == 'mailto:' ) { if ( version_compare ( VERSION . '.' . BUILD , '3.5.5' , '>=' ) ) { $ url = \ StringUtil :: encodeEmail ( $ this -> url ) ; } else { $ url = \ String :: encodeEmail ( $ this -> url ) ; } $ attributes -> setAt... | Set Link href . |
4,795 | protected function setCssClass ( Attributes $ attributes ) { $ attributes -> addClass ( 'btn' ) ; if ( $ this -> cssID [ 1 ] == '' ) { $ attributes -> addClass ( 'btn-default' ) ; } else { $ attributes -> addClass ( $ this -> cssID [ 1 ] ) ; } } | Set css classes . |
4,796 | protected function enableLightbox ( Attributes $ attributes ) { if ( ! $ this -> rel ) { return ; } if ( strncmp ( $ this -> rel , 'lightbox' , 8 ) !== 0 ) { $ attributes -> setAttribute ( 'rel' , $ this -> rel ) ; } else { $ attributes -> setAttribute ( 'data-lightbox' , substr ( $ this -> rel , 9 , - 1 ) ) ; } } | Enable lightbox . |
4,797 | protected function setDataAttributes ( Attributes $ attributes ) { $ this -> bootstrap_dataAttributes = deserialize ( $ this -> bootstrap_dataAttributes , true ) ; if ( empty ( $ this -> bootstrap_dataAttributes ) ) { return ; } foreach ( $ this -> bootstrap_dataAttributes as $ attribute ) { if ( trim ( $ attribute [ '... | Set data attributes . |
4,798 | public static function setObjectACL ( $ key , $ bucket , $ acl = 'public-read' ) { $ s3c = self :: getS3C ( ) ; if ( $ s3c -> doesObjectExist ( $ bucket , $ key ) ) { $ result = $ s3c -> putObjectAcl ( array ( 'ACL' => $ acl , 'Bucket' => $ bucket , 'Key' => $ key , ) ) ; if ( $ result ) { return true ; } } return fals... | setObjectACL Change the access level of an object on S3 . |
4,799 | public function getString ( $ value ) { if ( $ this -> startsWith ( $ value , '\'' ) && $ this -> endsWith ( $ value , '\'' ) ) { return ltrim ( rtrim ( $ value , '\'' ) , '\'' ) ; } if ( $ this -> startsWith ( $ value , '"' ) && $ this -> endsWith ( $ value , '"' ) ) { return ltrim ( rtrim ( $ value , '"' ) , '"' ) ; ... | Removes or from string |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.