HEX
Server: Apache
System: Linux srv13.cpanelhost.cl 3.10.0-962.3.2.lve1.5.38.el7.x86_64 #1 SMP Thu Jun 18 05:28:41 EDT 2020 x86_64
User: cca63905 (4205)
PHP: 7.3.20
Disabled: NONE
Upload Files
File: //proc/self/cwd/nueva/vendor/league/tactician-bundle/src/Middleware/InvalidCommandException.php
<?php

namespace League\Tactician\Bundle\Middleware;

use League\Tactician\Exception\Exception;
use Symfony\Component\Validator\ConstraintViolationListInterface;

class InvalidCommandException extends \Exception implements Exception
{
    /**
     * @var object
     */
    protected $command;

    /**
     * @var ConstraintViolationListInterface
     */
    protected $violations;

    /**
     * @param object $command
     * @param ConstraintViolationListInterface $violations
     *
     * @return static
     */
    public static function onCommand($command, ConstraintViolationListInterface $violations)
    {
        $exception = new static(
            'Validation failed for ' . get_class($command) .
            ' with ' . $violations->count() . ' violation(s).'
        );

        $exception->command    = $command;
        $exception->violations = $violations;

        return $exception;
    }

    /**
     * @return object
     */
    public function getCommand()
    {
        return $this->command;
    }

    /**
     * @return ConstraintViolationListInterface
     */
    public function getViolations()
    {
        return $this->violations;
    }
}