idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
3,500 | protected function marshall ( QtiComponent $ component ) { $ element = parent :: marshall ( $ component ) ; $ this -> setDOMElementAttribute ( $ element , 'href' , $ component -> getHref ( ) ) ; return $ element ; } | Marshall an AssessmentSectionRef object into a DOMElement object . |
3,501 | protected function unmarshall ( DOMElement $ element ) { $ baseComponent = parent :: unmarshall ( $ element ) ; if ( ( $ href = $ this -> getDOMElementAttributeAs ( $ element , 'href' , 'string' ) ) !== null ) { $ object = new AssessmentSectionRef ( $ baseComponent -> getIdentifier ( ) , $ href ) ; $ object -> setRequi... | Unmarshall a DOMElement object corresponding to a QTI assessmentSectionRef element . |
3,502 | public function setSummary ( $ summary ) { if ( is_string ( $ summary ) === true ) { $ this -> summary = $ summary ; } else { $ msg = "The 'summary' argument must be a string, '" . gettype ( $ summary ) . "' given." ; throw new InvalidArgumentException ( $ msg ) ; } } | Set the value of the summary attribute . An empty string means there is no summary . |
3,503 | public function process ( ) { $ operands = $ this -> getOperands ( ) ; if ( $ operands -> containsNull ( ) === true ) { return null ; } if ( $ operands -> exclusivelyMultipleOrOrdered ( ) === false ) { $ msg = "The Random operator only accepts values with multiple or ordered cardinality." ; throw new OperatorProcessing... | Process the Random operator . |
3,504 | public function export ( $ options = array ( ) ) { $ itemService = \ taoItems_models_classes_ItemsService :: singleton ( ) ; $ source = $ itemService -> getItemDirectory ( $ this -> getItem ( ) ) ; $ files = $ source -> getFlyIterator ( Directory :: ITERATOR_FILE | Directory :: ITERATOR_RECURSIVE ) ; foreach ( $ files ... | Overriden export for OWIs |
3,505 | public function importContent ( $ package , $ item , $ language = '' , $ validate = true ) { $ packageParser = new PackageParser ( $ package ) ; $ packageParser -> validate ( ) ; if ( $ packageParser -> isValid ( ) ) { $ folder = $ packageParser -> extract ( ) ; if ( ! is_dir ( $ folder ) ) { throw new taoItems_models_... | import the owi as content into an existing item replacing the old content |
3,506 | public function render ( core_kernel_classes_Resource $ item , $ langCode ) { $ itemService = taoItems_models_classes_ItemsService :: singleton ( ) ; $ file = $ itemService -> getItemDirectory ( $ item ) -> getFile ( 'index.html' ) ; $ xhtml = $ file -> read ( ) ; $ xhtml = $ this -> replaceDeprecatedApis ( $ xhtml ) ;... | Render an XHTML item . |
3,507 | protected function replaceDeprecatedApis ( $ xhtml ) { $ dom = new DOMDocument ( '1.0' , TAO_DEFAULT_ENCODING ) ; if ( ! $ dom -> loadHTML ( $ xhtml ) ) { throw new taoItems_models_classes_ItemModelException ( "An error occured while loading the XML content of the rendered item." ) ; } $ found = 0 ; $ deprecatedApis = ... | Removes unnescessary API references |
3,508 | public function validate ( $ schema = '' ) { $ forced = $ this -> valid ; $ this -> valid = true ; try { switch ( $ this -> sourceType ) { case self :: SOURCE_FILE : if ( ! file_exists ( $ this -> source ) ) { throw new Exception ( "File " . $ this -> source . " not found." ) ; } if ( ! is_readable ( $ this -> source )... | Validate the zip archive . Local and remote file are allowed . - Check if file is found - Check content is not empty - Check extension as zip - In case of local check path security - Then validate archive |
3,509 | public function extract ( ) { $ content = '' ; $ folder = tao_helpers_File :: createTempDir ( ) ; $ zip = new ZipArchive ( ) ; $ source = $ this -> getExtractedSource ( ) ; if ( $ zip -> open ( $ source ) === true ) { if ( tao_helpers_File :: checkWhetherArchiveIsBomb ( $ zip ) ) { throw new \ common_Exception ( sprint... | Extract the zip archive and return the path to extracted package |
3,510 | protected function isValidArchive ( ) { $ isValid = false ; $ zip = new ZipArchive ( ) ; if ( $ zip -> open ( $ this -> getExtractedSource ( ) , ZIPARCHIVE :: CHECKCONS ) !== false ) { if ( $ zip -> locateName ( "index.html" ) !== false ) { $ isValid = true ; } else { $ this -> addError ( __ ( "An Open Web Item package... | Check if the archive is valid by checking if an index . html exists at package root |
3,511 | protected function getExtractedSource ( ) { if ( $ this -> source instanceof File ) { $ this -> tmpDirectory = tao_helpers_File :: createTempDir ( ) ; $ this -> tmpFile = $ this -> tmpDirectory . uniqid ( 'owiArchive' ) . 'zip' ; $ sourceResource = $ this -> source -> readStream ( ) ; $ destinationResource = fopen ( $ ... | Get a real path of source . If the source is a remote file download it and return the new path . |
3,512 | public function write ( string $ siteIdentifier , array $ configuration ) : void { $ fileName = $ this -> configPath . '/' . $ siteIdentifier . '/' . $ this -> configFileName ; if ( ! file_exists ( $ fileName ) ) { GeneralUtility :: mkdir_deep ( $ this -> configPath . '/' . $ siteIdentifier ) ; } $ yamlFileContents = Y... | Add or update a site configuration |
3,513 | public function cleanConfig ( array $ baseConfig , array ... $ referenceConfigs ) : array { $ cleanedConfig = $ baseConfig ; foreach ( $ referenceConfigs as $ referenceConfig ) { $ cleanedConfig = $ this -> removeIdenticalValues ( $ cleanedConfig , $ referenceConfig ) ; } return $ this -> sortConfig ( $ cleanedConfig )... | Remove all conf settings that are identical to the ones in default config which makes the setting obsolete |
3,514 | public function getMergedLocalConfiguration ( ) : array { if ( $ this -> mainConfig === null ) { $ this -> mainConfig = $ this -> configLoader -> load ( ) ; } return $ this -> mainConfig ; } | Returns local configuration array merged with default configuration |
3,515 | public function updateLocalConfiguration ( array $ configurationToMerge ) { unset ( $ configurationToMerge [ 'EXT' ] [ 'extConf' ] ) ; $ overrideSettingsFile = SettingsFiles :: getOverrideSettingsFile ( ) ; if ( ! $ this -> canWriteConfiguration ( ) ) { throw new \ RuntimeException ( $ overrideSettingsFile . ' is not w... | Override local configuration with new values . |
3,516 | public function removeLocalConfigurationKeysByPath ( array $ keys ) { $ result = false ; $ localConfiguration = $ this -> getLocalConfiguration ( ) ; foreach ( $ keys as $ path ) { if ( ArrayUtility :: isValidPath ( $ localConfiguration , $ path ) ) { $ result = true ; $ localConfiguration = ArrayUtility :: removeByPat... | Remove keys from LocalConfiguration |
3,517 | public function canWriteConfiguration ( ) { $ fileLocation = SettingsFiles :: getOverrideSettingsFile ( ) ; return @ is_writable ( file_exists ( $ fileLocation ) ? $ fileLocation : Environment :: getConfigPath ( ) . '/' ) ; } | Checks if the configuration can be written . |
3,518 | public function createLocalConfigurationFromFactoryConfiguration ( ) { if ( file_exists ( $ this -> getLocalConfigurationFileLocation ( ) ) ) { throw new \ RuntimeException ( 'LocalConfiguration.php exists already' , 1364836026 ) ; } $ localConfigurationArray = require $ this -> getFactoryConfigurationFileLocation ( ) ... | Uses FactoryConfiguration file and a possible AdditionalFactoryConfiguration file in typo3conf to create a basic LocalConfiguration . php . This is used by the install tool in an early step . |
3,519 | static function getParamType ( \ ReflectionParameter $ refParam ) { $ export = \ ReflectionParameter :: export ( [ $ refParam -> getDeclaringClass ( ) -> name , $ refParam -> getDeclaringFunction ( ) -> name ] , $ refParam -> name , true ) ; $ export = str_replace ( ' or NULL' , '' , $ export ) ; $ type = preg_replace ... | Tries to find out if the type of the given parameter . Will return empty string if not possible . |
3,520 | function openTable ( ) { $ this -> examples = [ ] ; $ this -> markdown = '' ; $ this -> declareAbstraction = true ; $ this -> add ( '| Visibility | Function |' ) ; $ this -> add ( '|:-----------|:---------|' ) ; } | Begin generating a new markdown - formatted table |
3,521 | public static function formatExampleComment ( $ example ) { $ example = self :: stripCodeTags ( $ example ) ; if ( preg_match ( '/(\n )/' , $ example ) ) { $ example = preg_replace ( '/(\n )/' , "\n" , $ example ) ; } elseif ( preg_match ( '/(\n )/' , $ example ) ) { $ example = preg_replace ( '/(\n )... | Create a markdown - formatted code view out of an example comment |
3,522 | function generateTitle ( $ format = '%label%: %name% %extra%' ) { $ translate = [ '%label%' => $ this -> isInterface ( ) ? 'Interface' : 'Class' , '%name%' => substr_count ( $ this -> getName ( ) , '\\' ) == 1 ? substr ( $ this -> getName ( ) , 1 ) : $ this -> getName ( ) , '%extra%' => '' ] ; if ( strpos ( $ format , ... | Generate a title describing the class this object is referring to |
3,523 | protected function _expandPrefix ( $ path ) { if ( preg_match ( self :: PLUGIN_PATTERN , $ path ) ) { return $ this -> _expandPlugin ( $ path ) ; } if ( $ this -> theme && preg_match ( self :: THEME_PATTERN , $ path ) ) { return $ this -> _expandTheme ( $ path ) ; } return $ path ; } | Resolve a plugin or theme path into the file path without the search paths . |
3,524 | protected function _expandTheme ( $ file ) { $ file = preg_replace ( self :: THEME_PATTERN , '' , $ file ) ; return CorePlugin :: path ( $ this -> theme ) . 'webroot' . DS . $ file ; } | Resolve a themed file to its full path . The file will be found on the current theme s path . |
3,525 | protected function _expandPlugin ( $ file ) { preg_match ( self :: PLUGIN_PATTERN , $ file , $ matches ) ; if ( empty ( $ matches [ 1 ] ) || empty ( $ matches [ 2 ] ) ) { throw new RuntimeException ( 'Missing required parameters' ) ; } if ( ! CorePlugin :: isLoaded ( $ matches [ 1 ] ) ) { throw new RuntimeException ( $... | Resolve a plugin file to its full path . |
3,526 | public function beforeDispatch ( Event $ event ) { deprecationWarning ( 'AssetCompressorFilter is deprecated. ' . 'You should update to use AssetCompress\Middleware\AssetCompressMiddleware instead.' ) ; $ request = $ event -> data [ 'request' ] ; $ response = $ event -> data [ 'response' ] ; $ config = $ this -> _getCo... | Checks if request is for a compiled asset otherwise skip any operation |
3,527 | protected function getName ( $ config , $ url ) { $ parts = explode ( '.' , $ url ) ; if ( count ( $ parts ) < 2 ) { return false ; } $ path = $ config -> cachePath ( $ parts [ ( count ( $ parts ) - 1 ) ] ) ; if ( empty ( $ path ) ) { return false ; } $ root = str_replace ( '\\' , '/' , WWW_ROOT ) ; $ path = str_replac... | Returns the build name for a requested asset |
3,528 | protected function _getConfig ( ) { if ( $ this -> config === null ) { $ configFinder = new ConfigFinder ( ) ; $ this -> config = $ configFinder -> loadAll ( ) ; } return $ this -> config ; } | Config setter used for testing the filter . |
3,529 | protected function factory ( ) { if ( empty ( $ this -> factory ) ) { $ this -> config -> theme ( $ this -> getView ( ) -> getTheme ( ) ) ; $ this -> factory = new Factory ( $ this -> config ) ; } return $ this -> factory ; } | Get the AssetCompress factory based on the config object . |
3,530 | protected function collection ( ) { if ( empty ( $ this -> collection ) ) { $ this -> collection = $ this -> factory ( ) -> assetCollection ( ) ; } return $ this -> collection ; } | Get the AssetCollection |
3,531 | protected function writer ( ) { if ( empty ( $ this -> writer ) ) { $ this -> writer = $ this -> factory ( ) -> writer ( ) ; } return $ this -> writer ; } | Get the AssetWriter |
3,532 | protected function _addExt ( $ file , $ ext ) { if ( substr ( $ file , strlen ( $ ext ) * - 1 ) !== $ ext ) { $ file .= $ ext ; } return $ file ; } | Adds an extension if the file doesn t already end with it . |
3,533 | public function css ( $ file , $ options = [ ] ) { $ file = $ this -> _addExt ( $ file , '.css' ) ; if ( ! $ this -> collection ( ) -> contains ( $ file ) ) { throw new RuntimeException ( "Cannot create a stylesheet tag for a '$file'. That build is not defined." ) ; } $ output = '' ; if ( ! empty ( $ options [ 'raw' ] ... | Create a CSS file . Will generate link tags for either the dynamic build controller or the generated file if it exists . |
3,534 | protected function _relativizePath ( $ path ) { $ plugins = Plugin :: loaded ( ) ; $ index = array_search ( 'AssetCompress' , $ plugins ) ; unset ( $ plugins [ $ index ] ) ; foreach ( $ plugins as $ plugin ) { $ pluginPath = Plugin :: path ( $ plugin ) . 'webroot' ; if ( strpos ( $ path , $ pluginPath ) === 0 ) { retur... | Converts an absolute path into a web relative one . |
3,535 | public function url ( $ file = null , $ full = false ) { $ collection = $ this -> collection ( ) ; if ( ! $ collection -> contains ( $ file ) ) { throw new RuntimeException ( 'Cannot get URL for build file that does not exist.' ) ; } $ options = $ full ; if ( ! is_array ( $ full ) ) { $ options = [ 'full' => $ full ] ;... | Get the URL for a given asset name . |
3,536 | protected function _getRoute ( AssetTarget $ file , $ base ) { $ query = [ ] ; if ( $ file -> isThemed ( ) ) { $ query [ 'theme' ] = $ this -> theme ; } $ base = rtrim ( $ base , '/' ) . '/' ; $ query = empty ( $ query ) ? '' : '?' . http_build_query ( $ query ) ; return $ base . $ file -> name ( ) . $ query ; } | Get the dynamic build path for an asset . |
3,537 | public function inlineCss ( $ file ) { $ collection = $ this -> collection ( ) ; if ( ! $ collection -> contains ( $ file ) ) { throw new RuntimeException ( 'Cannot create a stylesheet for a build that does not exist.' ) ; } $ compiler = $ this -> factory ( ) -> compiler ( ) ; $ results = $ compiler -> generate ( $ col... | Create a CSS file . Will generate inline style tags in production or reference the dynamic build file in development |
3,538 | protected function respond ( $ response , $ contents , $ build ) { $ body = $ response -> getBody ( ) ; $ body -> write ( $ contents ) ; $ body -> rewind ( ) ; return $ response -> withHeader ( 'Content-Type' , $ this -> mapType ( $ build ) ) ; } | Respond with the asset . |
3,539 | protected function mapType ( $ build ) { $ ext = $ build -> ext ( ) ; $ types = [ 'css' => 'text/css' , 'js' => 'application/javascript' ] ; return isset ( $ types [ $ ext ] ) ? $ types [ $ ext ] : 'application/octet-stream' ; } | Map an extension to a content type |
3,540 | public function startup ( ) { parent :: startup ( ) ; $ configFinder = new ConfigFinder ( ) ; $ this -> setConfig ( $ configFinder -> loadAll ( ) ) ; $ this -> out ( ) ; } | Create the configuration object used in other classes . |
3,541 | public function setConfig ( $ config ) { $ this -> config = $ config ; $ this -> factory = new Factory ( $ config ) ; $ this -> AssetBuild -> setConfig ( $ config ) ; } | Set the config object . |
3,542 | public function clear ( ) { $ this -> clearBuildTs ( ) ; $ this -> _io -> verbose ( 'Clearing build files:' ) ; $ this -> _clearBuilds ( ) ; $ this -> _io -> verbose ( '' ) ; $ this -> out ( '<success>Complete</success>' ) ; } | Clears the build directories for both CSS and JS |
3,543 | public function clearBuildTs ( ) { $ this -> _io -> verbose ( 'Clearing build timestamp.' ) ; $ writer = $ this -> factory -> writer ( ) ; $ writer -> clearTimestamps ( ) ; } | Clears the build timestamp . Try to clear it out even if they do not have ts file enabled in the INI . |
3,544 | protected function _clearBuilds ( ) { $ themes = ( array ) $ this -> config -> general ( 'themes' ) ; if ( $ themes ) { $ this -> config -> theme ( $ themes [ 0 ] ) ; } $ assets = $ this -> factory -> assetCollection ( ) ; if ( count ( $ assets ) === 0 ) { $ this -> err ( 'No build targets defined, skipping' ) ; return... | clear the builds for a specific extension . |
3,545 | public function loadAll ( $ path = null ) { if ( ! $ path ) { $ path = CONFIG . 'asset_compress.ini' ; } $ config = new AssetConfig ( [ ] , [ 'WEBROOT' => WWW_ROOT , ] ) ; $ this -> _load ( $ config , $ path ) ; $ plugins = Plugin :: loaded ( ) ; foreach ( $ plugins as $ plugin ) { $ pluginConfig = Plugin :: path ( $ p... | Load all configuration files in the application . |
3,546 | protected function _load ( $ config , $ path , $ prefix = '' ) { if ( file_exists ( $ path ) ) { $ config -> load ( $ path , $ prefix ) ; } $ localConfig = preg_replace ( '/(.*)\.ini$/' , '$1.local.ini' , $ path ) ; if ( file_exists ( $ localConfig ) ) { $ config -> load ( $ localConfig , $ prefix ) ; } } | Load a config file and its . local file if it exists . |
3,547 | public function setConfig ( AssetConfig $ config ) { $ this -> config = $ config ; $ this -> factory = new Factory ( $ config ) ; } | Set the Configuration object that will be used . |
3,548 | public function getDatabase ( $ name = null , $ doFinalInit = true ) { if ( $ doFinalInit ) { $ this -> doFinalInitialization ( ) ; } if ( $ name === null ) { return $ this -> dbList [ 0 ] ; } for ( $ i = 0 , $ size = count ( $ this -> dbList ) ; $ i < $ size ; $ i ++ ) { $ db = $ this -> dbList [ $ i ] ; if ( $ db -> ... | Return the database with the specified name . |
3,549 | public function hasDatabase ( $ name ) { foreach ( $ this -> dbList as $ db ) { if ( $ db -> getName ( ) === $ name ) { return true ; } } return false ; } | Checks whether a database with the specified nam exists in this AppData |
3,550 | public function addDatabase ( $ db ) { if ( $ db instanceof Database ) { $ db -> setAppData ( $ this ) ; if ( $ db -> getPlatform ( ) === null ) { if ( $ config = $ this -> getGeneratorConfig ( ) ) { $ pf = $ config -> getConfiguredPlatform ( null , $ db -> getName ( ) ) ; $ db -> setPlatform ( $ pf ? $ pf : $ this -> ... | Add a database to the list and sets the AppData property to this AppData |
3,551 | public function joinAppDatas ( $ ads ) { foreach ( $ ads as $ appData ) { foreach ( $ appData -> getDatabases ( false ) as $ addDb ) { $ addDbName = $ addDb -> getName ( ) ; if ( $ this -> hasDatabase ( $ addDbName ) ) { $ db = $ this -> getDatabase ( $ addDbName , false ) ; $ namespace = $ db -> getNamespace ( ) ; $ d... | Merge other appData objects into this object |
3,552 | public function toString ( ) { $ result = "<app-data>\n" ; foreach ( $ this -> dbList as $ dbList ) { $ result .= $ dbList -> toString ( ) ; } if ( $ this -> dbList ) { $ result .= "\n" ; } $ result .= "</app-data>" ; return $ result ; } | Creates a string representation of this AppData . The representation is given in xml format . |
3,553 | protected function getMappedFile ( $ from ) { if ( ! $ this -> mapperElement ) { throw new BuildException ( "This task requires you to use a <mapper/> element to describe how filename changes should be handled." ) ; } $ mapper = $ this -> mapperElement -> getImplementation ( ) ; $ mapped = $ mapper -> main ( $ from ) ;... | Maps the passed in name to a new filename & returns resolved File object . |
3,554 | public function getConnection ( ) { if ( $ this -> conn === false ) { $ this -> conn = null ; if ( $ this -> url ) { $ buf = "Using database settings:\n" . " URL: " . $ this -> url . "\n" . ( $ this -> userId ? " user: " . $ this -> userId . "\n" : "" ) . ( $ this -> password ? " password: " . $ this -> password . "\n"... | Gets the PDO connection if URL specified . |
3,555 | protected function getGeneratorConfig ( ) { if ( $ this -> generatorConfig === null ) { $ this -> generatorConfig = new GeneratorConfig ( ) ; $ this -> generatorConfig -> setBuildProperties ( $ this -> getProject ( ) -> getProperties ( ) ) ; } return $ this -> generatorConfig ; } | Gets the GeneratorConfig object for this task or creates it on - demand . |
3,556 | protected function validate ( ) { if ( empty ( $ this -> schemaFilesets ) ) { throw new BuildException ( "You must specify a fileset of XML schemas." , $ this -> getLocation ( ) ) ; } if ( $ this -> outputDirectory === null ) { throw new BuildException ( "The output directory needs to be defined!" , $ this -> getLocati... | Checks this class against Basic requirements of any propel datamodel task . |
3,557 | public function addConditions ( $ lefts , $ rights , $ operators = array ( ) ) { if ( count ( $ lefts ) != count ( $ rights ) ) { throw new PropelException ( "Unable to create join because the left column count isn't equal to the right column count" ) ; } foreach ( $ lefts as $ key => $ left ) { $ this -> addCondition ... | Join condition definition for several conditions |
3,558 | public function getConditions ( ) { $ conditions = array ( ) ; for ( $ i = 0 ; $ i < $ this -> count ; $ i ++ ) { $ conditions [ ] = array ( 'left' => $ this -> getLeftColumn ( $ i ) , 'operator' => $ this -> getOperator ( $ i ) , 'right' => $ this -> getRightColumn ( $ i ) ) ; } return $ conditions ; } | Return an array of the join conditions |
3,559 | public function getLeftColumns ( ) { $ columns = array ( ) ; foreach ( $ this -> left as $ index => $ column ) { $ columns [ ] = $ this -> getLeftColumn ( $ index ) ; } return $ columns ; } | Get the list of all the names of left columns of the join condition |
3,560 | public function getClause ( & $ params ) { if ( null === $ this -> joinCondition ) { $ conditions = array ( ) ; for ( $ i = 0 ; $ i < $ this -> count ; $ i ++ ) { $ conditions [ ] = $ this -> getLeftColumn ( $ i ) . $ this -> getOperator ( $ i ) . $ this -> getRightColumn ( $ i ) ; } $ joinCondition = sprintf ( '(%s)' ... | Get the join clause for this Join . If the join condition needs binding uses the passed params array . |
3,561 | public static function setSpecVersion ( $ version ) { if ( ! in_array ( $ version , array ( '1.1' , '1.2' ) ) ) { throw new InvalidArgumentException ( sprintf ( 'Version %s of the YAML specifications is not supported' , $ version ) ) ; } self :: $ spec = $ version ; } | Sets the YAML specification version to use . |
3,562 | public static function load ( $ input ) { $ file = '' ; if ( strpos ( $ input , "\n" ) === false && is_file ( $ input ) ) { $ file = $ input ; ob_start ( ) ; $ retval = include ( $ input ) ; $ content = ob_get_clean ( ) ; $ input = is_array ( $ retval ) ? $ retval : $ content ; } if ( is_array ( $ input ) ) { return $ ... | Loads YAML into a PHP array . |
3,563 | public function getArrayCopy ( $ keyColumn = null , $ usePrefix = false ) { if ( null === $ keyColumn && false === $ usePrefix ) { return parent :: getArrayCopy ( ) ; } $ ret = array ( ) ; $ keyGetterMethod = 'get' . $ keyColumn ; foreach ( $ this as $ key => $ obj ) { $ key = null === $ keyColumn ? $ key : $ obj -> $ ... | Get an array representation of the collection |
3,564 | public function toKeyValue ( $ keyColumn = 'PrimaryKey' , $ valueColumn = null ) { $ ret = array ( ) ; $ valueGetterMethod = ( null === $ valueColumn ) ? '__toString' : ( 'get' . $ valueColumn ) ; if ( ! is_array ( $ keyColumn ) ) { $ keyColumn = array ( $ keyColumn ) ; } foreach ( $ this as $ obj ) { $ ret [ $ this ->... | Get an associative array representation of the collection The first parameter specifies the column to be used for the key And the seconf for the value . |
3,565 | protected function getValueForColumns ( $ object , array $ columns ) { $ value = $ object ; foreach ( $ columns as $ eachKeyColumn ) { $ keyGetterMethod = 'get' . $ eachKeyColumn ; $ value = $ value -> $ keyGetterMethod ( ) ; } return $ value ; } | Return the value for a given set of key columns . |
3,566 | public function objectAttributes ( PHP5ObjectBuilder $ builder ) { if ( ! $ this -> behavior -> hasArchiveClass ( ) ) { $ builder -> declareClassFromBuilder ( $ builder -> getNewStubQueryBuilder ( $ this -> behavior -> getArchiveTable ( ) ) ) ; } $ script = '' ; if ( $ this -> behavior -> isArchiveOnInsert ( ) ) { $ sc... | Add object attributes to the built class . |
3,567 | protected function isNextLineIndented ( ) { $ currentIndentation = $ this -> getCurrentLineIndentation ( ) ; $ notEOF = $ this -> moveToNextLine ( ) ; while ( $ notEOF && $ this -> isCurrentLineEmpty ( ) ) { $ notEOF = $ this -> moveToNextLine ( ) ; } if ( false === $ notEOF ) { return false ; } $ ret = false ; if ( $ ... | Returns true if the next line is indented . |
3,568 | public function getMergedVendorInfo ( VendorInfo $ merge ) { $ newParams = array_merge ( $ this -> getParameters ( ) , $ merge -> getParameters ( ) ) ; $ newInfo = new VendorInfo ( $ this -> getType ( ) ) ; $ newInfo -> setParameters ( $ newParams ) ; return $ newInfo ; } | Gets a new merged VendorInfo object . |
3,569 | public function compareColumns ( $ caseInsensitive = false ) { $ fromTableColumns = $ this -> getFromTable ( ) -> getColumns ( ) ; $ toTableColumns = $ this -> getToTable ( ) -> getColumns ( ) ; $ columnDifferences = 0 ; foreach ( $ toTableColumns as $ column ) { if ( ! $ this -> getFromTable ( ) -> hasColumn ( $ colum... | Compare the columns of the fromTable and the toTable and modifies the inner tableDiff if necessary . Returns the number of differences . |
3,570 | public function comparePrimaryKeys ( $ caseInsensitive = false ) { $ pkDifferences = 0 ; $ fromTablePk = $ this -> getFromTable ( ) -> getPrimaryKey ( ) ; $ toTablePk = $ this -> getToTable ( ) -> getPrimaryKey ( ) ; foreach ( $ toTablePk as $ column ) { if ( ! $ this -> getFromTable ( ) -> hasColumn ( $ column -> getN... | Compare the primary keys of the fromTable and the toTable and modifies the inner tableDiff if necessary . Returns the number of differences . |
3,571 | public function compareIndices ( $ caseInsensitive = false ) { $ indexDifferences = 0 ; $ fromTableIndices = array_merge ( $ this -> getFromTable ( ) -> getIndices ( ) , $ this -> getFromTable ( ) -> getUnices ( ) ) ; $ toTableIndices = array_merge ( $ this -> getToTable ( ) -> getIndices ( ) , $ this -> getToTable ( )... | Compare the indices and unique indices of the fromTable and the toTable and modifies the inner tableDiff if necessary . Returns the number of differences . |
3,572 | public function compareForeignKeys ( $ caseInsensitive = false ) { $ fkDifferences = 0 ; $ fromTableFks = $ this -> getFromTable ( ) -> getForeignKeys ( ) ; $ toTableFks = $ this -> getToTable ( ) -> getForeignKeys ( ) ; foreach ( $ fromTableFks as $ fromTableFkPos => $ fromTableFk ) { foreach ( $ toTableFks as $ toTab... | Compare the foreign keys of the fromTable and the toTable and modifies the inner tableDiff if necessary . Returns the number of differences . |
3,573 | public function transform ( PhingFile $ xmlFile , Writer $ out ) { $ this -> sqlWriter = $ out ; $ this -> currTableName = $ this -> currBuilder = null ; $ this -> builderClazz = $ this -> generatorConfig -> getBuilderClassname ( 'datasql' ) ; try { $ fr = new FileReader ( $ xmlFile ) ; } catch ( Exception $ e ) { thro... | Transform the data dump input file into SQL and writes it to the output stream . |
3,574 | public function endElement ( $ name ) { if ( self :: DEBUG ) { print ( "endElement(" . $ name . ") called\n" ) ; } if ( $ name == "dataset" ) { if ( $ this -> currBuilder !== null ) { $ this -> sqlWriter -> write ( $ this -> currBuilder -> getTableEndSql ( ) ) ; } $ this -> sqlWriter -> write ( call_user_func ( array (... | Handles closing elements of the xml file . |
3,575 | public function addModifiedIndex ( $ indexName , Index $ fromIndex , Index $ toIndex ) { $ this -> modifiedIndices [ $ indexName ] = array ( $ fromIndex , $ toIndex ) ; } | Add a modified Index |
3,576 | public static function register ( ) { ini_set ( 'unserialize_callback_func' , 'spl_autoload_call' ) ; if ( false === spl_autoload_register ( array ( self :: getInstance ( ) , 'autoload' ) ) ) { throw new Exception ( sprintf ( 'Unable to register %s::autoload as an autoloading method.' , get_class ( self :: getInstance ... | Register PropelAutoloader in spl autoloader . |
3,577 | public function autoload ( $ class ) { if ( isset ( $ this -> classes [ $ class ] ) ) { require $ this -> classes [ $ class ] ; return true ; } if ( strpos ( $ class , '\\' ) === 0 ) { $ class = substr ( $ class , 1 ) ; return $ this -> autoload ( $ class ) ; } return false ; } | Handles autoloading of classes that have been registered in this instance |
3,578 | public function setNamespace ( $ v ) { if ( $ v == $ this -> namespace ) { return ; } $ this -> namespace = $ v ; if ( $ v && ( ! $ this -> pkg || $ this -> pkgOverridden ) && $ this -> getBuildProperty ( 'namespaceAutoPackage' ) ) { $ this -> pkg = str_replace ( '\\' , '.' , $ v ) ; $ this -> pkgOverridden = true ; } ... | Set the value of the namespace . |
3,579 | public function setPackage ( $ v ) { if ( $ v == $ this -> pkg ) { return ; } $ this -> pkg = $ v ; $ this -> pkgOverridden = false ; } | Set the value of package . |
3,580 | public function setSchema ( $ v ) { if ( $ v == $ this -> schema ) { return ; } $ this -> schema = $ v ; if ( $ v && ! $ this -> pkg && $ this -> getBuildProperty ( 'schemaAutoPackage' ) ) { $ this -> pkg = $ v ; $ this -> pkgOverridden = true ; } if ( $ v && ! $ this -> namespace && $ this -> getBuildProperty ( 'schem... | Set the value of schema . |
3,581 | public static function create ( Database $ database ) { $ dotSyntax = '' ; foreach ( $ database -> getTables ( ) as $ table ) { $ columnsSyntax = '' ; foreach ( $ table -> getColumns ( ) as $ column ) { $ attributes = '' ; if ( count ( $ column -> getForeignKeys ( ) ) > 0 ) { $ attributes .= ' [FK]' ; } if ( $ column -... | Create the DOT syntax for a given databases . |
3,582 | protected static function configureLogging ( ) { if ( self :: $ logger === null ) { if ( isset ( self :: $ configuration [ 'log' ] ) && is_array ( self :: $ configuration [ 'log' ] ) && count ( self :: $ configuration [ 'log' ] ) ) { include_once 'Log.php' ; $ c = self :: $ configuration [ 'log' ] ; $ type = isset ( $ ... | Configure the logging system if config is specified in the runtime configuration . |
3,583 | public static function setConfiguration ( $ c ) { if ( is_array ( $ c ) ) { if ( isset ( $ c [ 'propel' ] ) && is_array ( $ c [ 'propel' ] ) ) { $ c = $ c [ 'propel' ] ; } $ c = new PropelConfiguration ( $ c ) ; } self :: $ configuration = $ c ; } | Sets the configuration for Propel and all dependencies . |
3,584 | public static function log ( $ message , $ level = self :: LOG_DEBUG ) { if ( self :: hasLogger ( ) ) { $ logger = self :: logger ( ) ; switch ( $ level ) { case self :: LOG_EMERG : return $ logger -> log ( $ message , $ level ) ; case self :: LOG_ALERT : return $ logger -> alert ( $ message ) ; case self :: LOG_CRIT :... | Logs a message If a logger has been configured the logger will be used otherwrise the logging message will be discarded without any further action |
3,585 | public static function getDatabaseMap ( $ name = null ) { if ( $ name === null ) { $ name = self :: getDefaultDB ( ) ; if ( $ name === null ) { throw new PropelException ( "DatabaseMap name is null!" ) ; } } if ( ! isset ( self :: $ dbMaps [ $ name ] ) ) { $ clazz = self :: $ databaseMapClass ; self :: $ dbMaps [ $ nam... | Returns the database map information . Name relates to the name of the connection pool to associate with the map . |
3,586 | public static function setDatabaseMap ( $ name , DatabaseMap $ map ) { if ( $ name === null ) { $ name = self :: getDefaultDB ( ) ; } self :: $ dbMaps [ $ name ] = $ map ; } | Sets the database map object to use for specified datasource . |
3,587 | public static function setConnection ( $ name , PropelPDO $ con , $ mode = Propel :: CONNECTION_WRITE ) { if ( $ name === null ) { $ name = self :: getDefaultDB ( ) ; } if ( $ mode == Propel :: CONNECTION_READ ) { self :: $ connectionMap [ $ name ] [ 'slave' ] = $ con ; } else { self :: $ connectionMap [ $ name ] [ 'ma... | Sets a Connection for specified datasource name . |
3,588 | public static function getConnection ( $ name = null , $ mode = Propel :: CONNECTION_WRITE ) { if ( $ name === null ) { $ name = self :: getDefaultDB ( ) ; } if ( $ mode != Propel :: CONNECTION_READ || self :: $ forceMasterConnection ) { return self :: getMasterConnection ( $ name ) ; } else { return self :: getSlaveCo... | Gets an already - opened PDO connection or opens a new one for passed - in db name . |
3,589 | public static function getMasterConnection ( $ name ) { if ( ! isset ( self :: $ connectionMap [ $ name ] [ 'master' ] ) ) { $ conparams = isset ( self :: $ configuration [ 'datasources' ] [ $ name ] [ 'connection' ] ) ? self :: $ configuration [ 'datasources' ] [ $ name ] [ 'connection' ] : null ; if ( empty ( $ conpa... | Gets an already - opened write PDO connection or opens a new one for passed - in db name . |
3,590 | public static function getSlaveConnection ( $ name ) { if ( ! isset ( self :: $ connectionMap [ $ name ] [ 'slave' ] ) ) { $ slaveconfigs = isset ( self :: $ configuration [ 'datasources' ] [ $ name ] [ 'slaves' ] ) ? self :: $ configuration [ 'datasources' ] [ $ name ] [ 'slaves' ] : null ; if ( empty ( $ slaveconfigs... | Gets an already - opened read PDO connection or opens a new one for passed - in db name . |
3,591 | public static function initConnection ( $ conparams , $ name , $ defaultClass = Propel :: CLASS_PROPEL_PDO ) { $ adapter = isset ( $ conparams [ 'adapter' ] ) ? DBAdapter :: factory ( $ conparams [ 'adapter' ] ) : self :: getDB ( $ name ) ; if ( null === $ conparams [ 'dsn' ] ) { throw new PropelException ( 'No dsn spe... | Opens a new PDO connection for passed - in db name . |
3,592 | private static function processDriverOptions ( $ source , & $ write_to ) { foreach ( $ source as $ option => $ optiondata ) { if ( is_string ( $ option ) && strpos ( $ option , '::' ) !== false ) { $ key = $ option ; } elseif ( is_string ( $ option ) ) { $ key = 'PropelPDO::' . $ option ; } if ( ! defined ( $ key ) ) {... | Internal function to handle driver options or conneciton attributes in PDO . |
3,593 | public static function getDB ( $ name = null ) { if ( $ name === null ) { $ name = self :: getDefaultDB ( ) ; } if ( ! isset ( self :: $ adapterMap [ $ name ] ) ) { if ( ! isset ( self :: $ configuration [ 'datasources' ] [ $ name ] [ 'adapter' ] ) ) { throw new PropelException ( "Unable to find adapter for datasource ... | Returns database adapter for a specific datasource . |
3,594 | public static function setDB ( $ name , DBAdapter $ adapter ) { if ( $ name === null ) { $ name = self :: getDefaultDB ( ) ; } self :: $ adapterMap [ $ name ] = $ adapter ; } | Sets a database adapter for specified datasource . |
3,595 | public static function getDefaultDB ( ) { if ( self :: $ defaultDBName === null ) { self :: $ defaultDBName = isset ( self :: $ configuration [ 'datasources' ] [ 'default' ] ) && is_scalar ( self :: $ configuration [ 'datasources' ] [ 'default' ] ) ? self :: $ configuration [ 'datasources' ] [ 'default' ] : self :: DEF... | Returns the name of the default database . |
3,596 | public static function autoload ( $ className ) { if ( isset ( self :: $ autoloadMap [ $ className ] ) ) { require self :: $ baseDir . self :: $ autoloadMap [ $ className ] ; return true ; } return false ; } | Autoload function for loading propel dependencies . |
3,597 | public static function importClass ( $ path ) { if ( ( $ pos = strrpos ( $ path , '.' ) ) === false ) { $ class = $ path ; } else { $ class = substr ( $ path , $ pos + 1 ) ; } if ( class_exists ( $ class , $ useAutoload = true ) ) { return $ class ; } $ path = strtr ( $ path , '.' , DIRECTORY_SEPARATOR ) . '.php' ; $ r... | Include once a file specified in DOT notation and return unqualified classname . |
3,598 | private function getDatabase ( $ name ) { foreach ( $ this -> getDataModels ( ) as $ dm ) { foreach ( $ dm -> getDatabases ( ) as $ db ) { if ( $ db -> getName ( ) == $ name ) { return $ db ; } } } } | Search through all data models looking for matching database . |
3,599 | public function main ( ) { $ this -> validate ( ) ; $ targetDatabase = $ this -> getTargetDatabase ( ) ; $ platform = $ this -> getGeneratorConfig ( ) -> getConfiguredPlatform ( ) ; $ map = new Properties ( ) ; try { $ map -> load ( $ this -> getDataDbMap ( ) ) ; } catch ( IOException $ ioe ) { throw new BuildException... | Main method parses the XML files and creates SQL files . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.