Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/syn.corals.io/Corals/modules/CMS/Classes/Feed/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/syn.corals.io/Corals/modules/CMS/Classes/Feed/FeedItem.php
<?php

namespace Corals\Modules\CMS\Classes\Feed;

use Exception;
use Carbon\Carbon;
use Corals\Modules\CMS\Exceptions\InvalidFeedItem;

class FeedItem
{
    /** @var string */
    protected $id;

    /** @var string */
    protected $title;

    /** @var \Carbon\Carbon */
    protected $updated;

    /** @var string */
    protected $summary;

    /** @var string */
    protected $link;

    /** @var string */
    protected $enclosure;

    /** @var int */
    protected $enclosureLength;

    /** @var string */
    protected $enclosureType;

    /** @var string */
    protected $author;

    /** @var string */
    protected $category;

    public function __construct(array $data = [])
    {
        foreach ($data as $key => $value) {
            $this->$key = $value;
        }
    }

    public static function create(array $data = [])
    {
        return new static($data);
    }

    public function id(string $id)
    {
        $this->id = $id;

        return $this;
    }

    public function title(string $title)
    {
        $this->title = $title;

        return $this;
    }

    public function updated(Carbon $updated)
    {
        $this->updated = $updated;

        return $this;
    }

    public function summary(string $summary)
    {
        $this->summary = $summary;

        return $this;
    }

    public function link(string $link)
    {
        $this->link = $link;

        return $this;
    }

    public function enclosure(string $enclosure)
    {
        $this->enclosure = $enclosure;

        return $this;
    }

    public function enclosureLength(int $enclosureLength)
    {
        $this->enclosureLength = $enclosureLength;

        return $this;
    }

    public function enclosureType(string $enclosureType)
    {
        $this->enclosureType = $enclosureType;

        return $this;
    }

    public function author(string $author)
    {
        $this->author = $author;

        return $this;
    }

    public function category(string $category)
    {
        $this->category = $category;

        return $this;
    }

    public function validate()
    {
        $requiredFields = ['id', 'title', 'updated', 'summary', 'link', 'author'];

        foreach ($requiredFields as $requiredField) {
            if (is_null($this->$requiredField)) {
                throw InvalidFeedItem::missingField($this, $requiredField);
            }
        }
    }

    public function __get($key)
    {
        if (! isset($this->$key)) {
            throw new Exception("Property `{$key}` doesn't exist");
        }

        return $this->$key;
    }

    public function __isset($key)
    {
        return isset($this->$key);
    }
}

Spamworldpro Mini