Browse Source

Doc comments for "YiiRequirementChecker" have been updated.

tags/2.0.0-beta
Klimov Paul 12 years ago
parent
commit
43a04d237a
  1. 6
      tests/unit/framework/requirements/YiiRequirementCheckerTest.php
  2. 56
      yii/requirements/YiiRequirementChecker.php
  3. 2
      yii/requirements/yiirequirements.php

6
tests/unit/framework/requirements/YiiRequirementCheckerTest.php

@ -5,7 +5,7 @@ require_once(realpath(__DIR__.'/../../../../yii/requirements/YiiRequirementCheck
use yiiunit\TestCase; use yiiunit\TestCase;
/** /**
* Test case for {@link YiiRequirementChecker}. * Test case for [[YiiRequirementChecker]].
* @see YiiRequirementChecker * @see YiiRequirementChecker
*/ */
class YiiRequirementCheckerTest extends TestCase class YiiRequirementCheckerTest extends TestCase
@ -134,7 +134,7 @@ class YiiRequirementCheckerTest extends TestCase
} }
/** /**
* Data provider for {@link testGetByteSize()}. * Data provider for [[testGetByteSize()]].
* @return array * @return array
*/ */
public function dataProviderGetByteSize() public function dataProviderGetByteSize()
@ -164,7 +164,7 @@ class YiiRequirementCheckerTest extends TestCase
} }
/** /**
* Data provider for {@link testCompareByteSize()} * Data provider for [[testCompareByteSize()]]
* @return array * @return array
*/ */
public function dataProviderCompareByteSize() public function dataProviderCompareByteSize()

56
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:
* <code>
* 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();
* <code>
*
* 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:
* <code>
* $requirements = array(
* array(
* 'name' => 'Upload max file size',
* 'condition' => 'eval:$this->checkUploadMaxFileSize("5M")',
* ),
* );
* </code>
*
* @property array|null $result the check results, this property is for internal usage only.
* *
* @author Paul Klimov <klimov.paul@gmail.com> * @author Paul Klimov <klimov.paul@gmail.com>
* @since 2.0 * @since 2.0
@ -23,7 +54,7 @@ class YiiRequirementChecker
/** /**
* Check the given requirements, collecting results into internal field. * Check the given requirements, collecting results into internal field.
* This method can be invoked several times checking different requirement sets. * 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. * @param array|string $requirements requirements to be checked.
* If an array, it is treated as the set of requirements; * 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; * 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 the check results.
* @return array|null check results. * @return array|null check results in format:
* <code>
* 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,
* ),
* ...
* ),
* )
* </code>
*/ */
function getResult() function getResult()
{ {

2
yii/requirements/yiirequirements.php

@ -1,6 +1,6 @@
<?php <?php
/** /**
* This is the Yii core requirements for the {@link YiiRequirementChecker} instance. * This is the Yii core requirements for the [[YiiRequirementChecker]] instance.
*/ */
return array( return array(
array( array(

Loading…
Cancel
Save