Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
CheckInitial.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 
7 class CheckInitial extends CheckData
8 {
9  protected $InitialName;
10  protected $InitialValue = '';
11  /**
12  * @var Doc
13  */
14  protected $doc;
15  /**
16  * @param array $data
17  * @param Doc $doc
18  * @return CheckInitial
19  */
20  function check(array $data, &$doc = null)
21  {
22  $this->InitialName = trim(strtolower($data[1]));
23  if (isset($data[2])) $this->InitialValue = trim($data[2]);
24  $this->doc = $doc;
25  $this->checkInitialName();
26  $this->checkInitialValue();
27  return $this;
28  }
29  /**
30  * check Initial name syntax
31  * @return void
32  */
33  protected function checkInitialName()
34  {
35  if ($this->InitialName) {
36  if (!CheckAttr::checkAttrSyntax($this->InitialName)) {
37  $this->addError(ErrorCode::getError('INIT0001', $this->InitialName, $this->doc->name));
38  }
39  } else {
40  $this->addError(ErrorCode::getError('INIT0002', $this->doc->name));
41  }
42  }
43  /**
44  * check Initial value if seems to be method
45  * @return void
46  */
47  protected function checkInitialValue()
48  {
49  if (preg_match('/^[a-z_0-9]*::/i', $this->InitialValue)) {
50  $oParse = new parseFamilyMethod();
51  $strucFunc = $oParse->parse($this->InitialValue, true);
52  if ($err = $strucFunc->getError()) {
53 
54  $this->addError(ErrorCode::getError('INIT0003', $this->InitialName, $this->InitialValue, $this->doc->name, $err));
55  }
56  }
57  }
58 }
check(array $data, &$doc=null)
static getError($code, $args=null)
Definition: ErrorCode.php:27
static checkAttrSyntax($attrid)
Definition: checkAttr.php:609
addError($msg)
Definition: CheckData.php:29
if($file) if($subject==""&&$file) if($subject=="") $err
$data
← centre documentaire © anakeen