@@ 104-110 (lines=7) @@ | ||
101 | * @return $this |
|
102 | */ |
|
103 | public function addUseStatement($qualifiedName, $alias = null) { |
|
104 | if (!is_string($alias)) { |
|
105 | if (false === strpos($qualifiedName, '\\')) { |
|
106 | $alias = $qualifiedName; |
|
107 | } else { |
|
108 | $alias = substr($qualifiedName, strrpos($qualifiedName, '\\') + 1); |
|
109 | } |
|
110 | } |
|
111 | ||
112 | $this->useStatements[$alias] = $qualifiedName; |
|
113 |
@@ 95-99 (lines=5) @@ | ||
92 | if ($useStatements = $struct->getUseStatements()) { |
|
93 | $this->ensureBlankLine(); |
|
94 | foreach ($useStatements as $alias => $namespace) { |
|
95 | if (false === strpos($namespace, '\\')) { |
|
96 | $commonName = $namespace; |
|
97 | } else { |
|
98 | $commonName = substr($namespace, strrpos($namespace, '\\') + 1); |
|
99 | } |
|
100 | ||
101 | if (false === strpos($namespace, '\\') && !$struct->getNamespace()) { |
|
102 | //avoid fatal 'The use statement with non-compound name '$commonName' has no effect' |