/**
 *
 * @param  string $sourceDir            the root directory of the project in question
 * @param  string $resourceDbFileName   the location of the resource cache SQLite file; as created by Triumph
 * @param  boolean $doSkip              out parameter; if TRUE then this detector does not know how
 *                                      to detect URLs for the given source directory; this situation
 *                                      is different than zero URLs being detected.
 * @return Triumph_DetectedTag[]         array of Triumph_DetectedTag instances the detected tags
 */
function detectTags($sourceDir, $resourceDbFileName, &$doSkip)
{
    $allTags = array();
    // need to check that this detector is able to recognize the directory structure of sourceDir
    // if not, then we need to skip detection by returning immediately and setting $doSkip to TRUE.
    // by skipping detection, we prevent any detected URLs from the previous detection script
    // from being deleted.
    $doSkip = TRUE;
    $sourceDir = \opstring\ensure_ends_with($sourceDir, DIRECTORY_SEPARATOR);
    $codeIgniterSystemDir = locateSystemDir($sourceDir);
    if (\opstring\length($codeIgniterSystemDir) <= 0) {
        return $allTags;
    }
    $doSkip = FALSE;
    // need this define so that we can include code igniter files directly
    define('BASEPATH', '');
    coreResources($sourceDir, $codeIgniterSystemDir, $allTags);
    libraryResources($sourceDir, $codeIgniterSystemDir, $allTags);
    // TODO: handle more than one application
    $appDir = $sourceDir . DIRECTORY_SEPARATOR . 'application';
    $modelDir = $appDir . DIRECTORY_SEPARATOR . 'models';
    modelResources($sourceDir, $modelDir, $allTags);
    // the "super" object
    $allTags[] = Triumph_DetectedTag::CreateMethod('CI_Controller', 'get_instance', '\\CI_Controller');
    return $allTags;
}
Esempio n. 2
0
 function testLength()
 {
     $this->assertEquals(5, \opstring\length('this '));
 }