for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of PhpUnitGen.
*
* (c) 2017-2018 Paul Thébaud <[email protected]>
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
namespace PhpUnitGen\Model\PropertyTrait;
use Respect\Validation\Validator;
* Trait NamespaceTrait.
* @author Paul Thébaud <[email protected]>.
* @copyright 2017-2018 Paul Thébaud <[email protected]>.
* @license https://opensource.org/licenses/MIT The MIT license.
* @link https://github.com/paul-thebaud/phpunit-generator
* @since Class available since Release 2.0.0.
trait NamespaceTrait
{
* @var string[] $namespace A string[] describing a namespace.
protected $namespace = [];
* @param string[] $namespace The new namespace to be set.
public function setNamespace(array $namespace): void
$this->namespace = $namespace;
}
* @return string[] The current namespace.
public function getNamespace(): array
return $this->namespace;
* @return string|null The concat namespace parts.
public function getNamespaceString(): ?string
return Validator::notEmpty()->validate($this->namespace)?
implode('\\', $this->namespace) :
null;
* @return string|null The last namespace part.
public function getNamespaceLast(): ?string
$this->namespace[(count($this->namespace) - 1)] :