Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
parseFamilyMethod.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 
8 {
9 
10  public $methodName = '';
11  public $className = '';
12  /**
13  * @static
14  * @param $methCall
15  * @return parseFamilyMethod
16  */
17  public function parse($methCall, $noOut = false)
18  {
19 
20  $this->initParse($methCall);
21 
22  $methodName = trim(substr($methCall, 0, $this->firstParenthesis));
23  if ($this->checkParenthesis()) {
24  if (strpos($methodName, '::') === false) {
25  $this->setError(ErrorCode::getError('ATTR1251', $methCall));
26  } else {
27 
28  list($className, $methodName) = explode('::', $methodName, 2);
29  $this->methodName = $methodName;
30  $this->className = $className;
31 
32  if (!$this->isPHPName($methodName)) {
33  $this->setError(ErrorCode::getError('ATTR1252', $methodName));
34  } elseif ($className && (!$this->isPHPClassName($className))) {
35  $this->setError(ErrorCode::getError('ATTR1253', $className));
36  } else {
37  $inputString = substr($methCall, $this->firstParenthesis + 1, ($this->lastParenthesis - $this->firstParenthesis - 1));
38  $this->inputString = $inputString;
39 
40  $this->parseArguments();
41  $this->parseOutput();
42  if ($noOut) $this->limitOutputToZero();
43  else $this->limitOutputToOne();
44  }
45  }
46  }
47 
48  return $this;
49  }
50 
51  protected function limitOutputToOne()
52  {
53  if (count($this->outputs) > 1) {
54  $this->setError(ErrorCode::getError('ATTR1254', $this->funcCall));
55  }
56  }
57 
58  protected function limitOutputToZero()
59  {
60  if (count($this->outputs) > 0) {
61  $this->setError(ErrorCode::getError('ATTR1255', $this->funcCall));
62  } elseif ($this->lastSemiColumn > $this->lastParenthesis) {
63  $this->setError(ErrorCode::getError('ATTR1255', $this->funcCall));
64  }
65  }
66 }
static getError($code, $args=null)
Definition: ErrorCode.php:27
parse($methCall, $noOut=false)
← centre documentaire © anakeen