PHP 8.2.31
Preview: FakeMetadataFactory.php Size: 1.41 KB
//opt/alt/php54/usr/share/pear/test/Validator/Symfony/Component/Validator/Tests/Fixtures/FakeMetadataFactory.php

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Validator\Tests\Fixtures;

use Symfony\Component\Validator\MetadataFactoryInterface;
use Symfony\Component\Validator\Exception\NoSuchMetadataException;
use Symfony\Component\Validator\Mapping\ClassMetadata;

class FakeMetadataFactory implements MetadataFactoryInterface
{
    protected $metadatas = array();

    public function getMetadataFor($class)
    {
        if (is_object($class)) {
            $class = get_class($class);
        }

        if (!is_string($class)) {
            throw new NoSuchMetadataException(sprintf('No metadata for type %s', gettype($class)));
        }

        if (!isset($this->metadatas[$class])) {
            throw new NoSuchMetadataException(sprintf('No metadata for "%s"', $class));
        }

        return $this->metadatas[$class];
    }

    public function hasMetadataFor($class)
    {
        if (is_object($class)) {
            $class = get_class($class);
        }

        if (!is_string($class)) {
            return false;
        }

        return isset($this->metadatas[$class]);
    }

    public function addMetadata(ClassMetadata $metadata)
    {
        $this->metadatas[$metadata->getClassName()] = $metadata;
    }
}

Directory Contents

Dirs: 0 × Files: 20

Name Size Perms Modified Actions
529 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
467 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
643 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
938 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
516 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
625 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
645 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
651 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
1.84 KB lrw-r--r-- 2019-12-18 11:22:58
Edit Download
323 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
568 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
536 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
615 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
1.41 KB lrw-r--r-- 2019-12-18 11:22:58
Edit Download
912 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
780 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
385 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
330 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
473 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download
313 B lrw-r--r-- 2019-12-18 11:22:58
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).