idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
10,100 | public function build ( ) { return new QueryConfiguration ( $ this -> drawCall , $ this -> start , $ this -> length , $ this -> searchValue , $ this -> searchRegex , $ this -> columSearches , $ this -> columnOrders ) ; } | Will build the final QueryConfiguration that will be used later in the process pipeline |
10,101 | public function getNotationValue ( $ notation , & $ errors = null ) { $ type = $ this -> getNotationType ( $ notation , $ params , $ errors ) ; if ( in_array ( $ type , static :: TYPE_WITHOUT_VALUE ) ) { return ; } switch ( $ type ) { case 'integer' : return ( int ) $ notation ; case 'boolean' : return ( bool ) $ notat... | Retrieve value of a parsable notation Value rapresent ... |
10,102 | public function handleRequest ( ) { $ request = $ this -> prepareRequest ( ) ; $ version = $ request [ 'version' ] ; $ queryConfiguration = $ request [ 'queryConfiguration' ] ; $ data = $ this -> provider -> process ( ) ; return $ version -> createResponse ( $ data , $ queryConfiguration , $ this -> columnConfiguration... | Will handle the current request and returns the correct response |
10,103 | public static function getModel ( ) { $ attribute = 'model' ; if ( ! static :: hasClassAttribute ( $ attribute ) ) { $ class = static :: getClass ( ) ; $ slash = strrpos ( $ class , '\\' ) ; $ model = $ slash === false ? $ class : substr ( $ class , $ slash + 1 ) ; static :: setClassAttribute ( $ attribute , $ model ) ... | Retrieve model name . |
10,104 | protected function isExclusion ( $ className , $ methodName , $ isPublic ) { foreach ( $ this -> exclusions as $ classRegExp => $ excludedMethods ) { if ( preg_match ( $ classRegExp , $ className ) ) { return ( $ excludedMethods [ 0 ] == '*' && $ isPublic ) || in_array ( $ methodName , $ excludedMethods ) ; } } return ... | Determines if a method name shouldn t be checked for camelCaps format . |
10,105 | protected function isEventHandlerExclusion ( $ className , $ methodName , array $ methodParams ) { if ( strpos ( $ className , 'EventHandler' ) === false ) { return false ; } return substr ( $ methodName , 0 , 2 ) == 'On' && count ( $ methodParams ) === 1 && $ methodParams [ 0 ] [ 'name' ] === '$event' ; } | Determines if a method is an event in the event handler class . |
10,106 | protected function isTagProcessorExclusion ( $ className , $ methodName , array $ methodParams ) { if ( strpos ( $ className , 'TagProcessor' ) === false ) { return false ; } return count ( $ methodParams ) === 1 && $ methodParams [ 0 ] [ 'name' ] === '$params' ; } | Determines if a method is an tag in the tag processor class . |
10,107 | public function generateGraph ( array $ userSchema ) { $ graphSchema = $ this -> getService ( 'neogen.schema_builder' ) -> buildGraph ( $ userSchema ) ; return $ this -> getGraphGenerator ( ) -> generateGraph ( $ graphSchema ) ; } | Generates a graph based on a given user schema array |
10,108 | protected function getFieldForToOneAssociation ( $ sourceAssociation ) { $ targetClassMetadata = $ this -> getClassMetadata ( $ sourceAssociation [ 'targetEntity' ] ) ; $ joinedColumn = reset ( $ sourceAssociation [ 'joinColumns' ] ) ; if ( ! $ joinedColumn ) { return null ; } $ type = $ this -> getTypeForAssociation (... | Create a schema array for one - to - one and many - to - one associations |
10,109 | public static function create ( array $ aParams = null ) { $ params = new self ( ) ; if ( $ aParams === null ) { return $ params ; } foreach ( $ aParams as $ name => $ value ) { $ params -> $ name = $ value ; } return $ params ; } | Create params from array or with default values |
10,110 | public function getIndexedProperties ( ) { $ props = [ ] ; foreach ( $ this -> properties as $ property ) { if ( $ property -> isIndexed ( ) ) { $ props [ ] = $ property ; } } return $ props ; } | Get all the properties that are indexed |
10,111 | public function getUniqueProperties ( ) { $ props = [ ] ; foreach ( $ this -> properties as $ property ) { if ( $ property -> isUnique ( ) ) { $ props [ ] = $ property ; } } return $ props ; } | Get all the properties that are unique |
10,112 | public function addLabel ( $ label ) { if ( null !== $ label ) { $ l = ( string ) $ label ; if ( ! $ this -> hasLabel ( $ l ) ) { $ this -> labels -> add ( $ l ) ; return true ; } } return false ; } | Adds a label to this node checks if the label does not exist to avoid duplicates |
10,113 | public function hasLabel ( $ label ) { if ( null !== $ label ) { $ l = ( string ) $ label ; if ( $ this -> labels -> contains ( $ l ) ) { return true ; } } return false ; } | Checks whether or not this node has the specified label |
10,114 | public static function makeRFC2396Valid ( $ url ) { $ parsed_url = @ parse_url ( $ url ) ; if ( $ parsed_url === false ) { return null ; } if ( ! isset ( $ parsed_url [ 'scheme' ] ) ) { if ( preg_match ( '/^#/' , $ url ) ) { return null ; } if ( preg_match ( '#^/[^/]#' , $ url ) ) { return null ; } if ( preg_match ( '#... | Make valid url |
10,115 | public static function googleCanonicalize ( $ url ) { $ url = preg_replace ( '#[\x09\x0d\x0a]#' , '' , $ url ) ; $ url = self :: makeRFC2396Valid ( trim ( $ url ) ) ; if ( is_null ( $ url ) ) { return null ; } $ url = self :: percentUnEscape ( $ url ) ; $ parsed_url = parse_url ( $ url ) ; if ( $ parsed_url === false )... | Canonicalize the url according to google s wishes |
10,116 | public static function isHostnameIP ( $ hostname ) { if ( preg_match ( '/^\[[^\]]\]$/' , $ hostname ) ) { return true ; } if ( preg_match ( '/^[0-9]+$/' , $ hostname ) ) { $ ip4_hex = base_convert ( $ hostname , 10 , 16 ) ; if ( strlen ( $ ip4_hex ) <= 8 ) { return true ; } } $ ip_parts = Array ( ) ; if ( ! preg_match ... | Check if the given hostname is an ip address |
10,117 | public static function percentUnEscape ( $ string ) { $ keep_unescaping = true ; while ( $ keep_unescaping ) { if ( strpos ( $ string , '%' ) === false ) { break ; } $ test_string = preg_replace ( '#%25#s' , '' , $ string ) ; if ( strpos ( $ test_string , '%' ) === false ) { $ keep_unescaping = false ; } $ dec_string =... | unescape the string |
10,118 | public static function query ( $ query ) { static :: applySchema ( ) ; $ table = self :: getTable ( ) ; $ whereArray = [ ] ; if ( isset ( $ query [ 'where' ] ) ) { $ whereArray [ ] = '(' . $ query [ 'where' ] . ')' ; unset ( $ query [ 'where' ] ) ; } foreach ( $ query as $ field => $ value ) { if ( in_array ( $ field ,... | Query a list of records . |
10,119 | public function getSchemaFileContent ( $ filePath ) { if ( ! $ this -> fs -> exists ( $ filePath ) ) { throw new SchemaDefinitionException ( sprintf ( 'The schema file "%s" was not found' , $ filePath ) ) ; } $ content = file_get_contents ( $ filePath ) ; try { $ schema = Yaml :: parse ( $ content ) ; return $ schema ;... | Get the contents of the User Schema YAML File and transforms it to php array |
10,120 | public static function abjad ( $ start = 0 , $ end = 0 ) { $ abjadList = [ ] ; for ( $ i = 65 ; $ i <= 90 ; $ i ++ ) { $ abjadList [ ] = chr ( $ i ) ; if ( $ i == 90 ) { for ( $ j = 65 ; $ j <= 90 ; $ j ++ ) { for ( $ k = 65 ; $ k <= 90 ; $ k ++ ) { $ abjadList [ ] = chr ( $ j ) . chr ( $ k ) ; } } } } $ abjad = [ ] ; ... | Generates abjad list column . |
10,121 | protected function checkBracketSpacing ( File $ phpcsFile , $ stackPtr ) { $ tokens = $ phpcsFile -> getTokens ( ) ; if ( isset ( $ tokens [ $ stackPtr ] [ 'parenthesis_opener' ] ) === false ) { return ; } $ parenOpener = $ tokens [ $ stackPtr ] [ 'parenthesis_opener' ] ; $ parenCloser = $ tokens [ $ stackPtr ] [ 'pare... | Checks bracket spacing . |
10,122 | protected function getLeadingCommentOrSelf ( File $ phpcsFile , $ stackPtr ) { $ prevTokens = array ( $ stackPtr ) ; $ tokens = $ phpcsFile -> getTokens ( ) ; do { $ prev = end ( $ prevTokens ) ; $ newPrev = $ phpcsFile -> findPrevious ( T_WHITESPACE , ( $ prev - 1 ) , null , true ) ; if ( $ tokens [ $ newPrev ] [ 'cod... | Returns leading comment or self . |
10,123 | protected function getScopeCloser ( File $ phpcsFile , $ stackPtr ) { $ tokens = $ phpcsFile -> getTokens ( ) ; $ scopeCloser = $ tokens [ $ stackPtr ] [ 'scope_closer' ] ; if ( $ tokens [ $ stackPtr ] [ 'code' ] !== T_DO ) { return $ scopeCloser ; } $ trailingContent = $ phpcsFile -> findNext ( Tokens :: $ emptyTokens... | Returns scope closer with special check for do ... while statements . |
10,124 | protected function getTrailingContent ( File $ phpcsFile , $ stackPtr ) { $ nextNonWhitespace = $ phpcsFile -> findNext ( array ( T_WHITESPACE , T_COMMENT , ) , ( $ stackPtr + 1 ) , null , true ) ; return $ nextNonWhitespace ; } | Returns trailing content token . |
10,125 | protected function getTrailingCommentOrSelf ( File $ phpcsFile , $ stackPtr ) { $ nextTokens = array ( $ stackPtr ) ; $ tokens = $ phpcsFile -> getTokens ( ) ; do { $ next = end ( $ nextTokens ) ; $ newNext = $ phpcsFile -> findNext ( T_WHITESPACE , ( $ next + 1 ) , null , true ) ; if ( $ tokens [ $ newNext ] [ 'code' ... | Returns trailing comment or self . |
10,126 | protected function isClosure ( File $ phpcsFile , $ stackPtr , $ scopeConditionPtr ) { $ tokens = $ phpcsFile -> getTokens ( ) ; if ( $ this -> isScopeCondition ( $ phpcsFile , $ scopeConditionPtr , T_CLOSURE ) === true && ( $ phpcsFile -> hasCondition ( $ stackPtr , T_FUNCTION ) === true || $ phpcsFile -> hasCondition... | Determines that a closure is located at given position . |
10,127 | public function firstOrCreate ( array $ input ) { $ this -> cache -> tags ( $ this -> getModel ( ) ) -> flush ( ) ; return $ this -> repository -> firstOrCreate ( $ input ) ; } | Get or create row |
10,128 | public function updateOrCreate ( array $ input ) { $ this -> cache -> tags ( $ this -> getModel ( ) ) -> flush ( ) ; return $ this -> repository -> updateOrCreate ( $ input ) ; } | Update or create row |
10,129 | public function suspend ( ) { RevisionRepository :: create ( [ 'revisionable_type' => Config :: get ( 'sentry.users.model' ) , 'revisionable_id' => $ this [ 'user_id' ] , 'key' => 'suspended_at' , 'old_value' => $ this [ 'suspended_at' ] , 'new_value' => new DateTime ( ) , 'user_id' => null , ] ) ; parent :: suspend ( ... | Suspend the user associated with the throttle . |
10,130 | public function parse ( & $ schema ) { foreach ( $ schema as & $ table ) { static :: parseTable ( $ table ) ; } foreach ( $ schema as & $ table ) { foreach ( $ table as $ aspects ) { if ( isset ( $ aspects [ 'Relation' ] ) && $ aspects [ 'Relation' ] == 'many-to-many' ) { $ schema [ 'Cioa' ] = [ [ ] ] ; } } } } | parse a multi - table schema to sanitize end explode implicit info . |
10,131 | public function parseTable ( & $ table , & $ errors = null , $ namespace = '\\' ) { $ before = false ; foreach ( $ table as $ field => & $ notation ) { $ notation = static :: getNotationAspects ( $ notation , $ field , $ before , $ errors , $ namespace ) ; $ before = $ field ; } } | Parse table schema to sanitize end explod implicit info . |
10,132 | public function getNotationAspects ( $ notation , $ field = null , $ before = null , & $ errors = null , $ namespace = null ) { $ params = null ; $ type = $ this -> getNotationType ( $ notation , $ params , $ errors , $ namespace ) ; $ aspects = $ this -> getNotationCommonAspects ( $ field , $ before ) ; switch ( $ typ... | Parse notation of a field . |
10,133 | private function getNotationCommonAspects ( $ field , $ before ) { $ aspects = [ 'Field' => null , 'Key' => '' , 'Type' => '' , 'Null' => 'YES' , 'Extra' => '' , 'Default' => '' , 'Relation' => null , ] ; if ( ! is_null ( $ field ) ) { $ aspects [ 'Field' ] = $ field ; } if ( ! is_null ( $ before ) ) { $ aspects [ 'Fir... | Get common or default aspects . |
10,134 | public function find ( $ id , array $ columns = [ '*' ] ) { $ model = $ this -> model ; return $ model :: find ( $ id , $ columns ) ; } | Find an existing model . |
10,135 | public function index ( ) { $ model = $ this -> model ; if ( property_exists ( $ model , 'order' ) ) { return $ model :: orderBy ( $ model :: $ order , $ model :: $ sort ) -> get ( $ model :: $ index ) ; } return $ model :: get ( $ model :: $ index ) ; } | Get a list of the models . |
10,136 | public function rules ( $ query = null ) { $ model = $ this -> model ; if ( isset ( $ model :: $ rules ) ) { $ rules = $ model :: $ rules ; } else { $ rules = [ ] ; } if ( ! is_array ( $ rules ) || ! $ rules ) { return [ ] ; } if ( ! $ query ) { return array_filter ( $ rules ) ; } return array_filter ( array_only ( $ r... | Return the rules . |
10,137 | public function getRow ( $ sql , $ params = null ) { return $ this -> _socket -> getRow ( $ sql , $ params = null ) ; } | Get a single row . |
10,138 | public function getResults ( $ sql , $ params = null ) { return $ this -> _socket -> getResults ( $ sql , $ params = null ) ; } | Get list of records . |
10,139 | public function toJsonLd ( Type \ TypeInterface $ thing , $ addScriptTag = true ) { $ return = json_encode ( $ this -> toJsonLdDataArray ( $ thing ) ) ; if ( $ addScriptTag ) { return '<script type="application/ld+json">' . $ return . '</script>' ; } return $ return ; } | Convert schema . rg type to the json - ld string . |
10,140 | protected function typeToJsonLd ( Type \ TypeInterface $ type ) { $ typeName = ( new \ ReflectionClass ( $ type ) ) -> getShortName ( ) ; if ( strlen ( $ typeName ) > 4 && substr ( $ typeName , - 4 ) === 'Type' ) { $ typeName = substr ( $ typeName , 0 , - 4 ) ; } $ jsonLd = [ '@type' => $ typeName , ] ; if ( $ type -> ... | Convert type to json - ld data array . |
10,141 | protected function valueToJsonLd ( $ value ) { if ( is_array ( $ value ) ) { $ return = [ ] ; foreach ( $ value as $ item ) { $ return [ ] = $ this -> valueToJsonLd ( $ item ) ; } return $ return ; } elseif ( $ value instanceof Type \ EnumerationType || $ value instanceof Type \ Enumeration ) { return $ value -> getSch... | Convert value to json - ld format . |
10,142 | public static function boot ( ) { parent :: boot ( ) ; static :: saving ( function ( $ model ) { $ model -> preSave ( ) ; } ) ; static :: saved ( function ( $ model ) { $ model -> postSave ( ) ; } ) ; static :: deleted ( function ( $ model ) { $ model -> preSave ( ) ; $ model -> postDelete ( ) ; } ) ; } | Create the event listeners for the saving and saved events . |
10,143 | public function preSave ( ) { $ this -> originalData = $ this -> original ; $ this -> updatedData = $ this -> attributes ; foreach ( $ this -> updatedData as $ key => $ val ) { if ( is_object ( $ val ) ) { if ( ! ( $ val instanceof DateTime ) ) { unset ( $ this -> originalData [ $ key ] ) ; unset ( $ this -> updatedDat... | Do some work before we start the saving process . |
10,144 | protected function getDataValue ( $ type , $ key ) { if ( $ key == 'password' ) { return ; } $ name = $ type . 'Data' ; return array_get ( $ this -> $ name , $ key ) ; } | Get the value to be saved stripping passwords . |
10,145 | public function postDelete ( ) { RevisionRepository :: create ( [ 'revisionable_type' => get_class ( $ this ) , 'revisionable_id' => $ this -> getKey ( ) , 'key' => 'deleted_at' , 'old_value' => null , 'new_value' => new DateTime ( ) , 'user_id' => $ this -> getUserId ( ) , ] ) ; } | Store the deleted time . |
10,146 | protected function getUserId ( ) { if ( Credentials :: check ( ) ) { return Credentials :: getUser ( ) -> id ; } elseif ( isset ( $ this [ 'user_id' ] ) && $ this [ 'user_id' ] ) { return $ this [ 'user_id' ] ; } } | Attempt to find the user id of the currently logged in user . |
10,147 | protected function changedRevisionableFields ( ) { $ changes = [ ] ; foreach ( $ this -> dirtyData as $ key => $ value ) { if ( $ this -> isRevisionable ( $ key ) && ! is_array ( $ value ) ) { if ( is_object ( $ original = array_get ( $ this -> originalData , $ key ) ) || is_string ( $ original ) ) { $ original = trim ... | Get the fields for all of the storable changes that have been made . |
10,148 | protected function isRevisionable ( $ key ) { if ( isset ( $ this -> doKeep ) && in_array ( $ key , $ this -> doKeep ) ) { return true ; } if ( isset ( $ this -> dontKeep ) && in_array ( $ key , $ this -> dontKeep ) ) { return false ; } return empty ( $ this -> doKeep ) ; } | Check if this field should have a revision kept . |
10,149 | public function normalize ( ) : string { if ( ! $ this -> uri ) { return '' ; } $ path = $ this -> path ? : '/' ; $ path = $ this -> removeDotSegments ( $ path ) ; $ path = $ this -> decodeUnreservedCharacters ( $ path ) ; $ path = $ this -> decodeReservedSubDelimiters ( $ path ) ; return $ this -> reconstitute ( $ thi... | Normalizes the URI for maximal comparison success . |
10,150 | public function getAbsoluteUri ( ) { return $ this -> reconstitute ( $ this -> scheme , $ this -> getAuthority ( ) , $ this -> path , $ this -> query , $ fragment = '' ) ; } | Retrieve the URI without the fragment component . |
10,151 | public static function isValid ( string $ uri ) : bool { try { new self ( $ uri ) ; } catch ( InvalidUriException $ e ) { return false ; } return true ; } | Test whether the specified string is a valid URI . |
10,152 | private function addCredentialsColumns ( Blueprint $ table ) { if ( SocialAuthenticator :: isEnabled ( ) ) { $ table -> string ( 'password' ) -> nullable ( ) ; $ table -> string ( 'social_provider' ) -> nullable ( ) ; $ table -> string ( 'social_provider_id' ) -> unique ( ) -> nullable ( ) ; } else { $ table -> string ... | Add credentials columns . |
10,153 | public function getPrimaryKeyOrMainField ( $ model ) { $ key = $ this -> getPrimaryKey ( $ model ) ; return $ key ? $ key : $ this -> getMainField ( $ model ) ; } | Get primary key or main field . |
10,154 | public function getMainField ( $ model ) { $ desc = $ this -> desc ( $ model ) ; foreach ( array_keys ( $ desc [ $ model ] ) as $ field ) { return $ field ; } } | Get the main field . |
10,155 | public function isAll ( $ roles , & $ failed = null ) { $ this -> isOne ( $ roles , $ failed ) ; return $ failed -> isEmpty ( ) ; } | Check if has all roles . |
10,156 | public function isOne ( $ roles , & $ failed = null ) { $ roles = is_array ( $ roles ) ? collect ( $ roles ) : $ roles ; $ failed = $ roles -> reject ( function ( $ role ) { return $ this -> hasRoleSlug ( $ role ) ; } ) -> values ( ) ; return $ roles -> count ( ) !== $ failed -> count ( ) ; } | Check if has at least one role . |
10,157 | public function hasRoleSlug ( $ slug ) { $ roles = $ this -> active_roles -> filter ( function ( Role $ role ) use ( $ slug ) { return $ role -> hasSlug ( $ slug ) ; } ) ; return ! $ roles -> isEmpty ( ) ; } | Check if has a role by its slug . |
10,158 | public static function delete ( $ query ) { static :: applySchema ( ) ; $ key = static :: getPrimaryKeyOrMainField ( ) ; if ( $ key && ! is_array ( $ query ) ) { $ query = [ $ key => $ query ] ; } $ whereArray = [ ] ; if ( isset ( $ query [ 'where' ] ) ) { $ whereArray [ ] = $ query [ 'where' ] ; unset ( $ query [ 'whe... | Delete element by primary key or query . |
10,159 | public function column ( $ name , $ callable = null , Searchable $ searchable = null , Orderable $ orderable = null ) { $ config = ColumnConfigurationBuilder :: create ( ) ; if ( is_string ( $ name ) ) { $ config -> name ( $ name ) ; } else { throw new \ InvalidArgumentException ( '$name must be a string' ) ; } if ( ! ... | Will create a new ColumnConfiguration with all defaults but allows overriding of all properties through the method . |
10,160 | public function setRedis ( \ Redis $ redis ) { $ redis -> setOption ( Redis :: OPT_SERIALIZER , $ this -> getSerializerValue ( ) ) ; $ this -> _redis = $ redis ; } | Sets the Redis instance to use . |
10,161 | public function generatePropertyInterface ( ) { $ interface = new PhpInterface ( $ this -> propertyInterfaceName ) ; $ interface -> setQualifiedName ( 'SecIT\\SchemaOrg\\Mapping\\Property\\' . $ this -> propertyInterfaceName ) -> setDescription ( 'Interface ' . $ this -> propertyInterfaceName . '.' ) -> setMethod ( Php... | Generate property interface . |
10,162 | public function generateTypeInterface ( ) { $ interface = new PhpInterface ( $ this -> typeInterfaceName ) ; $ interface -> setQualifiedName ( 'SecIT\\SchemaOrg\\Mapping\\Type\\' . $ this -> typeInterfaceName ) -> setDescription ( 'Interface ' . $ this -> typeInterfaceName . '.' ) -> setMethod ( PhpMethod :: create ( '... | Generate type interface . |
10,163 | protected function generateDataTypes ( array $ schema ) { $ directory = $ this -> getMappingDirectory ( 'DataType' ) ; foreach ( $ schema [ 'datatypes' ] as $ dataType => $ data ) { $ this -> generateDataType ( $ dataType , $ data , $ directory ) ; } } | Generate data types . |
10,164 | protected function generateProperties ( array $ schema ) { $ directory = $ this -> getMappingDirectory ( 'Property' ) ; $ this -> generateAbstractProperty ( $ directory ) ; foreach ( $ schema [ 'properties' ] as $ property => $ data ) { $ this -> generateProperty ( $ property , $ data , $ directory , $ schema [ 'dataty... | Generate properties . |
10,165 | protected function generateTypes ( array $ schema ) { $ directory = $ this -> getMappingDirectory ( 'Type' ) ; foreach ( $ schema [ 'types' ] as $ type => $ data ) { $ this -> generateType ( $ type , $ data , $ directory , $ schema ) ; } } | Generate types . |
10,166 | protected function generateDataType ( $ dataType , array $ data , $ directory ) { $ dataType = $ this -> getDataTypeClassName ( $ dataType ) ; $ class = new PhpClass ( ) ; $ class -> setQualifiedName ( 'SecIT\\SchemaOrg\\Mapping\\DataType\\' . $ dataType ) -> setDescription ( 'Class ' . $ dataType . '.' ) -> setMethod ... | Generate data type . |
10,167 | protected function generateAbstractProperty ( $ directory ) { $ class = new PhpClass ( ) ; $ class -> setDescription ( 'Abstract class AbstractProperty.' ) -> setQualifiedName ( 'SecIT\\SchemaOrg\\Mapping\\Property\\AbstractProperty' ) -> addInterface ( $ this -> propertyInterfaceName ) -> setAbstract ( true ) ; $ cons... | Generate abstract property . |
10,168 | protected function generateProperty ( $ propertyName , array $ data , $ directory , array $ dataTypes ) { $ property = $ this -> getPropertyClassName ( $ propertyName ) ; $ class = new PhpClass ( ) ; $ class -> setQualifiedName ( 'SecIT\\SchemaOrg\\Mapping\\Property\\' . $ property ) -> setParentClassName ( 'AbstractPr... | Generate property . |
10,169 | protected function getPropertyClassName ( $ name ) { $ name = ucfirst ( $ name ) ; if ( ! $ this -> php7ClassNames ) { return $ name ; } if ( substr ( $ name , - 8 ) == 'Property' ) { return $ name ; } return $ name . 'Property' ; } | Get valid PHP7 property class name . |
10,170 | protected function getInheritedProperties ( $ type , array $ schema , $ isRoot = true ) { if ( ! isset ( $ schema [ 'types' ] [ $ type ] ) ) { throw new \ Exception ( 'Unknown type ' . $ type ) ; } $ typeSchema = $ schema [ 'types' ] [ $ type ] ; $ properties = [ ] ; if ( ! $ isRoot ) { foreach ( $ typeSchema [ 'specif... | Get inherited properties . |
10,171 | protected function cleanUp ( ) { $ files = glob ( __DIR__ . DIRECTORY_SEPARATOR . 'Mapping' . DIRECTORY_SEPARATOR . '{DataType,Property,Type}' . DIRECTORY_SEPARATOR . '*.php' , GLOB_BRACE ) ; foreach ( $ files as $ file ) { unlink ( $ file ) ; } } | Remove previously generated files . |
10,172 | protected function getDataType ( Client $ client , $ href ) { $ response = $ client -> get ( $ href ) ; $ crawler = new Crawler ( $ response -> getBody ( ) -> __toString ( ) ) ; $ ancestors = [ ] ; $ subclasses = $ crawler -> filter ( '[property="rdfs:subClassOf"]' ) ; if ( $ subclasses -> count ( ) > 0 ) { $ ancestors... | Get data type . |
10,173 | protected function isCamelCaps ( $ string , $ public = true ) { if ( in_array ( $ string , $ this -> memberExceptions ) === true ) { return true ; } return Common :: isCamelCaps ( $ string , false , $ public , false ) ; } | Determines if a variable is in camel caps case . |
10,174 | protected function wasActualUser ( ) { return $ this -> wrappedObject -> user_id == $ this -> wrappedObject -> revisionable_id || ! $ this -> wrappedObject -> user_id ; } | Was the action by the actual user? |
10,175 | protected function isCurrentUser ( ) { return $ this -> credentials -> check ( ) && $ this -> credentials -> getUser ( ) -> id == $ this -> wrappedObject -> revisionable_id ; } | Is the current user s account? |
10,176 | protected function author ( ) { if ( $ this -> presenter -> wasByCurrentUser ( ) || ! $ this -> wrappedObject -> user_id ) { return 'You ' ; } if ( ! $ this -> wrappedObject -> security ) { return 'This user ' ; } return $ this -> presenter -> author ( ) . ' ' ; } | Get the author details . |
10,177 | protected function user ( ) { if ( $ this -> wrappedObject -> security ) { return ' this user\'s ' ; } $ user = $ this -> wrappedObject -> revisionable ( ) -> withTrashed ( ) -> first ( [ 'first_name' , 'last_name' ] ) ; return ' ' . $ user -> first_name . ' ' . $ user -> last_name . '\'s ' ; } | Get the user details . |
10,178 | public function handle ( $ request , Closure $ next ) { if ( $ this -> maintenance -> isDownMode ( ) && ! $ this -> maintenance -> checkAllowedIp ( $ this -> getIp ( ) ) ) { if ( app ( ) [ 'view' ] -> exists ( 'errors.503' ) ) { return new Response ( app ( ) [ 'view' ] -> make ( 'errors.503' ) , 503 ) ; } return app ( ... | Handle incoming requests . |
10,179 | public function postReset ( ) { $ input = Binput :: only ( 'email' ) ; $ val = UserRepository :: validate ( $ input , array_keys ( $ input ) ) ; if ( $ val -> fails ( ) ) { return Redirect :: route ( 'account.reset' ) -> withInput ( ) -> withErrors ( $ val -> errors ( ) ) ; } $ this -> throttler -> hit ( ) ; try { $ us... | Queue the sending of the password reset email . |
10,180 | public function getPassword ( $ id , $ code ) { if ( ! $ id || ! $ code ) { throw new BadRequestHttpException ( ) ; } try { $ user = Credentials :: getUserProvider ( ) -> findById ( $ id ) ; $ password = Str :: random ( ) ; if ( ! $ user -> attemptResetPassword ( $ code , $ password ) ) { return Redirect :: to ( Config... | Reset the user s password . |
10,181 | public function execute ( $ sql , $ values = null ) { $ this -> log ( 'execute' , $ sql , $ values ) ; return $ this -> _socket -> execute ( $ sql , $ values ) ; } | Execute SQL query to database . |
10,182 | public function getPrefix ( $ table = null ) { $ prefix = $ this -> _socket -> getPrefix ( ) ; return $ table ? $ prefix . $ table : $ prefix ; } | Return current database prefix used . |
10,183 | public function getRow ( $ sql , $ params = null ) { $ this -> log ( 'getRow' , $ sql , $ params ) ; return $ this -> _socket -> getRow ( $ sql , $ params ) ; } | Get a single row of a result set . |
10,184 | public function tableExists ( $ table , $ parse = true ) { if ( $ parse ) { $ table = $ this -> getPrefix ( $ table ) ; } $ escapedTable = str_replace ( '_' , '\\_' , $ table ) ; $ sql = "SHOW TABLES LIKE '{$escapedTable}'" ; $ exists = $ this -> getRow ( $ sql ) ; return ( bool ) $ exists ; } | Test if a table exists . |
10,185 | public function getTables ( $ matchPrefix = true ) { if ( $ matchPrefix ) { $ prefix = str_replace ( '_' , '\\_' , $ this -> getPrefix ( ) ) ; $ sql = "SHOW TABLES LIKE '{$prefix}%'" ; } else { $ sql = 'SHOW TABLES' ; } $ tables = $ this -> getValues ( $ sql ) ; return $ tables ; } | Get array with current tables on database . |
10,186 | private function log ( $ method , $ sql = null , $ params = null ) { $ this -> _logger -> info ( str_pad ( '(' . $ method . ')' , 14 , ' ' , STR_PAD_RIGHT ) . '"' . $ sql . '"' , ( array ) $ params ) ; } | Log called SocketApi into log file . |
10,187 | private function getNotationAspectsString ( $ notation , $ aspects ) { $ aspects [ 'Type' ] = 'varchar(255)' ; $ aspects [ 'Null' ] = 'NO' ; $ aspects [ 'Default' ] = $ this -> getNotationValue ( $ notation ) ; return $ aspects ; } | Get notaion aspect for string . |
10,188 | public function postLogin ( ) { $ remember = Binput :: get ( 'rememberMe' ) ; $ input = Binput :: only ( [ 'email' , 'password' ] ) ; $ rules = UserRepository :: rules ( array_keys ( $ input ) ) ; $ rules [ 'password' ] = 'required|min:6' ; $ val = UserRepository :: validate ( $ input , $ rules , true ) ; if ( $ val ->... | Attempt to login the specified user . |
10,189 | public static function menuToRules ( $ items ) { $ rules = [ ] ; foreach ( $ items as $ item ) { $ url = ArrayHelper :: getValue ( $ item , 'url' ) ; $ urlRule = ArrayHelper :: getValue ( $ item , 'urlRule' ) ; if ( $ url && $ urlRule && is_array ( $ url ) ) { $ defaults = $ url ; $ route = array_shift ( $ defaults ) ;... | Recursive scan all items and return url rules for UrlManager component |
10,190 | public function addNode ( Node $ node ) { foreach ( $ this -> nodes as $ n ) { if ( $ n -> getIdentifier ( ) === $ node -> getIdentifier ( ) ) { throw new SchemaDefinitionException ( sprintf ( 'The node with Identifier "%s" has already been declared' , $ node -> getIdentifier ( ) ) ) ; } } return $ this -> nodes -> add... | Adds a node to the nodes collection |
10,191 | public function addRelationship ( Relationship $ relationship ) { foreach ( $ this -> relationships as $ rel ) { if ( $ rel -> getType ( ) === $ relationship -> getType ( ) && $ rel -> getStartNode ( ) === $ relationship -> getStartNode ( ) && $ rel -> getEndNode ( ) === $ relationship -> getEndNode ( ) ) { throw new S... | Adds a relationship to the relationship collection |
10,192 | public function getFields ( $ model ) { $ table = $ this -> getTable ( $ model ) ; $ sql = "DESC `{$table}`" ; $ results = $ this -> getResults ( $ sql ) ; $ fields = [ ] ; foreach ( $ results as $ field ) { $ fields [ ] = $ field [ 'Field' ] ; } return $ fields ; } | Describe table . |
10,193 | public function exists ( $ model , $ query ) { $ params = [ ] ; $ whereArray = [ ] ; if ( isset ( $ query [ 'where' ] ) ) { $ whereArray [ ] = $ query [ 'where' ] ; unset ( $ query [ 'where' ] ) ; } $ schema = $ this -> getFields ( $ model ) ; foreach ( $ schema as $ field ) { if ( ! isset ( $ query [ $ field ] ) ) { c... | Check if record exists . |
10,194 | public function import ( $ model , $ records ) { if ( ! $ records || ! is_array ( $ records [ 0 ] ) ) { return ; } foreach ( $ records as $ record ) { $ schema = [ ] ; foreach ( array_keys ( $ record ) as $ field ) { $ schema [ $ field ] = '' ; } $ this -> adapt ( $ model , $ schema ) ; $ this -> submit ( $ model , $ r... | Import records into a model table . |
10,195 | public function drop ( $ model , $ confirm ) { if ( $ confirm != 'confirm' ) { return ; } $ models = $ model == '*' ? $ this -> getModels ( ) : [ $ model ] ; if ( ! count ( $ models ) ) { return ; } foreach ( $ models as $ model ) { $ table = $ this -> getTable ( $ model ) ; if ( ! $ table ) { continue ; } $ sql = "DRO... | Drop delete table related to a model . |
10,196 | public function dump ( $ model = null ) { if ( $ model ) { $ all = $ this -> all ( $ model ) ; Functions :: dumpGrid ( $ all , $ model ) ; } else { $ this -> dumpSchema ( ) ; } } | Dump all data . |
10,197 | public function checkContentBefore ( File $ phpcsFile , $ stackPtr ) { $ tokens = $ phpcsFile -> getTokens ( ) ; $ prevToken = $ tokens [ ( $ stackPtr - 1 ) ] ; if ( $ prevToken [ 'content' ] === '(' ) { return ; } if ( $ prevToken [ 'code' ] === T_WHITESPACE && $ tokens [ ( $ stackPtr - 2 ) ] [ 'code' ] !== T_COMMA ) ... | Checks spacing before comma . |
10,198 | public function checkContentAfter ( File $ phpcsFile , $ stackPtr ) { $ tokens = $ phpcsFile -> getTokens ( ) ; $ nextToken = $ tokens [ ( $ stackPtr + 1 ) ] ; if ( $ nextToken [ 'content' ] === ')' ) { return ; } if ( $ nextToken [ 'code' ] !== T_WHITESPACE ) { $ error = 'No space found after comma' ; $ fix = $ phpcsF... | Checks spacing after comma . |
10,199 | public function desc ( $ only = null ) { $ schema = [ ] ; $ prefix = strlen ( $ this -> getPrefix ( ) ) ; $ tables = $ this -> getTables ( ) ; if ( ! $ tables ) { return $ schema ; } if ( is_string ( $ only ) ) { $ only = [ $ only ] ; } foreach ( $ tables as $ table ) { $ model = substr ( $ table , $ prefix ) ; if ( ! ... | Describe database each tables with the specific prefix and her fields . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.