From 43a04d237a0ce61b85e18ddfa24b4331f31b2039 Mon Sep 17 00:00:00 2001 From: Klimov Paul Date: Sat, 11 May 2013 20:04:12 +0300 Subject: [PATCH] Doc comments for "YiiRequirementChecker" have been updated. --- .../requirements/YiiRequirementCheckerTest.php | 6 +-- yii/requirements/YiiRequirementChecker.php | 56 ++++++++++++++++++++-- yii/requirements/yiirequirements.php | 2 +- 3 files changed, 56 insertions(+), 8 deletions(-) diff --git a/tests/unit/framework/requirements/YiiRequirementCheckerTest.php b/tests/unit/framework/requirements/YiiRequirementCheckerTest.php index 691f5c9..484fb1c 100644 --- a/tests/unit/framework/requirements/YiiRequirementCheckerTest.php +++ b/tests/unit/framework/requirements/YiiRequirementCheckerTest.php @@ -5,7 +5,7 @@ require_once(realpath(__DIR__.'/../../../../yii/requirements/YiiRequirementCheck use yiiunit\TestCase; /** - * Test case for {@link YiiRequirementChecker}. + * Test case for [[YiiRequirementChecker]]. * @see YiiRequirementChecker */ class YiiRequirementCheckerTest extends TestCase @@ -134,7 +134,7 @@ class YiiRequirementCheckerTest extends TestCase } /** - * Data provider for {@link testGetByteSize()}. + * Data provider for [[testGetByteSize()]]. * @return array */ public function dataProviderGetByteSize() @@ -164,7 +164,7 @@ class YiiRequirementCheckerTest extends TestCase } /** - * Data provider for {@link testCompareByteSize()} + * Data provider for [[testCompareByteSize()]] * @return array */ public function dataProviderCompareByteSize() diff --git a/yii/requirements/YiiRequirementChecker.php b/yii/requirements/YiiRequirementChecker.php index bae282f..43401c9 100644 --- a/yii/requirements/YiiRequirementChecker.php +++ b/yii/requirements/YiiRequirementChecker.php @@ -11,9 +11,40 @@ if (version_compare(PHP_VERSION, '4.3', '<')) { } /** - * YiiRequirementChecker allows checking, if current system meets the requirements for running the application. + * YiiRequirementChecker allows checking, if current system meets the requirements for running the Yii application. + * This class allows rendering of the check report for the web and console application interface. * - * @property array|null $result the check results. + * Example: + * + * require_once('path/to/YiiRequirementChecker.php'); + * $requirementsChecker = YiiRequirementChecker(); + * $requirements = array( + * array( + * 'name' => 'PHP Some Extension', + * 'mandatory' => true, + * 'condition' => extension_loaded('some_extension'), + * 'by' => 'Some application feature', + * 'memo' => 'PHP extension "some_extension" required', + * ), + * ); + * $requirementsChecker->checkYii()->check($requirements)->render(); + * + * + * If you wish to render the report with your own representation, use [[getResult()]] instead of [[render()]] + * + * Requirement condition could be in format "eval:PHP expression". + * In this case specified PHP expression will be evaluated in the context of this class instance. + * For example: + * + * $requirements = array( + * array( + * 'name' => 'Upload max file size', + * 'condition' => 'eval:$this->checkUploadMaxFileSize("5M")', + * ), + * ); + * + * + * @property array|null $result the check results, this property is for internal usage only. * * @author Paul Klimov * @since 2.0 @@ -23,7 +54,7 @@ class YiiRequirementChecker /** * Check the given requirements, collecting results into internal field. * This method can be invoked several times checking different requirement sets. - * Use {@link getResult()} or {@link render()} to get the results. + * Use [[getResult()]] or [[render()]] to get the results. * @param array|string $requirements requirements to be checked. * If an array, it is treated as the set of requirements; * If a string, it is treated as the path of the file, which contains the requirements; @@ -80,7 +111,24 @@ class YiiRequirementChecker /** * Return the check results. - * @return array|null check results. + * @return array|null check results in format: + * + * array( + * 'summary' => array( + * 'total' => total number of checks, + * 'errors' => number of errors, + * 'warnings' => number of warnings, + * ), + * 'requirements' => array( + * array( + * ... + * 'error' => is there an error, + * 'warning' => is there a warning, + * ), + * ... + * ), + * ) + * */ function getResult() { diff --git a/yii/requirements/yiirequirements.php b/yii/requirements/yiirequirements.php index 2c6f4d8..9d840a9 100644 --- a/yii/requirements/yiirequirements.php +++ b/yii/requirements/yiirequirements.php @@ -1,6 +1,6 @@