<?php

namespace inter\phpStruct;

class File
{
    private string $fileName;
    private string $namespace;
    /**  @var string[] */
    private array $uses = [];
    /**  @var PHPClass[] */
    private array $classes;
    private string $path;

    public function SetFileName(string $fileName): self
    {
        $this->fileName = $fileName;
        return $this;
    }

    public function GetFileName(): string
    {
        return $this->fileName . ".php";
    }

    public function SetNamespace(string $namespace): self
    {
        $this->namespace = $namespace;
        return $this;
    }

    public function GetNamespace(): string
    {
        return $this->namespace;
    }

    public function AddClass(PHPClass $class): self
    {
        $this->classes[] = $class;
        return $this;
    }

    /**
     * @return PHPClass[]
     */
    public function GetClasses(): array
    {
        return $this->classes;
    }

    public function SetPath(string $path): self
    {
        $this->path = $path;
        return $this;
    }

    public function GetPath(): string
    {
        return $this->path;
    }

    /**
     * 获取文件的创建时间
     */
    public function GetFileCreateTime(): string
    {
        return date("Y-m-d H:i:s");
    }

    public function AddUse(string $use): self
    {
        $this->uses[] = $use;
        return $this;
    }

    public function SetUses(array $uses): self
    {
        $this->uses = $uses;
        return $this;
    }

    /**
     * @return string[]
     */
    public function GetUses(): array
    {
        return $this->uses;
    }
}
