Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanup.

  • Loading branch information...
commit 31f8c75fa01dd8951f80021777f02c89c4385db9 1 parent 91bfe31
@sebastianbergmann authored
View
71 PHPDCD/Autoload.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * phpdcd
+ *
+ * Copyright (c) 2009-2011, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package phpdcd
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2009-2011 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @since File available since Release 1.0.0
+ */
+
+require_once 'File/Iterator/Autoload.php';
+require_once 'PHP/Token/Stream/Autoload.php';
+require_once 'PHP/Timer/Autoload.php';
+require_once 'ezc/Base/base.php';
+
+function phpdcd_autoload($class) {
+ static $classes = NULL;
+ static $path = NULL;
+
+ if ($classes === NULL) {
+ $classes = array(
+ 'phpdcd_detector' => '/Detector.php',
+ 'phpdcd_textui_command' => '/TextUI/Command.php',
+ 'phpdcd_textui_resultprinter' => '/TextUI/ResultPrinter.php'
+ );
+
+ $path = dirname(__FILE__);
+ }
+
+ $cn = strtolower($class);
+
+ if (isset($classes[$cn])) {
+ require $path . $classes[$cn];
+ }
+}
+
+spl_autoload_register('phpdcd_autoload');
+spl_autoload_register(array('ezcBase', 'autoload'));
View
69 PHPDCD/Autoload.php.in
@@ -0,0 +1,69 @@
+<?php
+/**
+ * phpdcd
+ *
+ * Copyright (c) 2009-2011, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @package phpdcd
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2009-2011 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @since File available since Release 1.0.0
+ */
+
+require_once 'File/Iterator/Autoload.php';
+require_once 'PHP/Token/Stream/Autoload.php';
+require_once 'PHP/Timer/Autoload.php';
+require_once 'ezc/Base/base.php';
+
+function phpdcd_autoload($class) {
+ static $classes = NULL;
+ static $path = NULL;
+
+ if ($classes === NULL) {
+ $classes = array(
+ ___CLASSLIST___
+ );
+
+ $path = dirname(__FILE__);
+ }
+
+ $cn = strtolower($class);
+
+ if (isset($classes[$cn])) {
+ require $path . $classes[$cn];
+ }
+}
+
+spl_autoload_register('phpdcd_autoload');
+spl_autoload_register(array('ezcBase', 'autoload'));
View
3  PHPDCD/Detector.php
@@ -41,8 +41,6 @@
* @since File available since Release 1.0.0
*/
-require_once 'PHP/Token/Stream.php';
-
/**
* PHPDCD code analyser.
*
@@ -336,4 +334,3 @@ public function detectDeadCode(array $files, $recursive = FALSE)
return $result;
}
}
-?>
View
12 PHPDCD/TextUI/Command.php
@@ -41,17 +41,6 @@
* @since File available since Release 1.0.0
*/
-require_once 'File/Iterator/Factory.php';
-require_once 'PHPDCD/Detector.php';
-require_once 'PHPDCD/TextUI/ResultPrinter.php';
-
-require_once 'ezc/Base/base.php';
-
-function __autoload($className)
-{
- ezcBase::autoload($className);
-}
-
/**
* TextUI frontend for PHPDCD.
*
@@ -293,4 +282,3 @@ protected static function printVersionString()
print "phpdcd @package_version@ by Sebastian Bergmann.\n";
}
}
-?>
View
3  PHPDCD/TextUI/ResultPrinter.php
@@ -41,8 +41,6 @@
* @since File available since Release 1.0.0
*/
-require_once 'PHP/Timer.php';
-
/**
* A ResultPrinter for the TextUI.
*
@@ -75,4 +73,3 @@ public function printResult(array $result, $commonPath)
print "\n" . PHP_Timer::resourceUsage() . "\n";
}
}
-?>
View
2  Tests/DetectorTest.php
@@ -49,8 +49,6 @@
);
}
-require_once 'PHPDCD/Detector.php';
-
/**
* Tests for the PHPDCD_Detector class.
*
View
7 build.xml
@@ -0,0 +1,7 @@
+<project name="phpdcd" default="phpab" basedir=".">
+ <target name="phpab">
+ <exec executable="phpab">
+ <arg line='-o PHPDCD/Autoload.php -c -t PHPDCD/Autoload.php.in --indent " " PHPDCD' />
+ </exec>
+ </target>
+</project>
View
23 package.xml
@@ -17,14 +17,14 @@
<email>sb@sebastian-bergmann.de</email>
<active>yes</active>
</lead>
- <date>2010-01-07</date>
+ <date>201Y-MM-DD</date>
<version>
- <release>0.9.2</release>
- <api>0.9.2</api>
+ <release>1.0.0</release>
+ <api>1.0.0</api>
</version>
<stability>
- <release>beta</release>
- <api>beta</api>
+ <release>stable</release>
+ <api>stable</api>
</stability>
<license>BSD License</license>
<notes>http://github.com/sebastianbergmann/phpdcd/tree</notes>
@@ -39,6 +39,9 @@
<tasks:replace from="@package_version@" to="version" type="package-info" />
</file>
</dir>
+ <file baseinstalldir="/" name="Autoload.php" role="php">
+ <tasks:replace from="@package_version@" to="version" type="package-info" />
+ </file>
<file baseinstalldir="/" name="Detector.php" role="php">
<tasks:replace from="@package_version@" to="version" type="package-info" />
</file>
@@ -58,25 +61,25 @@
<dependencies>
<required>
<php>
- <min>5.2.0</min>
+ <min>5.2.7</min>
</php>
<pearinstaller>
- <min>1.8.1</min>
+ <min>1.9.1</min>
</pearinstaller>
<package>
<name>File_Iterator</name>
<channel>pear.phpunit.de</channel>
- <min>1.1.0</min>
+ <min>1.3.0</min>
</package>
<package>
<name>PHP_Timer</name>
<channel>pear.phpunit.de</channel>
- <min>1.0.0</min>
+ <min>1.1.0</min>
</package>
<package>
<name>PHP_TokenStream</name>
<channel>pear.phpunit.de</channel>
- <min>0.9.1</min>
+ <min>1.1.0</min>
</package>
<package>
<name>ConsoleTools</name>
View
2  phpdcd.php
@@ -46,6 +46,6 @@
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
}
-require 'PHPDCD/TextUI/Command.php';
+require 'PHPDCD/Autoload.php';
PHPDCD_TextUI_Command::main();
View
3  phpunit.xml.dist
@@ -2,7 +2,8 @@
<phpunit backupGlobals="false"
backupStaticAttributes="false"
- syntaxCheck="false">
+ syntaxCheck="false"
+ bootstrap="PHPDCD/Autoload.php">
<testsuites>
<testsuite name="PHPDCD">
<directory suffix="Test.php">Tests</directory>
Please sign in to comment.
Something went wrong with that request. Please try again.