コード例 #1
0
ファイル: generateTags.php プロジェクト: djnewtown/judge
/**
 * Generate tag file for use with MageCompatibility plugin for Judge
 */
if (count($argv) !== 2) {
    die('Please submit exactly one param: The path to the Magento root directory' . PHP_EOL);
}
$magentoDir = $argv[1];
if (substr($magentoDir, -1) !== '/') {
    $magentoDir .= '/';
}
if (!file_exists($magentoDir . '/app/Mage.php')) {
    die('Are you sure, there is a Magento? Couldn\'t find Mage.php!' . PHP_EOL);
}
$tagger = new Tagger($magentoDir);
$tagger->run();
class Tagger
{
    protected $_magentoDir;
    protected $_tagFile;
    protected $_edition;
    protected $_version;
    protected $_needed = array('function' => array('token_node' => T_FUNCTION, 'name_node' => T_STRING, 'node_type' => 'f', 'steps_to_name' => 1), 'class' => array('token_node' => T_CLASS, 'name_node' => T_STRING, 'node_type' => 'c', 'steps_to_name' => 1), 'define' => array('token_node' => T_STRING, 'name_node' => T_CONSTANT_ENCAPSED_STRING, 'node_type' => 'd', 'steps_to_name' => 2), 'interface' => array('token_node' => T_INTERFACE, 'name_node' => T_STRING, 'node_type' => 'i', 'steps_to_name' => 1));
    /**
     * @param string $magentoDir
     */
    public function __construct($magentoDir)
    {
        $this->_magentoDir = $magentoDir;
        $this->_verifyMagento();
        $this->_tagFile = realpath(dirname(__FILE__) . '/../var/tags/') . '/' . strtolower($this->_edition) . '-' . $this->_version . '.tags';