| @@ 105-115 (lines=11) @@ | ||
| 102 | * |
|
| 103 | * @return string |
|
| 104 | */ |
|
| 105 | public function toCode() |
|
| 106 | { |
|
| 107 | return 'if ('. $this->getInvertString() .') { |
|
| 108 | ' . ReservedKeywords::FAILURE_VARIABLE . '[] = sprintf( |
|
| 109 | \'%s must be an instance of %s, %s found instead.\', |
|
| 110 | \'' . str_replace(ReservedKeywords::RESULT, 'The returned object', $this->operand) . '\', |
|
| 111 | \'' . $this->class . '\', |
|
| 112 | ' . $this->operand . ' === null ? \'null\' : get_class(' . $this->operand . ') |
|
| 113 | ); |
|
| 114 | }'; |
|
| 115 | } |
|
| 116 | } |
|
| 117 | ||
| @@ 119-130 (lines=12) @@ | ||
| 116 | * |
|
| 117 | * @return string |
|
| 118 | */ |
|
| 119 | public function toCode() |
|
| 120 | { |
|
| 121 | return 'if ('. $this->getInvertString() .') { |
|
| 122 | ' . ReservedKeywords::FAILURE_VARIABLE . '[] = sprintf( |
|
| 123 | \'%s must be of the type %s, %s found instead.\', |
|
| 124 | \'' . str_replace(ReservedKeywords::RESULT, 'The returned value', $this->operand) . '\', |
|
| 125 | \'' . $this->type . '\', |
|
| 126 | gettype(' . $this->operand . ') |
|
| 127 | ); |
|
| 128 | } |
|
| 129 | '; |
|
| 130 | } |
|
| 131 | } |
|
| 132 | ||