/** * Set class namespace, default namespace will be automatically joined. Namespace will be * normalized. * * @param string $namespace * @return $this */ public function setNamespace($namespace) { $namespace = str_replace('/', '\\', $namespace); //Cutting start and end symbols $namespace = trim($namespace, '\\'); $chunks = [$this->options['namespace']]; foreach (explode('\\', $namespace) as $chunk) { $chunks[] = ucfirst($chunk); } $this->file->setNamespace(trim(join('\\', $chunks), '\\')); return $this; }