Copy domains.

@param $name

@return bool
341875
public function copyDomain($name)
    {
        file_put_contents(
            $this->getDomainPath("/Contracts/{$name}Interface.php"),
            $this->prepare(file_get_contents($this->domainInterfaceContract))
        );

        file_put_contents(
            $this->getDomainPath("/Contracts/{$name}RepositoryInterface.php"),
            $this->prepare(file_get_contents($this->domainRepositoryContract))
        );

        file_put_contents(
            $this->getDomainPath("/Contracts/{$name}ServiceInterface.php"),
            $this->prepare(file_get_contents($this->domainServiceContract))
        );

        file_put_contents($this->getDomainPath("/{$name}Eloquent.php"), $this->prepare(file_get_contents($this->domainEloquent)));
        file_put_contents($this->getDomainPath("/{$name}Repository.php"), $this->prepare(file_get_contents($this->domainRepository)));
        file_put_contents($this->getDomainPath("/{$name}Service.php"), $this->prepare(file_get_contents($this->domainService)));

        return true;
    }
1123889
protected function rmdir($name = '')
    {
        $result = true;
        $name = preg_replace(array('!\.{1,2}/!', '!^/!', '!/$!'), '', $name);
        $name = $this->dirData.$name;
        if (is_dir($name))
        {
            $files = glob($name.'/{.*,*}', GLOB_BRACE);
            for ($i = 0; $i < count($files); $i++)
            {
                if (substr($files[$i], -2) == '/.' || substr($files[$i], -3) == '/..') continue;
                if (is_dir($files[$i])) $result = $this->rmdir(substr($files[$i], strlen($this->dirData)));
                elseif (is_file($files[$i])) $result = filedelete($files[$i]);
                if (!$result) break;
            }
            if ($result) $result = rmdir($name);
        }
        return $result;
    }
1275944
public function copy($name, $copy)
    {
        if (!$this->sieve)
            return $this->_set_error(self::ERROR_INTERNAL);

        if ($copy) {
            $content = $this->sieve->getScript($copy);

            if (is_a($content, 'PEAR_Error')) {
                return $this->_set_error(self::ERROR_OTHER);
            }
        }


        return $this->save_script($name, $content);
    }
1055426
public function deleteServer($name)
    {
        if (isset($this->config['servers']) && isset($this->config['servers'][$name])) {
            unset($this->config['servers'][$name]);
            $this->ldapUserRepo->deleteUsersByServerName($name);

            return $this->saveConfig();
        }
    }
506264
public function del($name)
    {
        if ($this->exists($name)) {
            return $this->set($name, false, time() - 3600);
        }

        return false;
    }
1252167
public static function fullyQualifiedDomainName(string $name): bool
    {
        $isValid = strlen($name) < 254;
        $isValid &= 1 === preg_match('/^(?:(?!-)[a-z0-9\-]{1,63}(?<!-)\.){1,127}$/i', $name);

        return $isValid;
    }
774250
public function createRole($name) {
		$result = $this->repository->createRole($name);
		$this->domain->const->generateRoles();
		return $result;
	}
751829
public static function delete(String $name = NULL) : Bool
    {
        $name  = self::$settings['name']  ?? $name;
        $input = self::$settings['input'] ?? false;

        self::$settings = [];

        switch( $input )
        {
            case 'post'    : unset($_POST[$name]);    break;
            case 'get'     : unset($_GET[$name]);     break;
            case 'env'     : unset($_ENV[$name]);     break;
            case 'server'  : unset($_SERVER[$name]);  break;
            case 'request' : unset($_REQUEST[$name]); break;
        }

        return true;
    }
311944
public function resolve($name)
    {
        if (class_exists($name)) {
            return $name;
        }

        $name = static::normalise($name);

        $namespaces = clone $this->namespaces;

        $this->registerDefaultNamespace($namespaces);

        foreach (clone $namespaces as $ns) {
            $class = $ns . '\\' . $name;

            if (class_exists($class = $this->resolveClassAlias($class))) {
                if ($this->baseClass && !is_subclass_of($class, $this->baseClass)) {
                    throw new \DomainException(sprintf(
                        'Class: "%s" should be sub class of %s',
                        $class,
                        $this->baseClass
                    ));
                }

                return $class;
            }
        }

        throw new \DomainException(sprintf(
            'Can not find any classes with name: "%s" in package: "%s", namespaces: ( %s ).',
            $name,
            $this->package->getName(),
            implode(" |\n ", $namespaces->toArray())
        ));
    }
1219235
public function setDomains($domains)
    {
        if (is_array($domains)) {
            foreach ($domains as $domain) {
                $this->setDomains($domain);
            }
            return $this;
        }

        $this->domains[] = $domains;

        return $this;
    }
1337940
protected function _copy($source, $targetDir, $name) {
		$res = false;
		
		if ($this->tmp) {
			$local  = $this->getTempFile();
			$target = $targetDir.DIRECTORY_SEPARATOR.$name;

			if (ftp_get($this->connect, $local, $source, FTP_BINARY)
			&& ftp_put($this->connect, $target, $local, $this->ftpMode($target))) {
				$res = $target;
			}
			@unlink($local);
		}
		
		return $res;
	}
781429
public function withName(string $name): self
    {
        $self = clone $this;
        $self->name = $name;

        return $self;
    }
36839
public function controllerNameEquals($name) {
        $controllerName = strtolower($this->getControllerName());

        if (is_array($name)) {
            foreach ($name as $n) {
                if ($controllerName == strtolower($n)) {
                    return true;
                }
            }

            return false;
        }
        else {
            return $controllerName == strtolower($name);
        }
    }
1373109
public function export(string $name)
    {
        $url = self::$base_url.'/'.$name.'/get';

        return self::$curl->get($url);
    }
925413
public function create($name)
    {
        $params = array(
            "tag" => array(
                "name" => $name
            )
        );
        $rst = $this->_request->post($this->_url . 'tags/create', $params);
        return $this->_client->rst($rst);
    }
1099815
public function dn($name)
    {
        $info = $this->find($name);

        if (is_array($info) && array_key_exists('dn', $info)) {
            return $info['dn'];
        }

        return false;
    }
270843
public function pull($name) {
        $result = $this->get($name, false);
        if ($result) {
            $this->rm($name);
            return $result;
        }
        else {
            return;
        }
    }