idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
20,700 | protected function configureMetadataConfiguration ( Configuration $ configuration , array $ doctrineConfig ) { if ( isset ( $ doctrineConfig [ 'filters' ] ) ) { foreach ( $ doctrineConfig [ 'filters' ] as $ name => $ filter ) { $ configuration -> addFilter ( $ name , $ filter [ 'class' ] ) ; } } if ( isset ( $ doctrine... | Configures the metadata configuration instance . |
20,701 | protected function configureEventManager ( array $ doctrineConfig , EventManager $ eventManager ) { if ( isset ( $ doctrineConfig [ 'event_listeners' ] ) ) { foreach ( $ doctrineConfig [ 'event_listeners' ] as $ name => $ listener ) { $ eventManager -> addEventListener ( $ listener [ 'events' ] , new $ listener [ 'clas... | Configures the Doctrine event manager instance . |
20,702 | protected function configureEntityManager ( array $ doctrineConfig , EntityManager $ entityManager ) { if ( isset ( $ doctrineConfig [ 'filters' ] ) ) { foreach ( $ doctrineConfig [ 'filters' ] as $ name => $ filter ) { if ( ! array_get ( $ filter , 'enabled' , false ) ) { continue ; } $ entityManager -> getFilters ( )... | Configures the Doctrine entity manager instance . |
20,703 | protected static function keyToMethodName ( $ keyName , $ capitalizeFirstCharacter = false ) { $ str = str_replace ( ' ' , '' , ucwords ( str_replace ( '_' , ' ' , $ keyName ) ) ) ; if ( ! $ capitalizeFirstCharacter ) { $ str = lcfirst ( $ str ) ; } return $ str ; } | Convert some_variable_name to someVariableName |
20,704 | public function insideOf ( Annotation $ a = null ) { if ( $ a ) { $ this -> nested = $ a -> nested ; } return $ this ; } | Include sub - policy list from the existing policy |
20,705 | public static function parseData ( $ data ) { $ parsed = array ( ) ; foreach ( explode ( ' ' , $ data ) as $ pair ) { if ( strpos ( $ pair , ':' ) > 0 ) { list ( $ key , $ value ) = array_map ( 'trim' , explode ( ':' , $ pair ) ) ; $ parsed [ $ key ] = $ value ; } } return $ parsed ; } | Parse a colon and space separated string into an array |
20,706 | public function merge ( array $ policies ) { $ last = reset ( $ policies ) ; for ( $ i = 1 ; $ i < count ( $ policies ) ; ++ $ i ) { if ( $ policies [ $ i ] -> isPriorityGreaterThanOrEqualTo ( $ last ) ) { $ last = $ policies [ $ i ] ; } } return $ last ; } | Merges property list into priority one and returns it |
20,707 | public function track ( array $ data ) { $ model = $ this -> getModel ( ) -> fill ( $ data ) ; $ model -> save ( ) ; return $ model -> getKey ( ) ; } | Track the visitor activity . |
20,708 | private function trackRoute ( Route $ route ) { return $ this -> getModel ( ) -> newQuery ( ) -> firstOrCreate ( [ 'name' => $ this -> getRouteName ( $ route ) , 'action' => $ route -> getActionName ( ) , ] ) -> getKey ( ) ; } | Track the current route . |
20,709 | private function checkPatterns ( $ value , array $ patterns ) { foreach ( $ patterns as $ pattern ) { if ( Str :: is ( $ pattern , $ value ) ) return true ; } return false ; } | Check if the value match the given patterns . |
20,710 | private function trackRoutePath ( Route $ route , Request $ request , $ routeId ) { $ model = $ this -> makeModel ( BindingManager :: MODEL_ROUTE_PATH ) -> firstOrCreate ( [ 'route_id' => $ routeId , 'path' => $ request -> path ( ) , ] ) ; if ( $ model -> wasRecentlyCreated ) $ this -> trackRoutePathParameters ( $ rout... | Track the route path . |
20,711 | private function trackRoutePathParameters ( Route $ route , Models \ RoutePath $ routePath ) { $ parameters = [ ] ; if ( $ route -> hasParameters ( ) ) { foreach ( $ route -> parameters ( ) as $ parameter => $ value ) { $ parameters [ ] = $ this -> makeModel ( BindingManager :: MODEL_ROUTE_PATH_PARAMETER ) -> fill ( [ ... | Track the route path parameters . |
20,712 | private function checkIfValueIsEloquentModel ( $ value ) { if ( $ value instanceof EloquentModel ) { foreach ( $ this -> getConfig ( 'routes.model-columns' , [ 'id' ] ) as $ column ) { if ( array_key_exists ( $ column , $ attributes = $ value -> getAttributes ( ) ) && ! is_null ( $ attributes [ $ column ] ) ) { return ... | Check if the value is an eloquent model . |
20,713 | private function instantiateAuthentication ( ) { foreach ( ( array ) $ this -> getConfig ( 'auth.bindings' , [ ] ) as $ binding ) { $ this -> auths [ ] = $ this -> make ( $ binding ) ; } } | Grab all the authentication bindings . |
20,714 | private function executeAuthMethod ( $ method ) { foreach ( $ this -> auths as $ auth ) { if ( is_callable ( [ $ auth , $ method ] , true ) ) { if ( $ data = $ auth -> { $ method } ( ) ) return $ data ; } } return false ; } | Execute the auth method . |
20,715 | public function roleAddSubject ( Role $ role , SubjectInterface $ subject ) { if ( $ this -> roleAddSubjectId ( $ role , $ subject -> id ( ) ) ) { $ users_role_set = $ subject -> getRoleSet ( ) ; $ users_role_set -> addRole ( $ role ) ; $ subject -> loadRoleSet ( $ users_role_set ) ; return true ; } else { return false... | Add a user to an existing role . This will insert the added role into the users active RoleSet instance upon successful insertion into the database |
20,716 | public function loadSubjectRoles ( SubjectInterface $ subject , $ permissions = true ) { $ role_set = new RoleSet ( $ this -> roleFetchSubjectRoles ( $ subject , $ permissions ) ) ; $ subject -> loadRoleSet ( $ role_set ) ; return $ subject ; } | Load a user instance with its corresponding RoleSet |
20,717 | public function roleFetchSubjectRoles ( SubjectInterface $ subject , $ permissions = true ) { $ roles = $ this -> storage -> roleFetchSubjectRoles ( $ subject , $ permissions ) ; if ( $ permissions ) { $ this -> roleLoadPermissions ( $ roles ) ; } return $ roles ; } | Fetch the roles that are associated with the user instance passed in . |
20,718 | public function roleLoadPermissions ( $ roles ) { if ( ! $ roles ) { return false ; } $ multi = is_array ( $ roles ) ; if ( ! $ multi ) { $ roles = [ $ roles ] ; } $ permissions_ids = [ ] ; foreach ( $ roles as $ role ) { if ( ! is_array ( $ role -> _permission_ids ) ) { $ role -> _permission_ids = explode ( ',' , $ ro... | Load the full permission set into the role instance |
20,719 | public function rolePermissionAdd ( Role $ role , Permission $ permission ) { return $ this -> storage -> rolePermissionAdd ( $ role , $ permission ) ; } | Add a permission to the provided role . |
20,720 | public function roleFetch ( $ permissions = true ) { $ roles = $ this -> storage -> roleFetch ( ) ; if ( $ roles and $ permissions ) { $ this -> roleLoadPermissions ( $ roles ) ; } return $ roles ; } | Fetch all currently defined roles from the database . |
20,721 | public function roleFetchByName ( $ role_name , $ permissions = true ) { $ role = $ this -> storage -> roleFetchByName ( $ role_name ) ; if ( $ role and $ permissions ) { $ this -> roleLoadPermissions ( $ role ) ; } return $ role ; } | Fetch a role from the database via its unique name . |
20,722 | public function hasPermission ( $ permission ) { if ( ! $ permission ) { return false ; } foreach ( $ this -> permissions as $ perm ) { if ( $ perm -> name == $ permission ) { return true ; } } return false ; } | Check if the role allows the permission being requested . |
20,723 | public function addPermission ( Permission $ permission ) { if ( ! $ permission -> permission_id ) { throw new ValidationError ( "Permission has invalid state" ) ; } if ( ! in_array ( $ permission , $ this -> permissions ) ) { $ this -> permissions [ ] = $ permission ; return true ; } return false ; } | Add a permission to the roles current permissions if it does not already exist |
20,724 | public static function create ( $ name , $ description = "" , $ permissions = [ ] ) { $ role = new self ( ) ; $ role -> name = $ name ; $ role -> description = $ description ; foreach ( $ permissions as $ permission ) { $ role -> addPermission ( $ permission ) ; } return $ role ; } | Generate a new Permission instance to be saved to the data store . |
20,725 | public function boot ( ) { Cache :: extend ( 'redis' , function ( $ app , $ config ) { $ store = new RedisStore ( $ app [ 'redis' ] , Arr :: get ( $ config , 'prefix' , $ this -> app [ 'config' ] [ 'cache.prefix' ] ) , Arr :: get ( $ config , 'connection' , 'default' ) ) ; $ repository = new Repository ( $ store ) ; if... | Register custom Redis cache driver . |
20,726 | public function handleError ( $ err_severity , $ err_msg , $ err_file , $ err_line , array $ err_context ) { try { $ this -> manager -> trackException ( ExceptionFactory :: make ( $ err_severity , $ err_msg ) ) ; } catch ( Exception $ e ) { } return call_user_func ( $ this -> originalErrorHandler , $ err_severity , $ e... | Handle the error . |
20,727 | public function parseUrl ( $ referer ) { if ( is_null ( $ referer ) ) return null ; $ parsed = parse_url ( $ referer ) ; $ parts = explode ( '.' , $ parsed [ 'host' ] ) ; $ domain = array_pop ( $ parts ) ; if ( count ( $ parts ) > 0 ) $ domain = array_pop ( $ parts ) . '.' . $ domain ; return [ 'url' => $ referer , 'do... | Parse the referer url . |
20,728 | public function open ( array $ options = array ( ) , $ rules = null ) { $ this -> setValidation ( $ rules ) ; return parent :: open ( $ options ) ; } | Opens form set rules |
20,729 | protected function convertRule ( $ rule , $ attribute , $ type ) { $ parsedRule = $ this -> parseValidationRule ( $ rule ) ; $ jqueryAttrs = [ ] ; $ ruleMethodName = $ this -> getRuleMethodName ( $ parsedRule [ 'name' ] ) ; if ( ! method_exists ( $ this , $ ruleMethodName ) ) { return $ jqueryAttrs ; } $ jqueryAttrs = ... | Converts laravel rules to jquery validation rules |
20,730 | protected function getErrorMessage ( $ laravelRule , $ attribute ) { $ attribute = $ this -> getAttributeName ( $ attribute ) ; $ message = Lang :: get ( 'validation.' . $ laravelRule , [ 'attribute' => $ attribute ] ) ; return [ 'data-msg-' . $ laravelRule => $ message ] ; } | Sets error message |
20,731 | protected function getType ( $ rules ) { foreach ( $ rules as $ key => $ rule ) { $ parsedRule = $ this -> parseValidationRule ( $ rule ) ; if ( in_array ( $ parsedRule [ 'name' ] , $ this -> numericRules ) ) { return 'numeric' ; } } return 'string' ; } | Get all rules and return type of input if rule specifies type Now just for numeric |
20,732 | protected function parseValidationRule ( $ rule ) { $ ruleArray = [ 'name' => '' , 'parameters' => [ ] ] ; $ explodedRule = explode ( ':' , $ rule ) ; $ ruleArray [ 'name' ] = array_shift ( $ explodedRule ) ; $ ruleArray [ 'parameters' ] = explode ( ',' , array_shift ( $ explodedRule ) ) ; return $ ruleArray ; } | Parses validition rule of laravel |
20,733 | protected function _convertMessageIp ( $ parsedRule , $ attribute , $ type ) { $ message = Lang :: get ( 'validation.' . $ parsedRule [ 'name' ] , [ 'attribute' => $ attribute ] ) ; return [ 'data-msg-ipv4' => $ message ] ; } | Message convertions which returns attributes as an array |
20,734 | private function setRequest ( Request $ request ) { $ this -> mergeVisitorActivityData ( [ 'method' => $ request -> method ( ) , 'is_ajax' => $ request -> ajax ( ) , 'is_secure' => $ request -> isSecure ( ) , 'is_json' => $ request -> isJson ( ) , 'wants_json' => $ request -> wantsJson ( ) , ] ) ; $ this -> request = $... | Set the request . |
20,735 | public function trackRequest ( Request $ request ) { if ( $ this -> isEnabled ( ) ) { $ this -> setRequest ( $ request ) ; $ this -> mergeVisitorActivityData ( [ 'visitor_id' => $ this -> getVisitorId ( ) , 'path_id' => $ this -> getPathId ( ) , 'query_id' => $ this -> getQueryId ( ) , 'referer_id' => $ this -> getRefe... | Start the tracking . |
20,736 | private function trackIfEnabled ( $ key , \ Closure $ callback , $ default = null ) { return $ this -> isEnabled ( ) ? ( $ this -> getConfig ( "tracking.$key" , false ) ? $ callback ( ) : $ default ) : $ default ; } | Track the trackable if enabled . |
20,737 | private function getVisitorId ( ) { $ tracker = $ this -> getVisitorTracker ( ) ; $ data = $ tracker -> checkData ( $ this -> visitorData , [ 'user_id' => $ this -> getUserId ( ) , 'device_id' => $ this -> getDeviceId ( ) , 'client_ip' => $ this -> request -> getClientIp ( ) , 'geoip_id' => $ this -> getGeoIpId ( ) , '... | Get the stored visitor id . |
20,738 | private function getRefererId ( ) { return $ this -> trackIfEnabled ( 'referers' , function ( ) { return $ this -> getRefererTracker ( ) -> track ( $ this -> request -> headers -> get ( 'referer' ) , $ this -> request -> url ( ) ) ; } ) ; } | Get the tracked referer id . |
20,739 | private function getCookieId ( ) { return $ this -> trackIfEnabled ( 'cookies' , function ( ) { return ! is_null ( $ name = $ this -> getConfig ( 'cookie.name' ) ) ? $ this -> getCookieTracker ( ) -> track ( $ this -> request -> cookie ( $ name ) ) : null ; } ) ; } | Get the tracked cookie id . |
20,740 | protected function buildClusterSeed ( $ server ) { $ parameters = [ ] ; foreach ( [ 'database' , 'timeout' , 'prefix' ] as $ parameter ) { if ( ! empty ( $ server [ $ parameter ] ) ) { $ parameters [ $ parameter ] = $ server [ $ parameter ] ; } } if ( ! empty ( $ server [ 'password' ] ) ) { $ parameters [ 'auth' ] = $ ... | Build a cluster seed string . |
20,741 | public function permissionFetchById ( $ permission_id ) { $ multi = is_array ( $ permission_id ) ; if ( ! $ multi ) { $ permission_id = [ $ permission_id ] ; } $ in_query = join ( ',' , $ permission_id ) ; $ query = " SELECT permission_id, `name`, description, added_on, updated_on F... | Fetch a permission by is ID returning false if it doesn t exist . |
20,742 | private function prepareData ( ) { $ parser = $ this -> getUserAgentParser ( ) ; return [ 'name' => $ parser -> getOriginalUserAgent ( ) ? : 'Other' , 'browser' => $ parser -> getBrowser ( ) , 'browser_version' => $ parser -> getUserAgentVersion ( ) , ] ; } | Prepare the data . |
20,743 | public function track ( Exception $ exception ) { return $ this -> getModel ( ) -> newQuery ( ) -> firstOrCreate ( [ 'code' => $ this -> getCode ( $ exception ) , 'message' => $ exception -> getMessage ( ) , ] ) -> getKey ( ) ; } | Track the exception error . |
20,744 | public function getCode ( Exception $ exception ) { if ( method_exists ( $ exception , 'getCode' ) && $ code = $ exception -> getCode ( ) ) return $ code ; if ( method_exists ( $ exception , 'getStatusCode' ) && $ code = $ exception -> getStatusCode ( ) ) return $ code ; return null ; } | Get the code from the exception . |
20,745 | public function displayRoutes ( ) { $ headers = [ 'Method' , 'URI' , 'Name' , 'Action' , 'Middleware' , 'Map To' ] ; $ this -> generateRoutes ( ) ; $ this -> applyFilters ( ) ; if ( ! $ this -> routes ) { $ this -> warn ( 'No routes found!' ) ; return false ; } $ str = '' ; if ( $ this -> option ( 'reverse' ) ) { rsort... | Display the routes in console |
20,746 | public function generateRoutes ( ) { $ routes = property_exists ( app ( ) , 'router' ) ? app ( ) -> router -> getRoutes ( ) : app ( ) -> getRoutes ( ) ; foreach ( $ routes as $ route ) { array_push ( $ this -> routes , [ 'method' => $ route [ 'method' ] , 'uri' => $ route [ 'uri' ] , 'name' => $ this -> getRouteName ( ... | Generate the formatted routes array |
20,747 | private function applyFilters ( ) { $ availableOptions = [ 'name' , 'method' , 'uri' , 'action' , 'middleware' ] ; foreach ( $ this -> options ( ) as $ key => $ option ) { if ( in_array ( $ key , $ availableOptions ) && null != $ option ) { foreach ( $ this -> routes as $ index => $ route ) { if ( ! str_contains ( strt... | Apply filters on routes if user provide |
20,748 | final public function handle ( RequestInterface $ request ) { $ processed = $ this -> processing ( $ request ) ; if ( $ processed === null ) { if ( $ this -> successor !== null ) { $ processed = $ this -> successor -> handle ( $ request ) ; } } return $ processed ; } | This approach by using a template method pattern ensures you that each subclass will not forget to call the successor |
20,749 | public function isSatisfiedBy ( Item $ item ) : bool { foreach ( $ this -> specifications as $ specification ) { if ( ! $ specification -> isSatisfiedBy ( $ item ) ) { return false ; } } return true ; } | if at least one specification is false return false else return true . |
20,750 | public function validateNewPassword ( array $ credentials ) { if ( isset ( $ this -> passwordValidator ) ) { [ $ password , $ confirm ] = [ $ credentials [ 'password' ] , $ credentials [ 'password_confirmation' ] , ] ; return call_user_func ( $ this -> passwordValidator , $ credentials ) && $ password === $ confirm ; }... | Determine if the passwords match for the request . |
20,751 | protected function validatePasswordWithDefaults ( array $ credentials ) { [ $ password , $ confirm ] = [ $ credentials [ 'password' ] , $ credentials [ 'password_confirmation' ] , ] ; return $ password === $ confirm && mb_strlen ( $ password ) >= 8 ; } | Determine if the passwords are valid for the request . |
20,752 | protected function wrapAliasedValue ( $ value , $ prefixAlias = false ) { $ segments = preg_split ( '/\s+as\s+/i' , $ value ) ; if ( $ prefixAlias ) { $ segments [ 1 ] = $ this -> tablePrefix . $ segments [ 1 ] ; } return $ this -> wrap ( $ segments [ 0 ] ) . ' as ' . $ this -> wrapValue ( $ segments [ 1 ] ) ; } | Wrap a value that has an alias . |
20,753 | protected function wrapSegments ( $ segments ) { return collect ( $ segments ) -> map ( function ( $ segment , $ key ) use ( $ segments ) { return $ key == 0 && count ( $ segments ) > 1 ? $ this -> wrapTable ( $ segment ) : $ this -> wrapValue ( $ segment ) ; } ) -> implode ( '.' ) ; } | Wrap the given value segments . |
20,754 | public function addMessages ( $ locale , $ group , array $ messages , $ namespace = null ) { $ namespace = $ namespace ? : '*' ; $ this -> messages [ $ namespace ] [ $ locale ] [ $ group ] = $ messages ; return $ this ; } | Add messages to the loader . |
20,755 | public function stack ( array $ channels , $ channel = null ) { return new Logger ( $ this -> createStackDriver ( compact ( 'channels' , 'channel' ) ) , $ this -> app [ 'events' ] ) ; } | Create a new on - demand aggregate logger instance . |
20,756 | protected function tap ( $ name , Logger $ logger ) { foreach ( $ this -> configurationFor ( $ name ) [ 'tap' ] ?? [ ] as $ tap ) { [ $ class , $ arguments ] = $ this -> parseTap ( $ tap ) ; $ this -> app -> make ( $ class ) -> __invoke ( $ logger , ... explode ( ',' , $ arguments ) ) ; } return $ logger ; } | Apply the configured taps for the logger . |
20,757 | protected function createCustomDriver ( array $ config ) { $ factory = is_callable ( $ via = $ config [ 'via' ] ) ? $ via : $ this -> app -> make ( $ via ) ; return $ factory ( $ config ) ; } | Create a custom log driver instance . |
20,758 | protected function createErrorlogDriver ( array $ config ) { return new Monolog ( $ this -> parseChannel ( $ config ) , [ $ this -> prepareHandler ( new ErrorLogHandler ( $ config [ 'type' ] ?? ErrorLogHandler :: OPERATING_SYSTEM , $ this -> level ( $ config ) ) ) , ] ) ; } | Create an instance of the error log log driver . |
20,759 | protected function prepareHandlers ( array $ handlers ) { foreach ( $ handlers as $ key => $ handler ) { $ handlers [ $ key ] = $ this -> prepareHandler ( $ handler ) ; } return $ handlers ; } | Prepare the handlers for usage by Monolog . |
20,760 | protected function prepareHandler ( HandlerInterface $ handler , array $ config = [ ] ) { if ( ! isset ( $ config [ 'formatter' ] ) ) { $ handler -> setFormatter ( $ this -> formatter ( ) ) ; } elseif ( $ config [ 'formatter' ] !== 'default' ) { $ handler -> setFormatter ( $ this -> app -> make ( $ config [ 'formatter'... | Prepare the handler for usage by Monolog . |
20,761 | public function resetTag ( $ name ) { $ this -> store -> forever ( $ this -> tagKey ( $ name ) , $ id = str_replace ( '.' , '' , uniqid ( '' , true ) ) ) ; return $ id ; } | Reset the tag and return the new tag identifier . |
20,762 | public function tagId ( $ name ) { return $ this -> store -> get ( $ this -> tagKey ( $ name ) ) ? : $ this -> resetTag ( $ name ) ; } | Get the unique tag identifier for a given tag . |
20,763 | public function getMany ( $ keys ) { $ config = [ ] ; foreach ( $ keys as $ key => $ default ) { if ( is_numeric ( $ key ) ) { [ $ key , $ default ] = [ $ default , null ] ; } $ config [ $ key ] = Arr :: get ( $ this -> items , $ key , $ default ) ; } return $ config ; } | Get many configuration values . |
20,764 | protected function compileJson ( $ expression ) { $ parts = explode ( ',' , $ this -> stripParentheses ( $ expression ) ) ; $ options = isset ( $ parts [ 1 ] ) ? trim ( $ parts [ 1 ] ) : $ this -> encodingOptions ; $ depth = isset ( $ parts [ 2 ] ) ? trim ( $ parts [ 2 ] ) : 512 ; return "<?php echo json_encode($parts[... | Compile the JSON statement into valid PHP . |
20,765 | protected function addRequestInformation ( & $ payload ) { if ( $ this -> container -> bound ( 'request' ) ) { $ payload = array_merge ( $ payload , [ 'ip_address' => $ this -> ipAddress ( ) , 'user_agent' => $ this -> userAgent ( ) , ] ) ; } return $ this ; } | Add the request information to the session payload . |
20,766 | protected function whereInMethod ( Model $ model , $ key ) { return $ model -> getKeyName ( ) === last ( explode ( '.' , $ key ) ) && $ model -> getIncrementing ( ) && in_array ( $ model -> getKeyType ( ) , [ 'int' , 'integer' ] ) ? 'whereIntegerInRaw' : 'whereIn' ; } | Get the name of the where in method for eager loading . |
20,767 | public static function morphMap ( array $ map = null , $ merge = true ) { $ map = static :: buildMorphMapFromModels ( $ map ) ; if ( is_array ( $ map ) ) { static :: $ morphMap = $ merge && static :: $ morphMap ? $ map + static :: $ morphMap : $ map ; } return static :: $ morphMap ; } | Set or get the morph map for polymorphic relations . |
20,768 | public function getColumnType ( $ table , $ column ) { $ table = $ this -> connection -> getTablePrefix ( ) . $ table ; return $ this -> connection -> getDoctrineColumn ( $ table , $ column ) -> getType ( ) -> getName ( ) ; } | Get the data type for the given column name . |
20,769 | public function registerCustomDoctrineType ( $ class , $ name , $ type ) { if ( ! $ this -> connection -> isDoctrineAvailable ( ) ) { throw new RuntimeException ( 'Registering a custom Doctrine type requires Doctrine DBAL (doctrine/dbal).' ) ; } if ( ! Type :: hasType ( $ name ) ) { Type :: addType ( $ name , $ class )... | Register a custom Doctrine mapping type . |
20,770 | public function count ( ) { if ( is_callable ( $ count = $ this -> count ) ) { $ this -> count = $ count ( ) ; } return $ this -> count ; } | Get the total number of tagged services . |
20,771 | public function withCookies ( array $ cookies ) { foreach ( $ cookies as $ cookie ) { $ this -> headers -> setCookie ( $ cookie ) ; } return $ this ; } | Add multiple cookies to the response . |
20,772 | protected function context ( ) { return collect ( $ this -> option ( ) ) -> only ( [ 'ansi' , 'no-ansi' , 'no-interaction' , 'quiet' , 'verbose' , ] ) -> filter ( ) -> mapWithKeys ( function ( $ value , $ key ) { return [ "--{$key}" => $ value ] ; } ) -> all ( ) ; } | Get all of the context passed to the command . |
20,773 | protected function parseVerbosity ( $ level = null ) { if ( isset ( $ this -> verbosityMap [ $ level ] ) ) { $ level = $ this -> verbosityMap [ $ level ] ; } elseif ( ! is_int ( $ level ) ) { $ level = $ this -> verbosity ; } return $ level ; } | Get the verbosity level in terms of Symfony s OutputInterface level . |
20,774 | public function addExtension ( $ extension ) { if ( ( $ index = array_search ( $ extension , $ this -> extensions ) ) !== false ) { unset ( $ this -> extensions [ $ index ] ) ; } array_unshift ( $ this -> extensions , $ extension ) ; } | Register an extension with the view finder . |
20,775 | public function chain ( $ chain ) { $ this -> chained = collect ( $ chain ) -> map ( function ( $ job ) { return serialize ( $ job ) ; } ) -> all ( ) ; return $ this ; } | Set the jobs that should run if this job is successful . |
20,776 | public function dispatchNextJobInChain ( ) { if ( ! empty ( $ this -> chained ) ) { dispatch ( tap ( unserialize ( array_shift ( $ this -> chained ) ) , function ( $ next ) { $ next -> chained = $ this -> chained ; $ next -> onConnection ( $ next -> connection ? : $ this -> chainConnection ) ; $ next -> onQueue ( $ nex... | Dispatch the next job on the chain . |
20,777 | public function when ( $ concrete ) { $ aliases = [ ] ; foreach ( Arr :: wrap ( $ concrete ) as $ c ) { $ aliases [ ] = $ this -> getAlias ( $ c ) ; } return new ContextualBindingBuilder ( $ this , $ aliases ) ; } | Define a contextual binding . |
20,778 | public function resolved ( $ abstract ) { if ( $ this -> isAlias ( $ abstract ) ) { $ abstract = $ this -> getAlias ( $ abstract ) ; } return isset ( $ this -> resolved [ $ abstract ] ) || isset ( $ this -> instances [ $ abstract ] ) ; } | Determine if the given abstract type has been resolved . |
20,779 | public function tag ( $ abstracts , $ tags ) { $ tags = is_array ( $ tags ) ? $ tags : array_slice ( func_get_args ( ) , 1 ) ; foreach ( $ tags as $ tag ) { if ( ! isset ( $ this -> tags [ $ tag ] ) ) { $ this -> tags [ $ tag ] = [ ] ; } foreach ( ( array ) $ abstracts as $ abstract ) { $ this -> tags [ $ tag ] [ ] = $... | Assign a set of tags to a given binding . |
20,780 | public function refresh ( $ abstract , $ target , $ method ) { return $ this -> rebinding ( $ abstract , function ( $ app , $ instance ) use ( $ target , $ method ) { $ target -> { $ method } ( $ instance ) ; } ) ; } | Refresh an instance on the given target and method . |
20,781 | protected function getContextualConcrete ( $ abstract ) { if ( ! is_null ( $ binding = $ this -> findInContextualBindings ( $ abstract ) ) ) { return $ binding ; } if ( empty ( $ this -> abstractAliases [ $ abstract ] ) ) { return ; } foreach ( $ this -> abstractAliases [ $ abstract ] as $ alias ) { if ( ! is_null ( $ ... | Get the contextual concrete binding for the given abstract . |
20,782 | protected function resolvePrimitive ( ReflectionParameter $ parameter ) { if ( ! is_null ( $ concrete = $ this -> getContextualConcrete ( '$' . $ parameter -> name ) ) ) { return $ concrete instanceof Closure ? $ concrete ( $ this ) : $ concrete ; } if ( $ parameter -> isDefaultValueAvailable ( ) ) { return $ parameter... | Resolve a non - class hinted primitive dependency . |
20,783 | protected function notInstantiable ( $ concrete ) { if ( ! empty ( $ this -> buildStack ) ) { $ previous = implode ( ', ' , $ this -> buildStack ) ; $ message = "Target [$concrete] is not instantiable while building [$previous]." ; } else { $ message = "Target [$concrete] is not instantiable." ; } throw new BindingReso... | Throw an exception that the concrete is not instantiable . |
20,784 | protected function fireAfterResolvingCallbacks ( $ abstract , $ object ) { $ this -> fireCallbackArray ( $ object , $ this -> globalAfterResolvingCallbacks ) ; $ this -> fireCallbackArray ( $ object , $ this -> getCallbacksForType ( $ abstract , $ object , $ this -> afterResolvingCallbacks ) ) ; } | Fire all of the after resolving callbacks . |
20,785 | protected function getCallbacksForType ( $ abstract , $ object , array $ callbacksPerType ) { $ results = [ ] ; foreach ( $ callbacksPerType as $ type => $ callbacks ) { if ( $ type === $ abstract || $ object instanceof $ type ) { $ results = array_merge ( $ results , $ callbacks ) ; } } return $ results ; } | Get all callbacks for a given type . |
20,786 | protected function replayMacros ( Builder $ query ) { foreach ( $ this -> macroBuffer as $ macro ) { $ query -> { $ macro [ 'method' ] } ( ... $ macro [ 'parameters' ] ) ; } return $ query ; } | Replay stored macro calls on the actual related instance . |
20,787 | protected function resolveTableName ( $ table ) { if ( ! Str :: contains ( $ table , '\\' ) || ! class_exists ( $ table ) ) { return $ table ; } $ model = new $ table ; if ( ! $ model instanceof Model ) { return $ table ; } if ( $ model instanceof Pivot ) { $ this -> using ( $ table ) ; } return $ model -> getTable ( )... | Attempt to resolve the intermediate table name from the given string . |
20,788 | public function orWherePivot ( $ column , $ operator = null , $ value = null ) { return $ this -> wherePivot ( $ column , $ operator , $ value , 'or' ) ; } | Set an or where clause for a pivot table column . |
20,789 | public function firstOrCreate ( array $ attributes , array $ joining = [ ] , $ touch = true ) { if ( is_null ( $ instance = $ this -> where ( $ attributes ) -> first ( ) ) ) { $ instance = $ this -> create ( $ attributes , $ joining , $ touch ) ; } return $ instance ; } | Get the first related record matching the attributes or create it . |
20,790 | public function find ( $ id , $ columns = [ '*' ] ) { return is_array ( $ id ) ? $ this -> findMany ( $ id , $ columns ) : $ this -> where ( $ this -> getRelated ( ) -> getQualifiedKeyName ( ) , '=' , $ id ) -> first ( $ columns ) ; } | Find a related model by its primary key . |
20,791 | public function findOrFail ( $ id , $ columns = [ '*' ] ) { $ result = $ this -> find ( $ id , $ columns ) ; if ( is_array ( $ id ) ) { if ( count ( $ result ) === count ( array_unique ( $ id ) ) ) { return $ result ; } } elseif ( ! is_null ( $ result ) ) { return $ result ; } throw ( new ModelNotFoundException ) -> se... | Find a related model by its primary key or throw an exception . |
20,792 | public function createMany ( array $ records , array $ joinings = [ ] ) { $ instances = [ ] ; foreach ( $ records as $ key => $ record ) { $ instances [ ] = $ this -> create ( $ record , ( array ) ( $ joinings [ $ key ] ?? [ ] ) , false ) ; } $ this -> touchIfTouching ( ) ; return $ instances ; } | Create an array of new instances of the related models . |
20,793 | public function createSessionDriver ( $ name , $ config ) { $ provider = $ this -> createUserProvider ( $ config [ 'provider' ] ?? null ) ; $ guard = new SessionGuard ( $ name , $ provider , $ this -> app [ 'session.store' ] ) ; if ( method_exists ( $ guard , 'setCookieJar' ) ) { $ guard -> setCookieJar ( $ this -> app... | Create a session based authentication guard . |
20,794 | public function createTokenDriver ( $ name , $ config ) { $ guard = new TokenGuard ( $ this -> createUserProvider ( $ config [ 'provider' ] ?? null ) , $ this -> app [ 'request' ] , $ config [ 'input_key' ] ?? 'api_token' , $ config [ 'storage_key' ] ?? 'api_token' , $ config [ 'hash' ] ?? false ) ; $ this -> app -> re... | Create a token based authentication guard . |
20,795 | public function viaRequest ( $ driver , callable $ callback ) { return $ this -> extend ( $ driver , function ( ) use ( $ callback ) { $ guard = new RequestGuard ( $ callback , $ this -> app [ 'request' ] , $ this -> createUserProvider ( ) ) ; $ this -> app -> refresh ( 'request' , $ guard , 'setRequest' ) ; return $ g... | Register a new callback based request guard . |
20,796 | protected function addWithoutTrashed ( Builder $ builder ) { $ builder -> macro ( 'withoutTrashed' , function ( Builder $ builder ) { $ model = $ builder -> getModel ( ) ; $ builder -> withoutGlobalScope ( $ this ) -> whereNull ( $ model -> getQualifiedDeletedAtColumn ( ) ) ; return $ builder ; } ) ; } | Add the without - trashed extension to the builder . |
20,797 | public static function within ( $ listenerPath , $ basePath ) { return collect ( static :: getListenerEvents ( ( new Finder ) -> files ( ) -> in ( $ listenerPath ) , $ basePath ) ) -> mapToDictionary ( function ( $ event , $ listener ) { return [ $ event => $ listener ] ; } ) -> all ( ) ; } | Get all of the events and listeners by searching the given listener directory . |
20,798 | protected static function getListenerEvents ( $ listeners , $ basePath ) { $ listenerEvents = [ ] ; foreach ( $ listeners as $ listener ) { $ listener = new ReflectionClass ( static :: classFromFile ( $ listener , $ basePath ) ) ; foreach ( $ listener -> getMethods ( ReflectionMethod :: IS_PUBLIC ) as $ method ) { if (... | Get all of the listeners and their corresponding events . |
20,799 | protected static function classFromFile ( SplFileInfo $ file , $ basePath ) { $ class = trim ( str_replace ( $ basePath , '' , $ file -> getRealPath ( ) ) , DIRECTORY_SEPARATOR ) ; return str_replace ( [ DIRECTORY_SEPARATOR , 'App\\' ] , [ '\\' , app ( ) -> getNamespace ( ) ] , ucfirst ( Str :: replaceLast ( '.php' , '... | Extract the class name from the given file path . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.