function __test_should_extract_javadoc_blocks() { $SourceAnalyzer = new SourceAnalyzer(); include_once AK_TEST_DIR . DS . 'fixtures' . DS . 'data' . DS . 'parsed.php'; $SourceAnalyzer->importCategories($parsed['categories']); unset($parsed['categories']); Ak::import('akelos_class'); $ClassInstance =& new AkelosClass(); foreach ($parsed as $class_name => $details) { if (!($Class =& $ClassInstance->findFirstBy('name', $class_name))) { echo "<pre>" . print_r($details, true) . "</pre>"; $Class =& new AkelosClass(array('name' => $class_name)); $this->assertTrue($Class->save()); } } // print_r($parsed); }
function testUnitializedUsage() { $scripts = $this->getAllScripts(); $matches = array(); foreach ($scripts as $s) { $a = new SourceAnalyzer($s); $a->parseFile(); foreach ($a->bugs as $bug) { if ($bug['type'] == 'UNDEF_ACCESS') { list($line, $file) = $bug['line']; $this->fail($file, $line, "'{$bug['name']}'"); } elseif ($bug['type'] == 'MAYBE_UNDEF_ACCESS') { list($line, $file) = $bug['line']; $this->warn("Possible access to NULL object @ $file : $line"); } } if (!$a->bugs) $this->pass(); } }
<?php require_once AK_LIB_DIR . DS . 'AkActiveRecord.php'; require_once AK_APP_DIR . DS . 'shared_model.php'; require_once AK_MODELS_DIR . DS . 'source_analyzer.php'; require_once AK_MODELS_DIR . DS . 'source_parser.php'; $SourceAnalyzer = new SourceAnalyzer(); $SourceAnalyzer->storeFilesForIndexing(); $SourceAnalyzer->indexFiles();
<?php # This file is part of the Akelos Framework # (Copyright) 2004-2010 Bermi Ferrer bermi a t bermilabs com # See LICENSE and CREDITS for details $doc_db_file = AK_DOCS_DIR . DS . 'akelos' . DS . 'doc.sqlite'; $installed = file_exists($doc_db_file); $db = Ak::db('sqlite://' . urlencode($doc_db_file) . '/?persist'); AkConfig::rebaseApp(AK_PLUGINS_DIR . DS . 'doc_builder'); if (!$installed) { $DocInstaller = new DocInstaller($db); $DocInstaller->install(); } $SourceAnalyzer = new SourceAnalyzer(); $SourceAnalyzer->db = $db; $SourceAnalyzer->storeFilesForIndexing(AK_ACTION_MAILER_DIR); $SourceAnalyzer->indexFiles(); //unlink($doc_db_file); return; $dir_iterator = new RecursiveDirectoryIterator(AK_ACTION_MAILER_DIR); $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $file) { if ($file->isFile()) { echo $file, "\n"; $original_file = file_get_contents($file); $Reflection = new AkReflectionFile($file); foreach ($Reflection->getClasses() as $Class) { echo 'class: ' . $Class->getName() . "\n"; $defined_methods = array('public' => array(), 'protected' => array(), 'private' => array()); foreach ($Class->getMethods() as $Method) { $name = $Method->getName();