com phpruntests: Reformatted to conform to PEAR coding standard.: src/rtAutoload.php src/rtDirectoryList.php src/rtPhptFilterIterator.php
src/rtText.php src/rtUtil.php
| From: | David Soria Parra | Date: | Mon, 20 Apr 2009 16:57:31 +0000 |
| Subject: | com phpruntests: Reformatted to conform to PEAR coding standard.: src/rtAutoload.php src/rtDirectoryList.php src/rtPhptFilterIterator.php src/rtText.php src/rtUtil.php |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66545@lists.php.net to get a copy of this message | ||
Commit: b30e93f488d25f2e23453a34abc0f121956d7b5d
Author: Stefan Priebsch <spriebsch@php.net> Mon, 20 Apr 2009 16:57:31 +0000
Parents: c7f8b43905b6f3a69fa42e1bc5974e5c2bb8675b
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=b30e93f488d25f2e23453a34abc0f121956d7b5d
Log:
Reformatted to conform to PEAR coding standard.
Changed paths:
M src/rtAutoload.php
M src/rtDirectoryList.php
M src/rtPhptFilterIterator.php
M src/rtText.php
M src/rtUtil.php
Diff:
diff --git a/src/rtAutoload.php b/src/rtAutoload.php
index c988925..0400084 100644
--- a/src/rtAutoload.php
+++ b/src/rtAutoload.php
@@ -8,55 +8,52 @@ rtAutoload::init();
*/
class rtAutoload
{
- /**
- * @var array
- */
- protected static $classMap;
-
- /**
- * @var string
- */
- protected static $classPath;
-
-
- /**
- * Initialize the autoloader
- *
- * @return null
- */
- public static function init()
- {
- self::$classPath = dirname(__FILE__);
-
- if (substr(self::$classPath, -1) != '/') {
- self::$classPath .= '/';
+ /**
+ * @var array
+ */
+ protected static $classMap;
+
+ /**
+ * @var string
+ */
+ protected static $classPath;
+
+ /**
+ * Initialize the autoloader
+ *
+ * @return null
+ */
+ public static function init()
+ {
+ self::$classPath = dirname(__FILE__);
+
+ if (substr(self::$classPath, -1) != '/') {
+ self::$classPath .= '/';
+ }
+
+ if (file_exists(self::$classPath . 'rtClassMap..php')) {
+ include self::$classPath . 'rtClassMap.php';
+ self::$classMap = $rtClassMap;
+ }
+
+ if (function_exists('__autoload')) {
+ spl_autoload_register('__autoload');
+ }
+
+ spl_autoload_register(array('rtAutoload', 'autoload'));
}
- if (file_exists(self::$classPath . 'rtClassMap.php')) {
- include self::$classPath . 'rtClassMap.php';
- self::$classMap = $rtClassMap;
+ /**
+ * Autoload method
+ *
+ * @param string $class Class name to autoload
+ * @return null
+ */
+ public static function autoload($class)
+ {
+ if (isset(self::$classMap[$class])) {
+ include self::$classPath . self::$classMap[$class];
+ }
}
-
- if (function_exists('__autoload')) {
- spl_autoload_register('__autoload');
- }
-
- spl_autoload_register(array('rtAutoload', 'autoload'));
- }
-
-
- /**
- * Autoload method
- *
- * @param string $class Class name to autoload
- * @return null
- */
- public static function autoload($class)
- {
- if (isset(self::$classMap[$class])) {
- include self::$classPath . self::$classMap[$class];
- }
- }
}
-
?>
diff --git a/src/rtDirectoryList.php b/src/rtDirectoryList.php
index f03021c..fb5352d 100644
--- a/src/rtDirectoryList.php
+++ b/src/rtDirectoryList.php
@@ -1,29 +1,27 @@
<?php
-
/**
* Lists all of the directories under a top level directory.
* This is currently not used for anything
*
*/
-class rtDirectoryList {
-
-
+class rtDirectoryList
+{
/**
* Finds a list of subdirectories under the top level ditectory and returns the full path names
in an array
*
* @param string $topDirectory
* @return array
*/
- public function getSubDirectoryPaths($topDirectory) {
- $result = array($topDirectory);
-
- foreach(new RecursiveIteratorIterator(new ParentIterator(new
RecursiveDirectoryIterator($topDirectory)), 1) as $dir) {
- $result[] = $dir->getPathName();
- }
- return $result;
+ public function getSubDirectoryPaths($topDirectory)
+ {
+ $result = array($topDirectory);
+
+ foreach (new RecursiveIteratorIterator(new ParentIterator(new
RecursiveDirectoryIterator($topDirectory)), 1) as $dir) {
+ $result[] = $dir->getPathName();
+ }
+
+ return $result;
}
-
-
}
-?>
\ No newline at end of file
+?>
diff --git a/src/rtPhptFilterIterator.php b/src/rtPhptFilterIterator.php
index e00c23d..d5046d0 100644
--- a/src/rtPhptFilterIterator.php
+++ b/src/rtPhptFilterIterator.php
@@ -1,11 +1,13 @@
<?php
-
+/**
+ *
+ */
class rtPhptFilterIterator extends FilterIterator
- {
+{
public function accept()
{
- return (substr($this->current(), -strlen('.phpt')) == '.phpt');
+ return substr($this->current(), -strlen('.phpt')) == '.phpt';
}
- }
-?>
\ No newline at end of file
+}
+?>
diff --git a/src/rtText.php b/src/rtText.php
index 074378b..3b3cc6a 100644
--- a/src/rtText.php
+++ b/src/rtText.php
@@ -1,17 +1,19 @@
<?php
- class rtText
- {
+/**
+ *
+ */
+class rtText
+{
public static function get($name)
{
- $filename = dirname(__FILE__) . '/texts/' . $name . '.txt';
+ $filename = dirname(__FILE__) . '/texts/' .. $name . '.txt';
- if (!file_exists($filename)) {
- throw new LogicException('The text ' . $name . ' does not exist');
- }
+ if (!file_exists($filename)) {
+ throw new LogicException('The text ' . $name . ' does not exist');
+ }
- return file_get_contents($filename);
+ return file_get_contents($filename);
}
- }
-
+}
?>
diff --git a/src/rtUtil.php b/src/rtUtil.php
index b7bbc9f..d215d66 100644
--- a/src/rtUtil.php
+++ b/src/rtUtil.php
@@ -1,37 +1,38 @@
<?php
-class rtUtil {
- public static function getTestList($aDirectory)
- {
- $result = array();
-
- foreach (new rtPhptFilterIterator(new RecursiveIteratorIterator(new
RecursiveDirectoryIterator($aDirectory))) as $item)
+/**
+ *
+ */
+class rtUtil
+{
+ public static function getTestList($aDirectory)
{
- $result[] = $item->getPathname();
- }
+ $result = array();
- return $result;
- }
+ foreach (new rtPhptFilterIterator(new RecursiveIteratorIterator(new
RecursiveDirectoryIterator($aDirectory))) as $item) {
+ $result[] = $item->getPathname();
+ }
- /**
- * Returns a list of subdirectories (including the current directory) if they contatin .phpt
files
- * Directory names are full paths and are not terminated with a /
- * There should be a cleaner way to do this
- *
- * @param path $aDirectory
- * @return array
- */
- public static function getDirectoryList($aDirectory)
- {
- $result = array();
+ return $result;
+ }
- foreach (new rtPhptFilterIterator(new RecursiveIteratorIterator(new
RecursiveDirectoryIterator($aDirectory))) as $directory)
+ /**
+ * Returns a list of subdirectories (including the current directory) if they contatin .phpt
files
+ * Directory names are full paths and are not terminated with a /
+ * There should be a cleaner way to do this
+ *
+ * @param path $aDirectory
+ * @return array
+ */
+ public static function getDirectoryList($aDirectory)
{
- $result[] = $directory->getPath()."/";
- }
+ $result = array();
- return array_unique($result);
- }
+ foreach (new rtPhptFilterIterator(new RecursiveIteratorIterator(new
RecursiveDirectoryIterator($aDirectory))) as $directory) {
+ $result[] = $directory->getPath() . "/";
+ }
+ return array_unique($result);
+ }
}
-?>
\ No newline at end of file
+?>