protected static function fromArray(
        Client $client,
        array $post
    ): self {
        $originalFile = isset($post['file_ext'])
            ? File::fromArray($post)
            : null;

        $tags = Tag::byNames($client, explode(' ', $post['tag_string']));

        return new self(
            $post['id'],
            DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', $post['created_at']),
            $post['md5'] ?? null,
            self::getRatingByStringIdentifier($post['rating']),
            $post['score'],
            self::getStatusByBooleanFlags($post['is_pending'], $post['is_deleted'], $post['is_banned']),
            $post['preview_file_url'] ?? null,
            $originalFile,
            $post['source'],
            $tags
        );
    }
protected static function fromArray(
        Client $client,
        array $post
    ): self {
        $originalFile = isset($post['file_ext'])
            ? File::fromArray($post)
            : null;

        $tags = Tag::byNames($client, explode(' ', $post['tag_string']));

        return new self(
            $post['id'],
            DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', $post['created_at']),
            $post['md5'] ?? null,
            self::getRatingByStringIdentifier($post['rating']),
            $post['score'],
            self::getStatusByBooleanFlags($post['is_pending'], $post['is_deleted'], $post['is_banned']),
            $post['preview_file_url'] ?? null,
            $originalFile,
            $post['source'],
            $tags
        );
    }
protected static function fromArray ( Client $ client , array $ post ) : self { $ originalFile = isset ( $ post [ 'file_ext' ] ) ? File :: fromArray ( $ post ) : null ; $ tags = Tag :: byNames ( $ client , explode ( ' ' , $ post [ 'tag_string' ] ) ) ; return new self ( $ post [ 'id' ] , DateTimeImmutable :: createFromFormat ( 'Y-m-d\TH:i:s.uP' , $ post [ 'created_at' ] ) , $ post [ 'md5' ] ?? null , self :: getRatingByStringIdentifier ( $ post [ 'rating' ] ) , $ post [ 'score' ] , self :: getStatusByBooleanFlags ( $ post [ 'is_pending' ] , $ post [ 'is_deleted' ] , $ post [ 'is_banned' ] ) , $ post [ 'preview_file_url' ] ?? null , $ originalFile , $ post [ 'source' ] , $ tags ) ; }
Creates Post instance from API response.

@param Client $client
@param array  $post

@return Post
Creates Post instance from API response .