idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
3,300 | public function getPrimaryKeyColumns ( ) { $ primaryKey = $ this -> getPrimaryKey ( ) ; if ( $ primaryKey === null ) { throw new DBALException ( 'Table ' . $ this -> getName ( ) . ' has no primary key.' ) ; } return $ primaryKey -> getColumns ( ) ; } | Returns the primary key columns . |
3,301 | public function hasIndex ( $ indexName ) { $ indexName = $ this -> normalizeIdentifier ( $ indexName ) ; return isset ( $ this -> _indexes [ $ indexName ] ) ; } | Returns whether this table has an Index with the given name . |
3,302 | public function getIndex ( $ indexName ) { $ indexName = $ this -> normalizeIdentifier ( $ indexName ) ; if ( ! $ this -> hasIndex ( $ indexName ) ) { throw SchemaException :: indexDoesNotExist ( $ indexName , $ this -> _name ) ; } return $ this -> _indexes [ $ indexName ] ; } | Returns the Index with the given name . |
3,303 | public function isAutoIncrementsFor ( Table $ table ) { $ primaryKey = $ table -> getPrimaryKey ( ) ; if ( $ primaryKey === null ) { return false ; } $ pkColumns = $ primaryKey -> getColumns ( ) ; if ( count ( $ pkColumns ) !== 1 ) { return false ; } $ column = $ table -> getColumn ( $ pkColumns [ 0 ] ) ; if ( ! $ colu... | Checks if this sequence is an autoincrement sequence for a given table . |
3,304 | private function setDriverOptions ( array $ driverOptions = [ ] ) { $ supportedDriverOptions = [ MYSQLI_OPT_CONNECT_TIMEOUT , MYSQLI_OPT_LOCAL_INFILE , MYSQLI_INIT_COMMAND , MYSQLI_READ_DEFAULT_FILE , MYSQLI_READ_DEFAULT_GROUP , ] ; if ( defined ( 'MYSQLI_SERVER_PUBLIC_KEY' ) ) { $ supportedDriverOptions [ ] = MYSQLI_S... | Apply the driver options to the connection . |
3,305 | private function setSecureConnection ( array $ params ) { if ( ! isset ( $ params [ 'ssl_key' ] ) && ! isset ( $ params [ 'ssl_cert' ] ) && ! isset ( $ params [ 'ssl_ca' ] ) && ! isset ( $ params [ 'ssl_capath' ] ) && ! isset ( $ params [ 'ssl_cipher' ] ) ) { return ; } $ this -> conn -> ssl_set ( $ params [ 'ssl_key' ... | Establish a secure connection |
3,306 | public function tryMethod ( ) { $ args = func_get_args ( ) ; $ method = $ args [ 0 ] ; unset ( $ args [ 0 ] ) ; $ args = array_values ( $ args ) ; $ callback = [ $ this , $ method ] ; assert ( is_callable ( $ callback ) ) ; try { return call_user_func_array ( $ callback , $ args ) ; } catch ( Throwable $ e ) { return f... | Tries any method on the schema manager . Normally a method throws an exception when your DBMS doesn t support it or if an error occurs . This method allows you to try and method on your SchemaManager instance and will return false if it does not work or is not supported . |
3,307 | public function listDatabases ( ) { $ sql = $ this -> _platform -> getListDatabasesSQL ( ) ; $ databases = $ this -> _conn -> fetchAll ( $ sql ) ; return $ this -> _getPortableDatabasesList ( $ databases ) ; } | Lists the available databases for this connection . |
3,308 | public function listNamespaceNames ( ) { $ sql = $ this -> _platform -> getListNamespacesSQL ( ) ; $ namespaces = $ this -> _conn -> fetchAll ( $ sql ) ; return $ this -> getPortableNamespacesList ( $ namespaces ) ; } | Returns a list of all namespaces in the current database . |
3,309 | public function listSequences ( $ database = null ) { if ( $ database === null ) { $ database = $ this -> _conn -> getDatabase ( ) ; } $ sql = $ this -> _platform -> getListSequencesSQL ( $ database ) ; $ sequences = $ this -> _conn -> fetchAll ( $ sql ) ; return $ this -> filterAssetNames ( $ this -> _getPortableSeque... | Lists the available sequences for this connection . |
3,310 | public function listTableColumns ( $ table , $ database = null ) { if ( ! $ database ) { $ database = $ this -> _conn -> getDatabase ( ) ; } $ sql = $ this -> _platform -> getListTableColumnsSQL ( $ table , $ database ) ; $ tableColumns = $ this -> _conn -> fetchAll ( $ sql ) ; return $ this -> _getPortableTableColumnL... | Lists the columns for a given table . |
3,311 | public function tablesExist ( $ tableNames ) { $ tableNames = array_map ( 'strtolower' , ( array ) $ tableNames ) ; return count ( $ tableNames ) === count ( array_intersect ( $ tableNames , array_map ( 'strtolower' , $ this -> listTableNames ( ) ) ) ) ; } | Returns true if all the given tables exist . |
3,312 | public function listTableNames ( ) { $ sql = $ this -> _platform -> getListTablesSQL ( ) ; $ tables = $ this -> _conn -> fetchAll ( $ sql ) ; $ tableNames = $ this -> _getPortableTablesList ( $ tables ) ; return $ this -> filterAssetNames ( $ tableNames ) ; } | Returns a list of all tables in the current database . |
3,313 | protected function filterAssetNames ( $ assetNames ) { $ filter = $ this -> _conn -> getConfiguration ( ) -> getSchemaAssetsFilter ( ) ; if ( ! $ filter ) { return $ assetNames ; } return array_values ( array_filter ( $ assetNames , $ filter ) ) ; } | Filters asset names if they are configured to return only a subset of all the found elements . |
3,314 | public function listViews ( ) { $ database = $ this -> _conn -> getDatabase ( ) ; $ sql = $ this -> _platform -> getListViewsSQL ( $ database ) ; $ views = $ this -> _conn -> fetchAll ( $ sql ) ; return $ this -> _getPortableViewsList ( $ views ) ; } | Lists the views this connection has . |
3,315 | public function dropIndex ( $ index , $ table ) { if ( $ index instanceof Index ) { $ index = $ index -> getQuotedName ( $ this -> _platform ) ; } $ this -> _execSql ( $ this -> _platform -> getDropIndexSQL ( $ index , $ table ) ) ; } | Drops the index from the given table . |
3,316 | public function dropConstraint ( Constraint $ constraint , $ table ) { $ this -> _execSql ( $ this -> _platform -> getDropConstraintSQL ( $ constraint , $ table ) ) ; } | Drops the constraint from the given table . |
3,317 | public function dropForeignKey ( $ foreignKey , $ table ) { $ this -> _execSql ( $ this -> _platform -> getDropForeignKeySQL ( $ foreignKey , $ table ) ) ; } | Drops a foreign key from a table . |
3,318 | public function createConstraint ( Constraint $ constraint , $ table ) { $ this -> _execSql ( $ this -> _platform -> getCreateConstraintSQL ( $ constraint , $ table ) ) ; } | Creates a constraint on a table . |
3,319 | public function createIndex ( Index $ index , $ table ) { $ this -> _execSql ( $ this -> _platform -> getCreateIndexSQL ( $ index , $ table ) ) ; } | Creates a new index on a table . |
3,320 | public function createForeignKey ( ForeignKeyConstraint $ foreignKey , $ table ) { $ this -> _execSql ( $ this -> _platform -> getCreateForeignKeySQL ( $ foreignKey , $ table ) ) ; } | Creates a new foreign key . |
3,321 | public function createView ( View $ view ) { $ this -> _execSql ( $ this -> _platform -> getCreateViewSQL ( $ view -> getQuotedName ( $ this -> _platform ) , $ view -> getSql ( ) ) ) ; } | Creates a new view . |
3,322 | public function dropAndCreateConstraint ( Constraint $ constraint , $ table ) { $ this -> tryMethod ( 'dropConstraint' , $ constraint , $ table ) ; $ this -> createConstraint ( $ constraint , $ table ) ; } | Drops and creates a constraint . |
3,323 | public function dropAndCreateIndex ( Index $ index , $ table ) { $ this -> tryMethod ( 'dropIndex' , $ index -> getQuotedName ( $ this -> _platform ) , $ table ) ; $ this -> createIndex ( $ index , $ table ) ; } | Drops and creates a new index on a table . |
3,324 | public function dropAndCreateForeignKey ( ForeignKeyConstraint $ foreignKey , $ table ) { $ this -> tryMethod ( 'dropForeignKey' , $ foreignKey , $ table ) ; $ this -> createForeignKey ( $ foreignKey , $ table ) ; } | Drops and creates a new foreign key . |
3,325 | public function dropAndCreateSequence ( Sequence $ sequence ) { $ this -> tryMethod ( 'dropSequence' , $ sequence -> getQuotedName ( $ this -> _platform ) ) ; $ this -> createSequence ( $ sequence ) ; } | Drops and create a new sequence . |
3,326 | public function dropAndCreateTable ( Table $ table ) { $ this -> tryMethod ( 'dropTable' , $ table -> getQuotedName ( $ this -> _platform ) ) ; $ this -> createTable ( $ table ) ; } | Drops and creates a new table . |
3,327 | public function dropAndCreateView ( View $ view ) { $ this -> tryMethod ( 'dropView' , $ view -> getQuotedName ( $ this -> _platform ) ) ; $ this -> createView ( $ view ) ; } | Drops and creates a new view . |
3,328 | public function alterTable ( TableDiff $ tableDiff ) { $ queries = $ this -> _platform -> getAlterTableSQL ( $ tableDiff ) ; if ( ! is_array ( $ queries ) || ! count ( $ queries ) ) { return ; } foreach ( $ queries as $ ddlQuery ) { $ this -> _execSql ( $ ddlQuery ) ; } } | Alters an existing tables schema . |
3,329 | public function renameTable ( $ name , $ newName ) { $ tableDiff = new TableDiff ( $ name ) ; $ tableDiff -> newName = $ newName ; $ this -> alterTable ( $ tableDiff ) ; } | Renames a given table to another name . |
3,330 | protected function _getPortableTableColumnList ( $ table , $ database , $ tableColumns ) { $ eventManager = $ this -> _platform -> getEventManager ( ) ; $ list = [ ] ; foreach ( $ tableColumns as $ tableColumn ) { $ column = null ; $ defaultPrevented = false ; if ( $ eventManager !== null && $ eventManager -> hasListen... | Independent of the database the keys of the column list result are lowercased . |
3,331 | protected function _getPortableTableIndexesList ( $ tableIndexRows , $ tableName = null ) { $ result = [ ] ; foreach ( $ tableIndexRows as $ tableIndex ) { $ indexName = $ keyName = $ tableIndex [ 'key_name' ] ; if ( $ tableIndex [ 'primary' ] ) { $ keyName = 'primary' ; } $ keyName = strtolower ( $ keyName ) ; if ( ! ... | Aggregates and groups the index results according to the required data result . |
3,332 | public function createSchema ( ) { $ namespaces = [ ] ; if ( $ this -> _platform -> supportsSchemas ( ) ) { $ namespaces = $ this -> listNamespaceNames ( ) ; } $ sequences = [ ] ; if ( $ this -> _platform -> supportsSequences ( ) ) { $ sequences = $ this -> listSequences ( ) ; } $ tables = $ this -> listTables ( ) ; re... | Creates a schema instance for the current database . |
3,333 | public function createSchemaConfig ( ) { $ schemaConfig = new SchemaConfig ( ) ; $ schemaConfig -> setMaxIdentifierLength ( $ this -> _platform -> getMaxIdentifierLength ( ) ) ; $ searchPaths = $ this -> getSchemaSearchPaths ( ) ; if ( isset ( $ searchPaths [ 0 ] ) ) { $ schemaConfig -> setName ( $ searchPaths [ 0 ] ) ... | Creates the configuration for this schema . |
3,334 | public function extractDoctrineTypeFromComment ( $ comment , $ currentType ) { if ( $ comment !== null && preg_match ( '(\(DC2Type:(((?!\)).)+)\))' , $ comment , $ match ) ) { return $ match [ 1 ] ; } return $ currentType ; } | Given a table comment this method tries to extract a typehint for Doctrine Type or returns the type given as default . |
3,335 | private function buildDsn ( $ host , $ port , $ server , $ dbname , $ username = null , $ password = null , array $ driverOptions = [ ] ) { $ host = $ host ? : 'localhost' ; $ port = $ port ? : 2638 ; if ( ! empty ( $ server ) ) { $ server = ';ServerName=' . $ server ; } return 'HOST=' . $ host . ':' . $ port . $ serve... | Build the connection string for given connection parameters and driver options . |
3,336 | public static function getTypesMap ( ) { return array_map ( static function ( Type $ type ) : string { return get_class ( $ type ) ; } , self :: getTypeRegistry ( ) -> getMap ( ) ) ; } | Gets the types array map which holds all registered types and the corresponding type class |
3,337 | private function _constructPdoDsn ( array $ params , array $ connectionOptions ) { $ dsn = 'sqlsrv:server=' ; if ( isset ( $ params [ 'host' ] ) ) { $ dsn .= $ params [ 'host' ] ; } if ( isset ( $ params [ 'port' ] ) && ! empty ( $ params [ 'port' ] ) ) { $ dsn .= ',' . $ params [ 'port' ] ; } if ( isset ( $ params [ '... | Constructs the Sqlsrv PDO DSN . |
3,338 | private function getConnectionOptionsDsn ( array $ connectionOptions ) : string { $ connectionOptionsDsn = '' ; foreach ( $ connectionOptions as $ paramName => $ paramValue ) { $ connectionOptionsDsn .= sprintf ( ';%s=%s' , $ paramName , $ paramValue ) ; } return $ connectionOptionsDsn ; } | Converts a connection options array to the DSN |
3,339 | private function _constructPdoDsn ( array $ params ) { $ dsn = 'pgsql:' ; if ( isset ( $ params [ 'host' ] ) && $ params [ 'host' ] !== '' ) { $ dsn .= 'host=' . $ params [ 'host' ] . ';' ; } if ( isset ( $ params [ 'port' ] ) && $ params [ 'port' ] !== '' ) { $ dsn .= 'port=' . $ params [ 'port' ] . ';' ; } if ( isset... | Constructs the Postgres PDO DSN . |
3,340 | public function generateCacheKeys ( $ query , $ params , $ types , array $ connectionParams = [ ] ) { $ realCacheKey = 'query=' . $ query . '¶ms=' . serialize ( $ params ) . '&types=' . serialize ( $ types ) . '&connectionParams=' . hash ( 'sha256' , serialize ( $ connectionParams ) ) ; if ( $ this -> cacheKey === ... | Generates the real cache key from query params types and connection parameters . |
3,341 | private function bindTypedParameters ( ) { $ streams = $ values = [ ] ; $ types = $ this -> types ; foreach ( $ this -> _bindedValues as $ parameter => $ value ) { if ( ! isset ( $ types [ $ parameter - 1 ] ) ) { $ types [ $ parameter - 1 ] = static :: $ _paramTypeMap [ ParameterType :: STRING ] ; } if ( $ types [ $ pa... | Binds parameters with known types previously bound to the statement |
3,342 | private function bindUntypedValues ( array $ values ) { $ params = [ ] ; $ types = str_repeat ( 's' , count ( $ values ) ) ; foreach ( $ values as & $ v ) { $ params [ ] = & $ v ; } return $ this -> _stmt -> bind_param ( $ types , ... $ params ) ; } | Binds a array of values to bound parameters . |
3,343 | public static function fromSQLAnywhereError ( $ conn = null , $ stmt = null ) { $ state = $ conn ? sasql_sqlstate ( $ conn ) : sasql_sqlstate ( ) ; $ code = null ; $ message = null ; if ( $ stmt ) { $ code = sasql_stmt_errno ( $ stmt ) ; $ message = sasql_stmt_error ( $ stmt ) ; } if ( $ conn && ! $ code ) { $ code = s... | Helper method to turn SQL Anywhere error into exception . |
3,344 | protected function _setName ( $ name ) { if ( $ this -> isIdentifierQuoted ( $ name ) ) { $ this -> _quoted = true ; $ name = $ this -> trimQuotes ( $ name ) ; } if ( strpos ( $ name , '.' ) !== false ) { $ parts = explode ( '.' , $ name ) ; $ this -> _namespace = $ parts [ 0 ] ; $ name = $ parts [ 1 ] ; } $ this -> _n... | Sets the name of this asset . |
3,345 | public function getQuotedName ( AbstractPlatform $ platform ) { $ keywords = $ platform -> getReservedKeywordsList ( ) ; $ parts = explode ( '.' , $ this -> getName ( ) ) ; foreach ( $ parts as $ k => $ v ) { $ parts [ $ k ] = $ this -> _quoted || $ keywords -> isKeyword ( $ v ) ? $ platform -> quoteIdentifier ( $ v ) ... | Gets the quoted representation of this asset but only if it was defined with one . Otherwise return the plain unquoted value as inserted . |
3,346 | protected function _generateIdentifierName ( $ columnNames , $ prefix = '' , $ maxSize = 30 ) { $ hash = implode ( '' , array_map ( static function ( $ column ) { return dechex ( crc32 ( $ column ) ) ; } , $ columnNames ) ) ; return strtoupper ( substr ( $ prefix . '_' . $ hash , 0 , $ maxSize ) ) ; } | Generates an identifier from a list of column names obeying a certain string length . |
3,347 | public function nextValue ( $ sequenceName ) { if ( isset ( $ this -> sequences [ $ sequenceName ] ) ) { $ value = $ this -> sequences [ $ sequenceName ] [ 'value' ] ; $ this -> sequences [ $ sequenceName ] [ 'value' ] ++ ; if ( $ this -> sequences [ $ sequenceName ] [ 'value' ] >= $ this -> sequences [ $ sequenceName ... | Generates the next unused value for the given sequence name . |
3,348 | protected function getCreateColumnCommentSQL ( $ tableName , $ columnName , $ comment ) { if ( strpos ( $ tableName , '.' ) !== false ) { [ $ schemaSQL , $ tableSQL ] = explode ( '.' , $ tableName ) ; $ schemaSQL = $ this -> quoteStringLiteral ( $ schemaSQL ) ; $ tableSQL = $ this -> quoteStringLiteral ( $ tableSQL ) ;... | Returns the SQL statement for creating a column comment . |
3,349 | public function getDefaultConstraintDeclarationSQL ( $ table , array $ column ) { if ( ! isset ( $ column [ 'default' ] ) ) { throw new InvalidArgumentException ( "Incomplete column definition. 'default' required." ) ; } $ columnName = new Identifier ( $ column [ 'name' ] ) ; return ' CONSTRAINT ' . $ this -> generateD... | Returns the SQL snippet for declaring a default constraint . |
3,350 | private function _appendUniqueConstraintDefinition ( $ sql , Index $ index ) { $ fields = [ ] ; foreach ( $ index -> getQuotedColumns ( $ this ) as $ field ) { $ fields [ ] = $ field . ' IS NOT NULL' ; } return $ sql . ' WHERE ' . implode ( ' AND ' , $ fields ) ; } | Extend unique key constraint with required filters |
3,351 | private function getAlterTableAddDefaultConstraintClause ( $ tableName , Column $ column ) { $ columnDef = $ column -> toArray ( ) ; $ columnDef [ 'name' ] = $ column -> getQuotedName ( $ this ) ; return 'ADD' . $ this -> getDefaultConstraintDeclarationSQL ( $ tableName , $ columnDef ) ; } | Returns the SQL clause for adding a default constraint in an ALTER TABLE statement . |
3,352 | private function alterColumnRequiresDropDefaultConstraint ( ColumnDiff $ columnDiff ) { if ( ! $ columnDiff -> fromColumn instanceof Column ) { return false ; } if ( $ columnDiff -> fromColumn -> getDefault ( ) === null ) { return false ; } if ( $ columnDiff -> hasChanged ( 'default' ) ) { return true ; } return $ colu... | Checks whether a column alteration requires dropping its default constraint first . |
3,353 | protected function getAlterColumnCommentSQL ( $ tableName , $ columnName , $ comment ) { if ( strpos ( $ tableName , '.' ) !== false ) { [ $ schemaSQL , $ tableSQL ] = explode ( '.' , $ tableName ) ; $ schemaSQL = $ this -> quoteStringLiteral ( $ schemaSQL ) ; $ tableSQL = $ this -> quoteStringLiteral ( $ tableSQL ) ; ... | Returns the SQL statement for altering a column comment . |
3,354 | protected function getDropColumnCommentSQL ( $ tableName , $ columnName ) { if ( strpos ( $ tableName , '.' ) !== false ) { [ $ schemaSQL , $ tableSQL ] = explode ( '.' , $ tableName ) ; $ schemaSQL = $ this -> quoteStringLiteral ( $ schemaSQL ) ; $ tableSQL = $ this -> quoteStringLiteral ( $ tableSQL ) ; } else { $ sc... | Returns the SQL statement for dropping a column comment . |
3,355 | public function getAddExtendedPropertySQL ( $ name , $ value = null , $ level0Type = null , $ level0Name = null , $ level1Type = null , $ level1Name = null , $ level2Type = null , $ level2Name = null ) { return 'EXEC sp_addextendedproperty ' . 'N' . $ this -> quoteStringLiteral ( $ name ) . ', N' . $ this -> quoteStrin... | Returns the SQL statement for adding an extended property to a database object . |
3,356 | public function getDropExtendedPropertySQL ( $ name , $ level0Type = null , $ level0Name = null , $ level1Type = null , $ level1Name = null , $ level2Type = null , $ level2Name = null ) { return 'EXEC sp_dropextendedproperty ' . 'N' . $ this -> quoteStringLiteral ( $ name ) . ', ' . 'N' . $ this -> quoteStringLiteral (... | Returns the SQL statement for dropping an extended property from a database object . |
3,357 | private function getTableWhereClause ( $ table , $ schemaColumn , $ tableColumn ) { if ( strpos ( $ table , '.' ) !== false ) { [ $ schema , $ table ] = explode ( '.' , $ table ) ; $ schema = $ this -> quoteStringLiteral ( $ schema ) ; $ table = $ this -> quoteStringLiteral ( $ table ) ; } else { $ schema = 'SCHEMA_NAM... | Returns the where clause to filter schema and table name in a query . |
3,358 | private function isOrderByInTopNSubquery ( $ query , $ currentPosition ) { $ subQueryBuffer = '' ; $ parenCount = 0 ; while ( $ parenCount >= 0 && $ currentPosition >= 0 ) { if ( $ query [ $ currentPosition ] === '(' ) { $ parenCount -- ; } elseif ( $ query [ $ currentPosition ] === ')' ) { $ parenCount ++ ; } $ subQue... | Check an ORDER BY clause to see if it is in a TOP N query or subquery . |
3,359 | private function generateIdentifierName ( $ identifier ) { $ identifier = new Identifier ( $ identifier ) ; return strtoupper ( dechex ( crc32 ( $ identifier -> getName ( ) ) ) ) ; } | Returns a hash value for a given identifier . |
3,360 | public function get ( string $ name ) : Type { if ( ! isset ( $ this -> instances [ $ name ] ) ) { throw DBALException :: unknownColumnType ( $ name ) ; } return $ this -> instances [ $ name ] ; } | Finds a type by the given name . |
3,361 | public function lookupName ( Type $ type ) : string { $ name = $ this -> findTypeName ( $ type ) ; if ( $ name === null ) { throw DBALException :: typeNotRegistered ( $ type ) ; } return $ name ; } | Finds a name for the given type . |
3,362 | public function register ( string $ name , Type $ type ) : void { if ( isset ( $ this -> instances [ $ name ] ) ) { throw DBALException :: typeExists ( $ name ) ; } if ( $ this -> findTypeName ( $ type ) !== null ) { throw DBALException :: typeAlreadyRegistered ( $ type ) ; } $ this -> instances [ $ name ] = $ type ; } | Registers a custom type to the type map . |
3,363 | public static function fromConnectionParameters ( array $ params ) : self { if ( ! empty ( $ params [ 'connectstring' ] ) ) { return new self ( $ params [ 'connectstring' ] ) ; } if ( empty ( $ params [ 'host' ] ) ) { return new self ( $ params [ 'dbname' ] ?? '' ) ; } $ connectData = [ ] ; if ( isset ( $ params [ 'ser... | Creates the object from the given DBAL connection parameters . |
3,364 | private static function formatParameters ( array $ params ) { return '[' . implode ( ', ' , array_map ( static function ( $ param ) { if ( is_resource ( $ param ) ) { return ( string ) $ param ; } $ json = @ json_encode ( $ param ) ; if ( ! is_string ( $ json ) || $ json === 'null' && is_string ( $ param ) ) { return s... | Returns a human - readable representation of an array of parameters . This properly handles binary data by returning a hex representation . |
3,365 | public function getSchemaSearchPaths ( ) { $ params = $ this -> _conn -> getParams ( ) ; $ schema = explode ( ',' , $ this -> _conn -> fetchColumn ( 'SHOW search_path' ) ) ; if ( isset ( $ params [ 'user' ] ) ) { $ schema = str_replace ( '"$user"' , $ params [ 'user' ] , $ schema ) ; } return array_map ( 'trim' , $ sch... | Returns an array of schema search paths . |
3,366 | public function determineExistingSchemaSearchPaths ( ) { $ names = $ this -> getSchemaNames ( ) ; $ paths = $ this -> getSchemaSearchPaths ( ) ; $ this -> existingSchemaPaths = array_filter ( $ paths , static function ( $ v ) use ( $ names ) { return in_array ( $ v , $ names ) ; } ) ; } | Sets or resets the order of the existing schemas in the current search path of the user . |
3,367 | public function hasNamespace ( $ namespaceName ) { $ namespaceName = strtolower ( $ this -> getUnquotedAssetName ( $ namespaceName ) ) ; return isset ( $ this -> namespaces [ $ namespaceName ] ) ; } | Does this schema have a namespace with the given name? |
3,368 | public function hasTable ( $ tableName ) { $ tableName = $ this -> getFullQualifiedAssetName ( $ tableName ) ; return isset ( $ this -> _tables [ $ tableName ] ) ; } | Does this schema have a table with the given name? |
3,369 | public function createNamespace ( $ namespaceName ) { $ unquotedNamespaceName = strtolower ( $ this -> getUnquotedAssetName ( $ namespaceName ) ) ; if ( isset ( $ this -> namespaces [ $ unquotedNamespaceName ] ) ) { throw SchemaException :: namespaceAlreadyExists ( $ unquotedNamespaceName ) ; } $ this -> namespaces [ $... | Creates a new namespace . |
3,370 | public function dropTable ( $ tableName ) { $ tableName = $ this -> getFullQualifiedAssetName ( $ tableName ) ; $ this -> getTable ( $ tableName ) ; unset ( $ this -> _tables [ $ tableName ] ) ; return $ this ; } | Drops a table from the schema . |
3,371 | public function createSequence ( $ sequenceName , $ allocationSize = 1 , $ initialValue = 1 ) { $ seq = new Sequence ( $ sequenceName , $ allocationSize , $ initialValue ) ; $ this -> _addSequence ( $ seq ) ; return $ seq ; } | Creates a new sequence . |
3,372 | public function toSql ( AbstractPlatform $ platform ) { $ sqlCollector = new CreateSchemaSqlCollector ( $ platform ) ; $ this -> visit ( $ sqlCollector ) ; return $ sqlCollector -> getQueries ( ) ; } | Returns an array of necessary SQL queries to create the schema on the given platform . |
3,373 | public function toDropSql ( AbstractPlatform $ platform ) { $ dropSqlCollector = new DropSchemaSqlCollector ( $ platform ) ; $ this -> visit ( $ dropSqlCollector ) ; return $ dropSqlCollector -> getQueries ( ) ; } | Return an array of necessary SQL queries to drop the schema on the given platform . |
3,374 | private function createStripHostsPatterns ( $ stripHostsConfig ) { if ( ! is_array ( $ stripHostsConfig ) ) { return $ stripHostsConfig ; } $ patterns = [ ] ; foreach ( $ stripHostsConfig as $ entry ) { if ( ! strlen ( $ entry ) ) { continue ; } if ( '/private' === $ entry || '/local' === $ entry ) { $ patterns [ ] = [... | Create patterns from strip - hosts |
3,375 | private function applyStripHosts ( ) { if ( false === $ this -> stripHosts ) { return ; } foreach ( $ this -> selected as $ uniqueName => $ package ) { $ sources = [ ] ; if ( $ package -> getSourceType ( ) ) { $ sources [ ] = 'source' ; } if ( $ package -> getDistType ( ) ) { $ sources [ ] = 'dist' ; } foreach ( $ sour... | Apply the patterns from strip - hosts |
3,376 | private function matchStripHostsPatterns ( $ url ) { if ( Filesystem :: isLocalPath ( $ url ) ) { return true ; } if ( is_array ( $ this -> stripHosts ) ) { $ url = trim ( parse_url ( $ url , PHP_URL_HOST ) , '[]' ) ; if ( false !== filter_var ( $ url , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ) ) { $ urltype = 'ipv4' ; }... | Match an URL against the patterns from strip - hosts |
3,377 | private function matchAddr ( $ addr1 , $ addr2 , $ len = 0 , $ chunklen = 32 ) { for ( ; $ len > 0 ; $ len -= $ chunklen , next ( $ addr1 ) , next ( $ addr2 ) ) { $ shift = $ len >= $ chunklen ? 0 : $ chunklen - $ len ; if ( ( current ( $ addr1 ) >> $ shift ) !== ( current ( $ addr2 ) >> $ shift ) ) { return false ; } ... | Test if two addresses have the same prefix |
3,378 | private function addRepositories ( Pool $ pool , array $ repos ) { foreach ( $ repos as $ repo ) { try { $ pool -> addRepository ( $ repo ) ; } catch ( \ Exception $ exception ) { if ( ! $ this -> skipErrors ) { throw $ exception ; } $ this -> output -> writeln ( sprintf ( "<error>Skipping Exception '%s'.</error>" , $ ... | Add repositories to a pool |
3,379 | private function setSelectedAsAbandoned ( ) { foreach ( $ this -> selected as $ name => $ package ) { if ( array_key_exists ( $ package -> getName ( ) , $ this -> abandoned ) ) { $ package -> setAbandoned ( $ this -> abandoned [ $ package -> getName ( ) ] ) ; } } } | Marks selected packages as abandoned by Configuration file |
3,380 | private function getFilteredLinks ( Composer $ composer ) { $ links = array_values ( $ composer -> getPackage ( ) -> getRequires ( ) ) ; if ( $ this -> hasFilterForPackages ( ) ) { $ packagesFilter = $ this -> packagesFilter ; $ links = array_filter ( $ links , function ( Link $ link ) use ( $ packagesFilter ) { return... | Gets a list of filtered Links . |
3,381 | private function getAllLinks ( $ repos , $ minimumStability , $ verbose ) { $ links = [ ] ; foreach ( $ repos as $ repo ) { if ( $ repo instanceof ComposerRepository && $ repo -> hasProviders ( ) ) { foreach ( $ repo -> getProviderNames ( ) as $ name ) { $ links [ ] = new Link ( '__root__' , $ name , new EmptyConstrain... | Gets all Links . |
3,382 | private function getDepRepos ( Composer $ composer ) { $ depRepos = [ ] ; if ( \ is_array ( $ this -> depRepositories ) ) { $ rm = $ composer -> getRepositoryManager ( ) ; foreach ( $ this -> depRepositories as $ index => $ repoConfig ) { $ name = \ is_int ( $ index ) && isset ( $ repoConfig [ 'url' ] ) ? $ repoConfig ... | Create the additional repositories |
3,383 | private function getPackages ( RepositoryInterface $ repo ) { $ packages = [ ] ; if ( $ this -> hasFilterForPackages ( ) ) { foreach ( $ this -> packagesFilter as $ filter ) { $ packages += $ repo -> findPackages ( $ filter ) ; } } else { $ packages = $ repo -> getPackages ( ) ; } return $ packages ; } | Gets All or filtered Packages of a Repository . |
3,384 | private function getRequired ( PackageInterface $ package , bool $ isRoot ) { $ required = [ ] ; if ( $ this -> requireDependencies ) { $ required = $ package -> getRequires ( ) ; } if ( ( $ isRoot || ! $ this -> requireDependencyFilter ) && $ this -> requireDevDependencies ) { $ required = array_merge ( $ required , $... | Gets the required Links if needed . |
3,385 | private function filterRepositories ( array $ repositories ) { $ url = $ this -> repositoryFilter ; return array_filter ( $ repositories , function ( $ repository ) use ( $ url ) { if ( ! ( $ repository instanceof ConfigurableRepositoryInterface ) ) { return false ; } $ config = $ repository -> getRepoConfig ( ) ; if (... | Filter given repositories . |
3,386 | private function setDependencies ( array $ packages ) : self { $ dependencies = [ ] ; foreach ( $ packages as $ package ) { foreach ( $ package -> getRequires ( ) as $ link ) { $ dependencies [ $ link -> getTarget ( ) ] [ $ link -> getSource ( ) ] = $ link -> getSource ( ) ; } } $ this -> dependencies = $ dependencies ... | Defines the required packages . |
3,387 | private function getMappedPackageList ( array $ packages ) : array { $ groupedPackages = $ this -> groupPackagesByName ( $ packages ) ; $ mappedPackages = [ ] ; foreach ( $ groupedPackages as $ name => $ packages ) { $ highest = $ this -> getHighestVersion ( $ packages ) ; $ mappedPackages [ $ name ] = [ 'highest' => $... | Gets a list of packages grouped by name with a list of versions . |
3,388 | private function groupPackagesByName ( array $ packages ) : array { $ groupedPackages = [ ] ; foreach ( $ packages as $ package ) { $ groupedPackages [ $ package -> getName ( ) ] [ ] = $ package ; } return $ groupedPackages ; } | Gets a list of packages grouped by name . |
3,389 | private function getHighestVersion ( array $ packages ) : ? PackageInterface { $ highestVersion = null ; foreach ( $ packages as $ package ) { if ( null === $ highestVersion || version_compare ( $ package -> getVersion ( ) , $ highestVersion -> getVersion ( ) , '>=' ) ) { $ highestVersion = $ package ; } } return $ hig... | Gets the highest version of packages . |
3,390 | private function getDescSortedVersions ( array $ packages ) : array { usort ( $ packages , function ( PackageInterface $ a , PackageInterface $ b ) { return version_compare ( $ b -> getVersion ( ) , $ a -> getVersion ( ) ) ; } ) ; return $ packages ; } | Sorts by version the list of packages . |
3,391 | public function parse ( ) { if ( ! $ this -> isHbbTv ( ) ) { return false ; } parent :: parse ( ) ; $ this -> deviceType = self :: DEVICE_TYPE_TV ; return true ; } | Parses the current UA and checks whether it contains HbbTv information |
3,392 | public function setUserAgent ( $ userAgent ) { if ( $ this -> userAgent != $ userAgent ) { $ this -> reset ( ) ; } $ this -> userAgent = $ userAgent ; } | Sets the useragent to be parsed |
3,393 | public function isDesktop ( ) { $ osShort = $ this -> getOs ( 'short_name' ) ; if ( empty ( $ osShort ) || self :: UNKNOWN == $ osShort ) { return false ; } if ( $ this -> usesMobileBrowser ( ) ) { return false ; } $ decodedFamily = OperatingSystem :: getOsFamily ( $ osShort ) ; return in_array ( $ decodedFamily , self... | Returns if the parsed UA was identified as desktop device Desktop devices are all devices with an unknown type that are running a desktop os |
3,394 | public function getOs ( $ attr = '' ) { if ( $ attr == '' ) { return $ this -> os ; } if ( ! isset ( $ this -> os [ $ attr ] ) ) { return self :: UNKNOWN ; } return $ this -> os [ $ attr ] ; } | Returns the operating system data extracted from the parsed UA |
3,395 | public function getClient ( $ attr = '' ) { if ( $ attr == '' ) { return $ this -> client ; } if ( ! isset ( $ this -> client [ $ attr ] ) ) { return self :: UNKNOWN ; } return $ this -> client [ $ attr ] ; } | Returns the client data extracted from the parsed UA |
3,396 | public function parse ( ) { if ( $ this -> isParsed ( ) ) { return ; } $ this -> parsed = true ; if ( empty ( $ this -> userAgent ) || ! preg_match ( '/([a-z])/i' , $ this -> userAgent ) ) { return ; } $ this -> parseBot ( ) ; if ( $ this -> isBot ( ) ) { return ; } $ this -> parseOs ( ) ; $ this -> parseClient ( ) ; $... | Triggers the parsing of the current user agent |
3,397 | protected function parseBot ( ) { if ( $ this -> skipBotDetection ) { $ this -> bot = false ; return false ; } $ parsers = $ this -> getBotParsers ( ) ; foreach ( $ parsers as $ parser ) { $ parser -> setUserAgent ( $ this -> getUserAgent ( ) ) ; $ parser -> setYamlParser ( $ this -> getYamlParser ( ) ) ; $ parser -> s... | Parses the UA for bot information using the Bot parser |
3,398 | public static function getInfoFromUserAgent ( $ ua ) { $ deviceDetector = new DeviceDetector ( $ ua ) ; $ deviceDetector -> parse ( ) ; if ( $ deviceDetector -> isBot ( ) ) { return array ( 'user_agent' => $ deviceDetector -> getUserAgent ( ) , 'bot' => $ deviceDetector -> getBot ( ) ) ; } $ osFamily = OperatingSystem ... | Parses a useragent and returns the detected data |
3,399 | public function setCache ( $ cache ) { if ( $ cache instanceof Cache || ( class_exists ( '\Doctrine\Common\Cache\CacheProvider' ) && $ cache instanceof \ Doctrine \ Common \ Cache \ CacheProvider ) ) { $ this -> cache = $ cache ; return ; } throw new \ Exception ( 'Cache not supported' ) ; } | Sets the Cache class |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.