public function __construct()

in util/Endpoint.php [69:103]


    public function __construct(
        string $fileName,
        string $content,
        string $version,
        string $buildhash
    ) {
        $this->apiName = basename($fileName, '.json');
        $parts = explode('.', $this->apiName);
        if (count($parts) === 1) {
            $this->namespace = '';
            $this->name = $parts[0];
        } elseif (count($parts) === 2) {
            $this->namespace = $parts[0];
            $this->name = $parts[1];
        }
        try {
            $this->content = json_decode(
                $content,
                true,
                512,
                JSON_THROW_ON_ERROR
            );
        } catch (JsonException $e) {
            throw new Exception(sprintf(
                "The content of the endpoint is not JSON: %s\n",
                $e->getMessage()
            ));
        }
        $this->content = $this->content[$this->apiName];
        $this->version = $version;
        $this->buildhash = $buildhash;

        $this->parts = $this->getPartsFromContent($this->content);
        $this->requiredParts = $this->getRequiredParts($this->content);
    }