Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
CheckMethod.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 
7 class CheckMethod extends CheckData
8 {
9  protected $methodFile;
10  /**
11  * @var Doc
12  */
13  protected $doc;
14  /**
15  * @param array $data
16  * @param Doc $doc
17  * @return CheckMethod
18  */
19  function check(array $data, &$doc = null)
20  {
21  if (!empty($data[1])) {
22  $prefix = $data[1][0];
23  if (($prefix == '+') || ($prefix == '*')) $this->methodFile = substr($data[1], 1);
24  else $this->methodFile = $data[1];
25  $this->doc = $doc;
26  $this->checkMethodFile();
27  }
28  return $this;
29  }
30  private function getClassFile($className)
31  {
32  return sprintf('FDL/%s', $className);
33  }
34  /**
35  * check if it is a folder
36  * @return void
37  */
38  protected function checkMethodFile()
39  {
40  if ($this->methodFile) {
41  $methodFile = $this->getClassFile($this->methodFile);
42  $fileName = realpath($methodFile);
43  if ($fileName) {
44  if (CheckClass::phpLintFile($fileName, $output) === false) {
45  $this->addError(ErrorCode::getError('MTHD0002', $methodFile, $this->doc->name, implode("\n", $output)));
46  }
47  } else {
48  $this->addError(ErrorCode::getError('MTHD0001', $methodFile, $this->doc->name));
49  }
50  }
51  }
52 }
static getError($code, $args=null)
Definition: ErrorCode.php:27
check(array $data, &$doc=null)
Definition: CheckMethod.php:19
static phpLintFile($fileName, &$output)
Definition: CheckClass.php:86
addError($msg)
Definition: CheckData.php:29
$className
$data
← centre documentaire © anakeen