idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
38,300 | protected function redirectRoute ( string $ requestPath ) : Route { return new Route ( [ ] , '' , function ( Request $ request ) use ( $ requestPath ) { $ url = $ request -> getBaseURL ( ) . ( $ request -> isClean ( ) ? '' : '/' . $ request -> getScriptName ( ) ) . rtrim ( '/' . $ request -> getLanguagePrefix ( ) , '/' ) . $ requestPath . '/' ; $ query = $ request -> getQuery ( ) -> all ( ) ; if ( ! empty ( $ query ) ) { $ url .= '?' . http_build_query ( $ query , '' , '&' , PHP_QUERY_RFC3986 ) ; } return ( new Redirect ( $ url ) ) -> setStatus ( 301 ) ; } ) ; } | Returns a route with a closure action that redirects to the correct URL . |
38,301 | protected function getAllowedMethodsForMatchingRoutes ( string $ requestPath ) : array { $ methods = [ ] ; foreach ( $ this -> routes -> getRoutes ( ) as $ route ) { if ( $ this -> matches ( $ route , $ requestPath ) && $ this -> constraintsAreSatisfied ( $ route ) ) { $ methods = array_merge ( $ methods , $ route -> getMethods ( ) ) ; } } return array_unique ( $ methods ) ; } | Returns an array of all allowed request methods for the requested route . |
38,302 | protected function optionsRoute ( string $ requestPath ) : Route { $ allowedMethods = $ this -> getAllowedMethodsForMatchingRoutes ( $ requestPath ) ; return new Route ( [ ] , '' , function ( Response $ response ) use ( $ allowedMethods ) : void { $ response -> getHeaders ( ) -> add ( 'Allow' , implode ( ',' , $ allowedMethods ) ) ; } ) ; } | Returns a route with a closure action that sets the allow header . |
38,303 | public function route ( Request $ request ) : Route { $ requestMethod = $ request -> getMethod ( ) ; $ requestPath = $ request -> getPath ( ) ; foreach ( $ this -> routes -> getRoutesByMethod ( $ requestMethod ) as $ route ) { if ( $ this -> matches ( $ route , $ requestPath ) && $ this -> constraintsAreSatisfied ( $ route ) ) { if ( $ route -> hasTrailingSlash ( ) && ! empty ( $ requestPath ) && substr ( $ requestPath , - 1 ) !== '/' ) { return $ this -> redirectRoute ( $ requestPath ) ; } if ( $ requestMethod === 'OPTIONS' ) { return $ this -> optionsRoute ( $ requestPath ) ; } $ request -> setRoute ( $ route ) ; return $ route ; } } if ( ! empty ( ( $ allowedMethods = $ this -> getAllowedMethodsForMatchingRoutes ( $ requestPath ) ) ) ) { throw new MethodNotAllowedException ( $ allowedMethods ) ; } throw new NotFoundException ( $ requestMethod . ': ' . $ requestPath ) ; } | Matches and returns the appropriate route along with its parameters . |
38,304 | protected function instantiate ( string $ configuration ) : Crypto { if ( ! isset ( $ this -> configurations [ $ configuration ] ) ) { throw new RuntimeException ( vsprintf ( '[ %s ] has not been defined in the crypto configuration.' , [ $ configuration ] ) ) ; } $ configuration = $ this -> configurations [ $ configuration ] ; return new Crypto ( $ this -> factory ( $ configuration [ 'library' ] , $ configuration ) , $ this -> container -> get ( Signer :: class ) ) ; } | Returns a crypto instance . |
38,305 | public function addLayer ( string $ class , ? array $ parameters = null , bool $ inner = true ) : int { $ this -> parameters [ $ class ] = $ parameters ; return $ inner ? array_unshift ( $ this -> layers , $ class ) : array_push ( $ this -> layers , $ class ) ; } | Add a new middleware layer . |
38,306 | protected function buildCoreClosure ( object $ object ) : Closure { return function ( ... $ arguments ) use ( $ object ) { $ callable = $ object instanceof Closure ? $ object : [ $ object , $ this -> method ] ; return $ callable ( ... $ arguments ) ; } ; } | Builds the core closure . |
38,307 | protected function buildLayerClosure ( object $ layer , Closure $ next ) : Closure { return function ( ... $ arguments ) use ( $ layer , $ next ) { return $ layer -> execute ( ... array_merge ( $ arguments , [ $ next ] ) ) ; } ; } | Builds a layer closure . |
38,308 | protected function middlewareFactory ( string $ middleware , array $ parameters ) : object { $ parameters = $ this -> mergeParameters ( $ parameters , $ middleware ) ; $ middleware = $ this -> container -> get ( $ middleware , $ parameters ) ; if ( $ this -> expectedInterface !== null && ( $ middleware instanceof $ this -> expectedInterface ) === false ) { throw new OnionException ( vsprintf ( 'The Onion instance expects the middleware to be an instance of [ %s ].' , [ $ this -> expectedInterface ] ) ) ; } return $ middleware ; } | Middleware factory . |
38,309 | public function peel ( object $ object , array $ parameters = [ ] , array $ middlewareParameters = [ ] ) { $ next = $ this -> buildCoreClosure ( $ object ) ; foreach ( $ this -> layers as $ layer ) { $ middleware = $ this -> middlewareFactory ( $ layer , $ middlewareParameters ) ; $ next = $ this -> buildLayerClosure ( $ middleware , $ next ) ; } return $ next ( ... $ parameters ) ; } | Executes the middleware stack . |
38,310 | public function rollback ( ? int $ batches = null ) : void { $ migrations = $ this -> getMigrated ( $ batches ) ; if ( $ migrations -> isEmpty ( ) ) { $ this -> write ( '<blue>There are no migrations to roll back.</blue>' ) ; return ; } foreach ( $ migrations as $ migration ) { $ this -> runMigration ( $ migration , 'down' ) ; } $ this -> write ( 'Rolled back the following migrations:' . PHP_EOL ) ; $ this -> outputMigrationList ( $ migrations -> getItems ( ) ) ; } | Rolls back n batches . |
38,311 | public static function rule ( string $ ruleName , ... $ parameters ) : string { if ( empty ( $ parameters ) ) { return $ ruleName ; } return $ ruleName . '(' . substr ( json_encode ( $ parameters ) , 1 , - 1 ) . ')' ; } | Rule builder . |
38,312 | protected function saveOriginalFieldNames ( array $ fields , string $ field ) : void { foreach ( $ fields as $ expanded ) { $ this -> originalFieldNames [ $ expanded ] = $ field ; } } | Saves original field name along with the expanded field name . |
38,313 | protected function expandFields ( array $ ruleSets ) : array { $ expanded = [ ] ; foreach ( $ ruleSets as $ field => $ ruleSet ) { if ( $ this -> hasWilcard ( $ field ) === false ) { $ expanded = array_merge_recursive ( $ expanded , [ $ field => $ ruleSet ] ) ; continue ; } if ( ! empty ( $ fields = Arr :: expandKey ( $ this -> input , $ field ) ) ) { $ this -> saveOriginalFieldNames ( $ fields , $ field ) ; $ fields = array_fill_keys ( $ fields , $ ruleSet ) ; } $ expanded = array_merge_recursive ( $ expanded , $ fields ) ; } return $ expanded ; } | Expands fields . |
38,314 | public function addRules ( string $ field , array $ ruleSet ) : Validator { $ this -> ruleSets = array_merge_recursive ( $ this -> ruleSets , $ this -> expandFields ( [ $ field => $ ruleSet ] ) ) ; return $ this ; } | Adds validation rules to input field . |
38,315 | public function addRulesIf ( string $ field , array $ ruleSet , $ condition ) : Validator { if ( $ condition instanceof Closure ) { $ condition = $ condition ( ) ; } return $ condition ? $ this -> addRules ( $ field , $ ruleSet ) : $ this ; } | Adds validation rules to input field if the condition is met . |
38,316 | protected function parseRule ( string $ rule ) : object { $ package = null ; if ( preg_match ( '/^([a-z-]+)::(.*)/' , $ rule , $ matches ) === 1 ) { $ package = $ matches [ 1 ] ; } [ $ name , $ parameters ] = $ this -> parseFunction ( $ rule , false ) ; return ( object ) compact ( 'name' , 'parameters' , 'package' ) ; } | Parses the rule . |
38,317 | protected function getRuleClassName ( string $ name ) : string { if ( ! isset ( $ this -> rules [ $ name ] ) ) { throw new RuntimeException ( vsprintf ( 'Call to undefined validation rule [ %s ].' , [ $ name ] ) ) ; } return $ this -> rules [ $ name ] ; } | Returns the rule class name . |
38,318 | protected function ruleFactory ( string $ name , array $ parameters ) : RuleInterface { return $ this -> container -> get ( $ this -> getRuleClassName ( $ name ) , $ parameters ) ; } | Creates a rule instance . |
38,319 | protected function getErrorMessage ( RuleInterface $ rule , string $ field , object $ parsedRule ) : string { $ field = $ this -> getOriginalFieldName ( $ field ) ; if ( $ this -> i18n !== null && $ rule instanceof I18nAwareInterface ) { return $ rule -> setI18n ( $ this -> i18n ) -> getTranslatedErrorMessage ( $ field , $ parsedRule -> name , $ parsedRule -> package ) ; } return $ rule -> getErrorMessage ( $ field ) ; } | Returns the error message . |
38,320 | protected function validateField ( string $ field , string $ rule ) : bool { $ parsedRule = $ this -> parseRule ( $ rule ) ; $ rule = $ this -> ruleFactory ( $ parsedRule -> name , $ parsedRule -> parameters ) ; if ( $ this -> isInputFieldEmpty ( $ inputValue = Arr :: get ( $ this -> input , $ field ) ) && $ rule -> validateWhenEmpty ( ) === false ) { return true ; } if ( $ rule -> validate ( $ inputValue , $ this -> input ) === false ) { $ this -> errors [ $ field ] = $ this -> getErrorMessage ( $ rule , $ field , $ parsedRule ) ; return $ this -> isValid = false ; } return true ; } | Validates the field using the specified rule . |
38,321 | protected function process ( ) : array { foreach ( $ this -> ruleSets as $ field => $ ruleSet ) { $ ruleSet = array_unique ( $ ruleSet ) ; foreach ( $ ruleSet as $ rule ) { if ( $ this -> validateField ( $ field , $ rule ) === false ) { break ; } } } return [ $ this -> isValid , $ this -> errors ] ; } | Processes all validation rules and returns an array containing the validation status and potential error messages . |
38,322 | public function isValid ( ? array & $ errors = null ) : bool { [ $ isValid , $ errors ] = $ this -> process ( ) ; return $ isValid === true ; } | Returns true if all rules passed and false if validation failed . |
38,323 | public function isInvalid ( ? array & $ errors = null ) : bool { [ $ isValid , $ errors ] = $ this -> process ( ) ; return $ isValid === false ; } | Returns false if all rules passed and true if validation failed . |
38,324 | public function validate ( ) : array { if ( $ this -> isInvalid ( ) ) { throw new ValidationException ( $ this -> errors , 'Invalid input.' ) ; } $ validated = [ ] ; foreach ( array_keys ( $ this -> ruleSets ) as $ validatedKey ) { if ( Arr :: has ( $ this -> input , $ validatedKey ) ) { Arr :: set ( $ validated , $ validatedKey , Arr :: get ( $ this -> input , $ validatedKey ) ) ; } } return $ validated ; } | Validates the input and returns an array containing validated data . |
38,325 | protected function getStatusCodeAndMessage ( Throwable $ exception ) : array { if ( $ exception instanceof HttpException ) { $ message = $ exception -> getMessage ( ) ; } if ( empty ( $ message ) ) { $ message = 'An error has occurred while processing your request.' ; } return [ 'code' => $ this -> getStatusCode ( $ exception ) , 'message' => $ message ] ; } | Returns status code and message . |
38,326 | protected function getExceptionAsXml ( Throwable $ exception ) : string { $ details = $ this -> getStatusCodeAndMessage ( $ exception ) ; $ xml = simplexml_load_string ( "<?xml version='1.0' encoding='utf-8'?><error />" ) ; $ xml -> addChild ( 'code' , $ details [ 'code' ] ) ; $ xml -> addChild ( 'message' , $ details [ 'message' ] ) ; return $ xml -> asXML ( ) ; } | Return a XML representation of the exception . |
38,327 | protected function getExceptionAsRenderedView ( Throwable $ exception ) : string { $ view = 'error' ; if ( $ exception instanceof HttpException ) { $ code = $ exception -> getCode ( ) ; if ( $ this -> view -> exists ( 'mako-error::' . $ code ) ) { $ view = $ code ; } } return $ this -> view -> render ( 'mako-error::' . $ view ) ; } | Returns a rendered error view . |
38,328 | protected function getBody ( Throwable $ exception ) : string { if ( $ this -> returnAsJson ( ) ) { $ this -> response -> setType ( 'application/json' ) ; return $ this -> getExceptionAsJson ( $ exception ) ; } if ( $ this -> returnAsXml ( ) ) { $ this -> response -> setType ( 'application/xml' ) ; return $ this -> getExceptionAsXml ( $ exception ) ; } $ this -> response -> setType ( 'text/html' ) ; return $ this -> getExceptionAsRenderedView ( $ exception ) ; } | Returns a response body . |
38,329 | public function createUser ( string $ email , string $ username , string $ password , bool $ activate = false , array $ properties = [ ] ) : User { $ properties = [ 'email' => $ email , 'username' => $ username , 'password' => $ password , 'activated' => $ activate ? 1 : 0 , ] + $ properties ; return $ this -> userRepository -> createUser ( $ properties ) ; } | Creates a new user and returns the user object . |
38,330 | public function createGroup ( string $ name , array $ properties = [ ] ) : Group { $ properties = [ 'name' => $ name , ] + $ properties ; return $ this -> groupRepository -> createGroup ( $ properties ) ; } | Creates a new group and returns the group object . |
38,331 | public function activateUser ( string $ token ) { $ user = $ this -> userRepository -> getByActionToken ( $ token ) ; if ( $ user === false ) { return false ; } $ user -> activate ( ) ; $ user -> generateActionToken ( ) ; $ user -> save ( ) ; return $ user ; } | Activates a user based on the provided auth token . |
38,332 | protected function findApplicationMigrations ( ) : array { $ migrations = [ ] ; foreach ( $ this -> fileSystem -> glob ( $ this -> application -> getPath ( ) . '/migrations/*.php' ) as $ migration ) { $ migrations [ ] = ( object ) [ 'package' => null , 'version' => $ this -> getBasename ( $ migration ) ] ; } return $ migrations ; } | Returns all application migrations . |
38,333 | protected function findPackageMigrations ( ) : array { $ migrations = [ ] ; foreach ( $ this -> application -> getPackages ( ) as $ package ) { foreach ( $ this -> fileSystem -> glob ( $ package -> getPath ( ) . '/src/migrations/*.php' ) as $ migration ) { $ migrations [ ] = ( object ) [ 'package' => $ package -> getName ( ) , 'version' => $ this -> getBasename ( $ migration ) ] ; } } return $ migrations ; } | Returns all package migrations . |
38,334 | protected function getFullyQualifiedMigration ( object $ migration ) : string { if ( empty ( $ migration -> package ) ) { return $ this -> application -> getNamespace ( true ) . '\\migrations\\' . $ migration -> version ; } return $ this -> application -> getPackage ( $ migration -> package ) -> getClassNamespace ( true ) . '\\migrations\\' . $ migration -> version ; } | Returns the fully qualified class name of a migration . |
38,335 | protected function getMigrationsFilteredByConnection ( ) : array { $ migrations = $ this -> findMigrations ( ) ; $ connectionName = $ this -> getConnectionName ( ) ; $ defaultConnectionName = $ this -> getDefaultConnectionName ( ) ; foreach ( $ migrations as $ key => $ migration ) { $ migrationConnectionName = ( new ReflectionClass ( $ this -> getFullyQualifiedMigration ( $ migration ) ) ) -> newInstanceWithoutConstructor ( ) -> getConnectionName ( ) ?? $ defaultConnectionName ; if ( $ connectionName !== $ migrationConnectionName ) { unset ( $ migrations [ $ key ] ) ; } } return $ migrations ; } | Returns migrations filtered by connection name . |
38,336 | protected function getMigrated ( ? int $ batches = null ) : ResultSet { $ query = $ this -> builder ( ) ; if ( $ batches !== null && $ batches > 0 ) { $ query -> where ( 'batch' , '>' , ( $ this -> builder ( ) -> max ( 'batch' ) - $ batches ) ) ; } return $ query -> select ( [ 'version' , 'package' ] ) -> descending ( 'version' ) -> all ( ) ; } | Returns migrations that have been run . |
38,337 | protected function getOutstanding ( ) : array { $ migrations = $ this -> getMigrationsFilteredByConnection ( ) ; if ( ! empty ( $ migrations ) ) { foreach ( $ this -> getMigrated ( ) as $ migrated ) { foreach ( $ migrations as $ key => $ migration ) { if ( $ migrated -> package === $ migration -> package && $ migrated -> version === $ migration -> version ) { unset ( $ migrations [ $ key ] ) ; } } } usort ( $ migrations , function ( $ a , $ b ) { return strcmp ( $ a -> version , $ b -> version ) ; } ) ; } return $ migrations ; } | Returns an array of all outstanding migrations . |
38,338 | protected function outputMigrationList ( array $ migrations ) : void { $ tableBody = [ ] ; foreach ( $ migrations as $ migration ) { $ name = $ migration -> version ; if ( ! empty ( $ migration -> package ) ) { $ name .= ' (' . $ migration -> package . ')' ; } $ description = $ this -> resolve ( $ migration ) -> getDescription ( ) ; $ tableBody [ ] = [ $ name , $ description ] ; } $ this -> table ( [ 'Migration' , 'Description' ] , $ tableBody ) ; } | Outputs a migration list . |
38,339 | protected function resolve ( object $ migration ) : Migration { return $ this -> container -> get ( $ this -> getFullyQualifiedMigration ( $ migration ) ) ; } | Returns a migration instance . |
38,340 | protected function runMigration ( object $ migration , string $ method , ? int $ batch = null ) : void { $ migrationInstance = $ this -> resolve ( $ migration ) ; $ migrationWrapper = $ this -> buildMigrationWrapper ( $ migration , $ migrationInstance , $ method , $ batch ) ; if ( $ migrationInstance -> useTransaction ( ) ) { $ migrationInstance -> getConnection ( ) -> transaction ( function ( ) use ( $ migrationWrapper ) : void { $ migrationWrapper ( ) ; } ) ; return ; } $ migrationWrapper ( ) ; } | Executes a migration method . |
38,341 | public function setType ( string $ contentType , ? string $ charset = null ) : Response { $ this -> contentType = $ contentType ; if ( $ charset !== null ) { $ this -> charset = $ charset ; } return $ this ; } | Sets the response content type . |
38,342 | public function clear ( ) : Response { $ this -> clearBody ( ) ; $ this -> headers -> clear ( ) ; $ this -> cookies -> clear ( ) ; return $ this ; } | Clears the response body cookies and headers . |
38,343 | public function sendHeaders ( ) : void { $ protocol = $ this -> request -> getServer ( ) -> get ( 'SERVER_PROTOCOL' , 'HTTP/1.1' ) ; header ( $ protocol . ' ' . $ this -> statusCode . ' ' . $ this -> statusCodes [ $ this -> statusCode ] ) ; $ contentType = $ this -> contentType ; if ( stripos ( $ contentType , 'text/' ) === 0 || in_array ( $ contentType , [ 'application/json' , 'application/xml' , 'application/rss+xml' , 'application/atom+xml' ] ) ) { $ contentType .= '; charset=' . $ this -> charset ; } header ( 'Content-Type: ' . $ contentType ) ; foreach ( $ this -> headers -> all ( ) as $ name => $ values ) { foreach ( $ values as $ value ) { header ( $ name . ': ' . $ value , false ) ; } } foreach ( $ this -> cookies -> all ( ) as $ cookie ) { [ 'raw' => $ raw , 'name' => $ name , 'value' => $ value , 'options' => $ options ] = $ cookie ; if ( $ raw ) { setrawcookie ( $ name , $ value , $ options [ 'expires' ] , $ options [ 'path' ] , $ options [ 'domain' ] , $ options [ 'secure' ] , $ options [ 'httponly' ] ) ; } else { setcookie ( $ name , $ value , $ options [ 'expires' ] , $ options [ 'path' ] , $ options [ 'domain' ] , $ options [ 'secure' ] , $ options [ 'httponly' ] ) ; } } } | Sends response headers . |
38,344 | public function send ( ) : void { if ( $ this -> body instanceof ResponseSenderInterface ) { $ this -> body -> send ( $ this -> request , $ this ) ; } else { if ( $ this -> body instanceof ResponseBuilderInterface ) { $ this -> body -> build ( $ this -> request , $ this ) ; } $ sendBody = true ; if ( ob_get_level ( ) === 0 ) { ob_start ( ) ; } $ this -> body = ( string ) $ this -> body ; if ( $ this -> responseCache === true ) { $ hash = '"' . hash ( 'sha256' , $ this -> body ) . '"' ; $ this -> headers -> add ( 'ETag' , $ hash ) ; if ( str_replace ( '-gzip' , '' , $ this -> request -> getHeaders ( ) -> get ( 'If-None-Match' ) ) === $ hash ) { $ this -> setStatus ( 304 ) ; $ sendBody = false ; } } if ( $ sendBody && ! in_array ( $ this -> statusCode , [ 100 , 101 , 102 , 204 , 304 ] ) ) { if ( $ this -> outputCompression ) { ob_start ( 'ob_gzhandler' ) ; } echo $ this -> body ; if ( $ this -> outputCompression ) { ob_end_flush ( ) ; } if ( ! $ this -> headers -> has ( 'Transfer-Encoding' ) ) { $ this -> headers -> add ( 'Content-Length' , ob_get_length ( ) ) ; } } $ this -> sendHeaders ( ) ; ob_end_flush ( ) ; } } | Send output to browser . |
38,345 | protected function collectVerbatims ( string $ template ) : string { return preg_replace_callback ( '/{%\s*verbatim\s*%}(.*?){%\s*endverbatim\s*%}/is' , function ( $ matches ) { $ this -> verbatims [ ] = $ matches [ 1 ] ; return static :: VERBATIM_PLACEHOLDER ; } , $ template ) ; } | Collects verbatim blocks and replaces them with a palceholder . |
38,346 | public function insertVerbatims ( string $ template ) : string { foreach ( $ this -> verbatims as $ verbatim ) { $ template = preg_replace ( '/' . static :: VERBATIM_PLACEHOLDER . '/' , $ verbatim , $ template , 1 ) ; } return $ template ; } | Replaces verbatim placeholders with their original values . |
38,347 | protected function extensions ( string $ template ) : string { if ( preg_match ( '/^{%\s*extends:(.*?)\s*%}/i' , $ template , $ matches ) > 0 ) { $ replacement = '<?php $__view__ = $__viewfactory__->create(' . $ matches [ 1 ] . '); $__renderer__ = $__view__->getRenderer(); ?>' ; $ template = preg_replace ( '/^{%\s*extends:(.*?)\s*%}/i' , $ replacement , $ template , 1 ) ; $ template .= '<?php echo $__view__->render(); ?>' ; } return $ template ; } | Compiles template extensions . |
38,348 | protected function nospaces ( string $ template ) : string { $ template = preg_replace_callback ( '/{%\s*nospace\s*%}(.*?){%\s*endnospace\s*%}/is' , function ( $ matches ) { return trim ( preg_replace ( '/>\s+</' , '><' , $ matches [ 1 ] ) ) ; } , $ template ) ; $ template = preg_replace ( '/{%\s*nospace:buffered\s*%}(.*?){%\s*endnospace\s*%}/is' , '<?php ob_start(); ?>$1<?php echo trim(preg_replace(\'/>\s+</\', \'><\', ob_get_clean())); ?>' , $ template ) ; return $ template ; } | Compiles nospace blocks . |
38,349 | protected function captures ( string $ template ) : string { return preg_replace_callback ( '/{%\s*capture:(\$?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*?)\s*%}(.*?){%\s*endcapture\s*%}/is' , function ( $ matches ) { return '<?php ob_start(); ?>' . $ matches [ 2 ] . '<?php $' . ltrim ( $ matches [ 1 ] , '$' ) . ' = ob_get_clean(); ?>' ; } , $ template ) ; } | Compiles capture blocks . |
38,350 | protected function echos ( string $ template ) : string { $ emptyElse = function ( $ matches ) { if ( preg_match ( '/(.*)((\|\|)|(\s+or\s+))(.+)/' , $ matches ) !== 0 ) { return preg_replace_callback ( '/(.*)((\|\|)|(\s+or\s+))(.+)/' , function ( $ matches ) { return '(empty(' . trim ( $ matches [ 1 ] ) . ') ? ' . trim ( $ matches [ 5 ] ) . ' : ' . trim ( $ matches [ 1 ] ) . ')' ; } , $ matches ) ; } return $ matches ; } ; return preg_replace_callback ( '/{{\s*(.*?)\s*}}/' , function ( $ matches ) use ( $ emptyElse ) { if ( preg_match ( '/raw\s*:(.*)/i' , $ matches [ 1 ] ) > 0 ) { return sprintf ( '<?php echo %s; ?>' , $ emptyElse ( substr ( $ matches [ 1 ] , strpos ( $ matches [ 1 ] , ':' ) + 1 ) ) ) ; } elseif ( preg_match ( '/preserve\s*:(.*)/i' , $ matches [ 1 ] ) > 0 ) { return sprintf ( '<?php echo $this->escapeHTML(%s, $__charset__, false); ?>' , $ emptyElse ( substr ( $ matches [ 1 ] , strpos ( $ matches [ 1 ] , ':' ) + 1 ) ) ) ; } elseif ( preg_match ( '/attribute\s*:(.*)/i' , $ matches [ 1 ] ) > 0 ) { return sprintf ( '<?php echo $this->escapeAttribute(%s, $__charset__); ?>' , $ emptyElse ( substr ( $ matches [ 1 ] , strpos ( $ matches [ 1 ] , ':' ) + 1 ) ) ) ; } elseif ( preg_match ( '/js\s*:(.*)/i' , $ matches [ 1 ] ) > 0 ) { return sprintf ( '<?php echo $this->escapeJavascript(%s, $__charset__); ?>' , $ emptyElse ( substr ( $ matches [ 1 ] , strpos ( $ matches [ 1 ] , ':' ) + 1 ) ) ) ; } elseif ( preg_match ( '/css\s*:(.*)/i' , $ matches [ 1 ] ) > 0 ) { return sprintf ( '<?php echo $this->escapeCSS(%s, $__charset__); ?>' , $ emptyElse ( substr ( $ matches [ 1 ] , strpos ( $ matches [ 1 ] , ':' ) + 1 ) ) ) ; } elseif ( preg_match ( '/url\s*:(.*)/i' , $ matches [ 1 ] ) > 0 ) { return sprintf ( '<?php echo $this->escapeURL(%s, $__charset__); ?>' , $ emptyElse ( substr ( $ matches [ 1 ] , strpos ( $ matches [ 1 ] , ':' ) + 1 ) ) ) ; } else { return sprintf ( '<?php echo $this->escapeHTML(%s, $__charset__); ?>' , $ emptyElse ( $ matches [ 1 ] ) ) ; } } , $ template ) ; } | Compiles echos . |
38,351 | public function compile ( ) : void { $ contents = $ this -> fileSystem -> get ( $ this -> template ) ; foreach ( $ this -> compileOrder as $ method ) { $ contents = $ this -> $ method ( $ contents ) ; } $ this -> fileSystem -> put ( $ this -> cachePath . '/' . md5 ( $ this -> template ) . '.php' , trim ( $ contents ) ) ; } | Compiles templates into views . |
38,352 | public function create ( array $ input , array $ rules ) : Validator { $ validator = new Validator ( $ input , $ rules , $ this -> i18n , $ this -> container ) ; foreach ( $ this -> rules as $ rule => $ ruleClass ) { $ validator -> extend ( $ rule , $ ruleClass ) ; } return $ validator ; } | Creates and returns a validator instance . |
38,353 | protected function getWhoopsHandler ( ) : WhoopsHandlerInterface { if ( $ this -> returnAsJson ( ) ) { return new JsonResponseHandler ; } if ( $ this -> returnAsXml ( ) ) { return new XmlResponseHandler ; } $ handler = new PrettyPageHandler ; $ handler -> handleUnconditionally ( true ) ; $ handler -> setApplicationPaths ( [ $ this -> app -> getPath ( ) ] ) ; $ handler -> setPageTitle ( 'Error' ) ; $ blacklist = $ this -> app -> getConfig ( ) -> get ( 'application.error_handler.debug_blacklist' ) ; if ( ! empty ( $ blacklist ) ) { foreach ( $ blacklist as $ superglobal => $ keys ) { foreach ( $ keys as $ key ) { $ handler -> blacklist ( $ superglobal , $ key ) ; } } } return $ handler ; } | Returns a Whoops handler . |
38,354 | protected function configureWhoops ( ) : void { $ this -> whoops -> pushHandler ( $ this -> getWhoopsHandler ( ) ) ; $ this -> whoops -> writeToOutput ( false ) ; $ this -> whoops -> allowQuit ( false ) ; } | Configure Whoops . |
38,355 | protected function policyFactory ( $ entity ) : PolicyInterface { $ entityClass = is_object ( $ entity ) ? get_class ( $ entity ) : $ entity ; if ( ! isset ( $ this -> policies [ $ entityClass ] ) ) { throw new AuthorizerException ( vsprintf ( 'There is no authorization policy registered for [ %s ] entities.' , [ $ entityClass ] ) ) ; } return $ this -> container -> get ( $ this -> policies [ $ entityClass ] ) ; } | Policy factory . |
38,356 | public function toArray ( ) : array { $ results = [ ] ; foreach ( $ this -> items as $ item ) { $ results [ ] = $ item -> toArray ( ) ; } return $ results ; } | Returns an array representation of the result set . |
38,357 | protected function getFlags ( ) : ? int { if ( $ this -> version === null ) { return null ; } switch ( $ this -> version ) { case 'v4' : return FILTER_FLAG_IPV4 ; case 'v6' : return FILTER_FLAG_IPV6 ; default : throw new RuntimeException ( vsprintf ( 'Invalid IP version [ %s ]. The accepted versions are v4 and v6.' , [ $ this -> version ] ) ) ; } } | Returns the filter flags . |
38,358 | protected function getPrefixedKey ( string $ key ) : string { return empty ( $ this -> prefix ) ? $ key : $ this -> prefix . '.' . $ key ; } | Returns a prefixed key . |
38,359 | public function getAndPut ( string $ key , $ data , int $ ttl = 0 ) { $ storedValue = $ this -> get ( $ key ) ; $ this -> put ( $ key , $ data , $ ttl ) ; return $ storedValue ; } | Fetch data from the cache and replace it . |
38,360 | public function getAndRemove ( string $ key ) { $ storedValue = $ this -> get ( $ key ) ; if ( $ storedValue !== false ) { $ this -> remove ( $ key ) ; } return $ storedValue ; } | Fetch data from the cache and remove it . |
38,361 | public function connection ( ? string $ connection = null ) { $ connection = $ connection ?? $ this -> default ; if ( ! isset ( $ this -> connections [ $ connection ] ) ) { $ this -> connections [ $ connection ] = $ this -> connect ( $ connection ) ; } return $ this -> connections [ $ connection ] ; } | Returns the chosen connection . |
38,362 | public function close ( ? string $ connection = null ) : void { $ connection = $ connection ?? $ this -> default ; if ( isset ( $ this -> connections [ $ connection ] ) ) { if ( method_exists ( $ this -> connections [ $ connection ] , 'close' ) ) { $ this -> connections [ $ connection ] -> close ( ) ; } unset ( $ this -> connections [ $ connection ] ) ; } } | Closes the chosen connection . |
38,363 | public function executeAndClose ( Closure $ closure , ? string $ connection = null ) { $ returnValue = $ closure ( $ this -> connection ( $ connection ) ) ; $ this -> close ( $ connection ) ; return $ returnValue ; } | Executes the passed closure using the chosen connection before closing it . |
38,364 | public function add ( string $ name , string $ value , int $ ttl = 0 , array $ options = [ ] , bool $ raw = false ) : Cookies { $ expires = ( $ ttl === 0 ) ? 0 : ( time ( ) + $ ttl ) ; $ this -> cookies [ $ name ] = [ 'raw' => $ raw , 'name' => $ name , 'value' => $ value , 'options' => [ 'expires' => $ expires ] + $ options + $ this -> defaults , ] ; return $ this ; } | Adds a unsigned cookie . |
38,365 | public static function get ( array $ array , string $ path , $ default = null ) { $ segments = explode ( '.' , $ path ) ; foreach ( $ segments as $ segment ) { if ( ! is_array ( $ array ) || ! array_key_exists ( $ segment , $ array ) ) { return $ default ; } $ array = $ array [ $ segment ] ; } return $ array ; } | Returns value from array using dot notation . |
38,366 | public static function expandKey ( array $ array , string $ key ) : array { if ( strpos ( $ key , '*' ) === false ) { throw new RuntimeException ( 'The key must contain at least one wildcard character.' ) ; } $ keys = ( array ) $ key ; start : $ expanded = [ ] ; foreach ( $ keys as $ key ) { [ $ first , $ remaining ] = array_map ( 'trim' , explode ( '*' , $ key , 2 ) , [ '.' , '.' ] ) ; if ( empty ( $ first ) ) { $ value = $ array ; } elseif ( is_array ( $ value = static :: get ( $ array , $ first ) ) === false ) { continue ; } foreach ( array_keys ( $ value ) as $ key ) { $ expanded [ ] = trim ( $ first . '.' . $ key . '.' . $ remaining , '.' ) ; } } if ( strpos ( $ remaining , '*' ) !== false ) { $ keys = $ expanded ; goto start ; } return $ expanded ; } | Expands a wildcard key to an array of dot notation keys . |
38,367 | protected function authenticate ( $ identifier , $ password , $ force = false ) { $ user = $ this -> userRepository -> getByIdentifier ( $ identifier ) ; if ( $ user !== false ) { if ( $ this -> options [ 'throttling' ] [ 'enabled' ] && $ user -> isLocked ( ) ) { return Gatekeeper :: LOGIN_LOCKED ; } if ( $ force || $ user -> validatePassword ( $ password ) ) { if ( ! $ user -> isActivated ( ) ) { return Gatekeeper :: LOGIN_ACTIVATING ; } if ( $ user -> isBanned ( ) ) { return Gatekeeper :: LOGIN_BANNED ; } if ( $ this -> options [ 'throttling' ] [ 'enabled' ] ) { $ user -> resetThrottle ( ) ; } $ this -> user = $ user ; return true ; } else { if ( $ this -> options [ 'throttling' ] [ 'enabled' ] ) { $ user -> throttle ( $ this -> options [ 'throttling' ] [ 'max_attempts' ] , $ this -> options [ 'throttling' ] [ 'lock_time' ] ) ; } } } return Gatekeeper :: LOGIN_INCORRECT ; } | Returns true if the identifier + password combination matches and the user is activated not locked and not banned . A status code will be retured in all other situations . |
38,368 | protected function setRememberMeCookie ( ) : void { if ( $ this -> options [ 'cookie_options' ] [ 'secure' ] && ! $ this -> request -> isSecure ( ) ) { throw new RuntimeException ( 'Attempted to set a secure cookie over a non-secure connection.' ) ; } $ this -> response -> getCookies ( ) -> addSigned ( $ this -> options [ 'auth_key' ] , $ this -> user -> getAccessToken ( ) , ( 3600 * 24 * 365 ) , $ this -> options [ 'cookie_options' ] ) ; } | Sets a remember me cookie . |
38,369 | public function forceLogin ( $ identifier , $ remember = false ) { return $ this -> login ( $ identifier , null , $ remember , true ) ; } | Login a user without checking the password . Returns true if the identifier exists and the user is activated not locked and not banned . A status code will be retured in all other situations . |
38,370 | public function basicAuth ( bool $ clearResponse = false ) : bool { if ( $ this -> isLoggedIn ( ) || $ this -> login ( $ this -> request -> getUsername ( ) , $ this -> request -> getPassword ( ) ) === true ) { return true ; } if ( $ clearResponse ) { $ this -> response -> clear ( ) ; } $ this -> response -> getHeaders ( ) -> add ( 'WWW-Authenticate' , 'basic' ) ; $ this -> response -> setStatus ( 401 ) ; return false ; } | Returns a basic authentication response if login is required and null if not . |
38,371 | protected function loadInflection ( string $ language ) : void { $ this -> inflections [ $ language ] = $ this -> loader -> loadInflection ( $ language ) ; } | Loads inflection closure and rules . |
38,372 | public function pluralize ( string $ word , ? int $ count = null , ? string $ language = null ) : string { $ language = $ language ?? $ this -> language ; if ( ! isset ( $ this -> inflections [ $ language ] ) ) { $ this -> loadInflection ( $ language ) ; } if ( empty ( $ this -> inflections [ $ language ] ) ) { throw new I18nException ( vsprintf ( 'The [ %s ] language pack does not include any inflection rules.' , [ $ language ] ) ) ; } $ pluralizer = $ this -> inflections [ $ language ] [ 'pluralize' ] ; return $ pluralizer ( $ word , ( int ) $ count , $ this -> inflections [ $ language ] [ 'rules' ] ) ; } | Returns the plural form of a noun . |
38,373 | public function number ( float $ number , int $ decimals = 0 , ? string $ decimalPoint = null , ? string $ thousandsSeparator = null ) : string { static $ defaults ; if ( empty ( $ defaults ) ) { $ localeconv = localeconv ( ) ; $ defaults = [ 'decimal' => $ localeconv [ 'decimal_point' ] ? : '.' , 'thousands' => $ localeconv [ 'thousands_sep' ] ? : ',' , ] ; } return number_format ( $ number , $ decimals , ( $ decimalPoint ? : $ defaults [ 'decimal' ] ) , ( $ thousandsSeparator ? : $ defaults [ 'thousands' ] ) ) ; } | Format number according to locale or desired format . |
38,374 | protected function loadFromCache ( string $ language , string $ file ) : bool { $ this -> strings [ $ language ] = $ this -> cache -> get ( 'mako.i18n.' . $ language ) ; return $ this -> strings [ $ language ] !== false && isset ( $ this -> strings [ $ language ] [ $ file ] ) ; } | Loads language strings from cache . |
38,375 | protected function loadStrings ( string $ language , string $ file ) : void { if ( $ this -> cache !== null ) { if ( $ this -> loadFromCache ( $ language , $ file ) ) { return ; } $ this -> rebuildCache = true ; } $ this -> strings [ $ language ] [ $ file ] = $ this -> loader -> loadStrings ( $ language , $ file ) ; } | Loads all strings for the language . |
38,376 | protected function getStrings ( string $ language , string $ file ) : array { if ( ! isset ( $ this -> strings [ $ language ] [ $ file ] ) ) { $ this -> loadStrings ( $ language , $ file ) ; } return $ this -> strings [ $ language ] [ $ file ] ; } | Returns all strings from the chosen language file . |
38,377 | public function has ( string $ key , ? string $ language = null ) : bool { [ $ file , $ string ] = $ this -> parseKey ( $ key ) ; if ( $ string === null ) { return false ; } $ strings = $ this -> getStrings ( $ language ?? $ this -> language , $ file ) ; return Arr :: has ( $ strings , $ string ) && is_string ( Arr :: get ( $ strings , $ string ) ) ; } | Returns TRUE if the string exists and FALSE if not . |
38,378 | protected function parsePluralizationTags ( string $ string ) : string { return preg_replace_callback ( '/\<pluralize:([0-9]+)\>(\w*)\<\/pluralize\>/iu' , function ( $ matches ) { return $ this -> pluralize ( $ matches [ 2 ] , ( int ) $ matches [ 1 ] ) ; } , $ string ) ; } | Pluralize words between pluralization tags . |
38,379 | protected function parseNumberTags ( string $ string ) : string { return preg_replace_callback ( '/\<number(:([0-9]+)(,(.)(,(.))?)?)?\>([0-9-.e]*)\<\/number\>/iu' , function ( $ matches ) { return $ this -> number ( ( float ) $ matches [ 7 ] , ( $ matches [ 2 ] ? : 0 ) , $ matches [ 4 ] , $ matches [ 6 ] ) ; } , $ string ) ; } | Format numbers between number tags . |
38,380 | public function get ( string $ key , array $ vars = [ ] , ? string $ language = null ) : string { [ $ file , $ string ] = $ this -> parseKey ( $ key ) ; if ( $ string === null ) { return $ key ; } $ string = Arr :: get ( $ this -> getStrings ( $ language ?? $ this -> language , $ file ) , $ string , $ key ) ; if ( ! empty ( $ vars ) ) { $ string = vsprintf ( $ string , $ vars ) ; if ( stripos ( $ string , '</' ) !== false ) { $ string = $ this -> parseTags ( $ string ) ; } } return $ string ; } | Returns the chosen string from the current language . |
38,381 | protected function returnAs ( string $ function , array $ mimes , string $ partial ) { if ( function_exists ( $ function ) ) { $ responseType = $ this -> response -> getType ( ) ; if ( in_array ( $ responseType , $ mimes ) || strpos ( $ responseType , $ partial ) !== false ) { return true ; } $ accepts = $ this -> request -> getHeaders ( ) -> getAcceptableContentTypes ( ) ; if ( isset ( $ accepts [ 0 ] ) && ( in_array ( $ accepts [ 0 ] , $ mimes ) || strpos ( $ accepts [ 0 ] , $ partial ) !== false ) ) { return true ; } } return false ; } | Checks if we meet the requirements to return as a specific type . |
38,382 | protected function sendResponse ( Response $ response , Throwable $ exception ) : void { if ( $ exception instanceof MethodNotAllowedException ) { $ this -> response -> getHeaders ( ) -> add ( 'Allow' , implode ( ',' , $ exception -> getAllowedMethods ( ) ) ) ; } $ response -> send ( ) ; } | Sends response and adds any aditional headers . |
38,383 | protected function translateFieldName ( string $ field , string $ package ) : string { if ( $ this -> i18n -> has ( ( $ i18nKey = $ package . 'validate.overrides.fieldnames.' . $ field ) ) ) { return $ this -> i18n -> get ( $ i18nKey ) ; } return str_replace ( '_' , ' ' , $ field ) ; } | Returns a translated field name . |
38,384 | protected function getI18nParameters ( string $ field , string $ package ) : array { if ( property_exists ( $ this , 'i18nParameters' ) ) { $ parameters = array_map ( function ( $ value ) { return is_array ( $ value ) ? implode ( ', ' , $ value ) : $ value ; } , array_intersect_key ( get_object_vars ( $ this ) , array_flip ( $ this -> i18nParameters ) ) ) ; if ( property_exists ( $ this , 'i18nFieldNameParameters' ) ) { foreach ( $ this -> i18nFieldNameParameters as $ i18nField ) { $ parameters [ $ i18nField ] = $ this -> translateFieldName ( $ parameters [ $ i18nField ] , $ package ) ; } } return array_merge ( [ $ field ] , array_values ( $ parameters ) ) ; } return [ $ field ] ; } | Gets the i18n parameters . |
38,385 | protected function getConnectionOptions ( ) : array { return $ this -> options + [ PDO :: ATTR_PERSISTENT => $ this -> usePersistentConnection , PDO :: ATTR_ERRMODE => PDO :: ERRMODE_EXCEPTION , PDO :: ATTR_DEFAULT_FETCH_MODE => PDO :: FETCH_OBJ , PDO :: ATTR_STRINGIFY_FETCHES => false , PDO :: ATTR_EMULATE_PREPARES => false , ] ; } | Returns the connection options . |
38,386 | protected function connect ( ) : PDO { try { $ pdo = new PDO ( $ this -> dsn , $ this -> username , $ this -> password , $ this -> getConnectionOptions ( ) ) ; } catch ( PDOException $ e ) { throw new RuntimeException ( vsprintf ( 'Failed to connect to the [ %s ] database. %s' , [ $ this -> name , $ e -> getMessage ( ) ] ) ) ; } foreach ( $ this -> onConnectQueries as $ query ) { $ pdo -> exec ( $ query ) ; } return $ pdo ; } | Creates a PDO instance . |
38,387 | protected function prepareQueryForLog ( string $ query , array $ params ) : string { return preg_replace_callback ( '/\?/' , function ( ) use ( & $ params ) { $ param = array_shift ( $ params ) ; if ( is_int ( $ param ) || is_float ( $ param ) ) { return $ param ; } elseif ( is_bool ( ( $ param ) ) ) { return $ param ? 'TRUE' : 'FALSE' ; } elseif ( is_object ( $ param ) ) { return get_class ( $ param ) ; } elseif ( is_null ( $ param ) ) { return 'NULL' ; } elseif ( is_resource ( $ param ) ) { return 'resource' ; } else { return $ this -> pdo -> quote ( $ param ) ; } } , $ query ) ; } | Prepares query for logging . |
38,388 | protected function log ( string $ query , array $ params , float $ start ) : void { $ time = microtime ( true ) - $ start ; $ query = $ this -> prepareQueryForLog ( $ query , $ params ) ; $ this -> log [ ] = [ 'query' => $ query , 'time' => $ time ] ; } | Adds a query to the query log . |
38,389 | protected function prepareQueryAndParams ( string $ query , array $ params ) : array { replace : if ( strpos ( $ query , '([?])' ) !== false ) { foreach ( $ params as $ key => $ value ) { if ( is_array ( $ value ) ) { array_splice ( $ params , $ key , 1 , $ value ) ; $ query = preg_replace ( '/\(\[\?\]\)/' , '(' . trim ( str_repeat ( '?, ' , count ( $ value ) ) , ', ' ) . ')' , $ query , 1 ) ; goto replace ; } } } return [ $ query , $ params ] ; } | Prepare query and params . |
38,390 | protected function isConnectionLostAndShouldItBeReestablished ( ) : bool { return ( $ this -> reconnect === true && $ this -> inTransaction ( ) === false && $ this -> isAlive ( ) === false ) ; } | Should we try to reestablish the connection? |
38,391 | protected function bindParameter ( PDOStatement $ statement , int $ key , $ value ) : void { if ( is_string ( $ value ) ) { $ type = PDO :: PARAM_STR ; } elseif ( is_int ( $ value ) ) { $ type = PDO :: PARAM_INT ; } elseif ( is_bool ( $ value ) ) { $ type = PDO :: PARAM_BOOL ; } elseif ( is_null ( $ value ) ) { $ type = PDO :: PARAM_NULL ; } elseif ( is_object ( $ value ) && $ value instanceof TypeInterface ) { $ value = $ value -> getValue ( ) ; $ type = $ value -> getType ( ) ; } elseif ( is_resource ( $ value ) ) { $ type = PDO :: PARAM_LOB ; } else { $ type = PDO :: PARAM_STR ; } $ statement -> bindValue ( $ key + 1 , $ value , $ type ) ; } | Binds parameter to the prepared statement . |
38,392 | protected function execute ( array $ prepared ) : bool { if ( $ this -> enableLog ) { $ start = microtime ( true ) ; } $ result = $ prepared [ 'statement' ] -> execute ( ) ; if ( $ this -> enableLog ) { $ this -> log ( $ prepared [ 'query' ] , $ prepared [ 'params' ] , $ start ) ; } return $ result ; } | Executes the prepared query and returns TRUE on success or FALSE on failure . |
38,393 | public function query ( string $ query , array $ params = [ ] ) : bool { return $ this -> execute ( $ this -> prepare ( $ query , $ params ) ) ; } | Executes the query and returns TRUE on success or FALSE on failure . |
38,394 | public function queryAndCount ( string $ query , array $ params = [ ] ) : int { $ prepared = $ this -> prepare ( $ query , $ params ) ; $ this -> execute ( $ prepared ) ; return $ prepared [ 'statement' ] -> rowCount ( ) ; } | Executes the query and return number of affected rows . |
38,395 | public function column ( string $ query , array $ params = [ ] ) { $ prepared = $ this -> prepare ( $ query , $ params ) ; $ this -> execute ( $ prepared ) ; return $ prepared [ 'statement' ] -> fetchColumn ( ) ; } | Returns the value of the first column of the first row of the result set . |
38,396 | public function first ( string $ query , array $ params = [ ] , ... $ fetchMode ) { $ prepared = $ this -> prepare ( $ query , $ params ) ; $ this -> execute ( $ prepared ) ; if ( ! empty ( $ fetchMode ) ) { $ prepared [ 'statement' ] -> setFetchMode ( ... $ fetchMode ) ; } return $ prepared [ 'statement' ] -> fetch ( ) ; } | Returns the first row of the result set . |
38,397 | public function transaction ( Closure $ queries ) { try { $ this -> beginTransaction ( ) ; $ returnValue = $ queries ( $ this ) ; $ this -> commitTransaction ( ) ; } catch ( PDOException $ e ) { $ this -> rollBackTransaction ( ) ; throw $ e ; } return $ returnValue ; } | Executes queries and rolls back the transaction if any of them fail . |
38,398 | public function protect ( $ column ) : void { foreach ( $ this -> items as $ item ) { $ item -> protect ( $ column ) ; } } | Excludes the chosen columns and relations from array and json representations of the collection . |
38,399 | public function expose ( $ column ) : void { foreach ( $ this -> items as $ item ) { $ item -> expose ( $ column ) ; } } | Exposes the chosen columns and relations in the array and json representations of the collection . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.