commitall

This commit is contained in:
Sampanna Rimal
2024-07-10 18:28:19 +05:45
parent 140abda4e6
commit 9cd05ef3cb
15723 changed files with 4818733 additions and 0 deletions

View File

@ -0,0 +1,40 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Call;
use Prophecy\Exception\Prophecy\ObjectProphecyException;
use Prophecy\Prophecy\ObjectProphecy;
class UnexpectedCallException extends ObjectProphecyException
{
private $methodName;
private $arguments;
public function __construct($message, ObjectProphecy $objectProphecy,
$methodName, array $arguments)
{
parent::__construct($message, $objectProphecy);
$this->methodName = $methodName;
$this->arguments = $arguments;
}
public function getMethodName()
{
return $this->methodName;
}
public function getArguments()
{
return $this->arguments;
}
}

View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Doubler;
use Prophecy\Doubler\Generator\Node\ClassNode;
class ClassCreatorException extends \RuntimeException implements DoublerException
{
private $node;
public function __construct($message, ClassNode $node)
{
parent::__construct($message);
$this->node = $node;
}
public function getClassNode()
{
return $this->node;
}
}

View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Doubler;
use ReflectionClass;
class ClassMirrorException extends \RuntimeException implements DoublerException
{
private $class;
public function __construct($message, ReflectionClass $class)
{
parent::__construct($message);
$this->class = $class;
}
public function getReflectedClass()
{
return $this->class;
}
}

View File

@ -0,0 +1,33 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Doubler;
class ClassNotFoundException extends DoubleException
{
private $classname;
/**
* @param string $message
* @param string $classname
*/
public function __construct($message, $classname)
{
parent::__construct($message);
$this->classname = $classname;
}
public function getClassname()
{
return $this->classname;
}
}

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Doubler;
use RuntimeException;
class DoubleException extends RuntimeException implements DoublerException
{
}

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Doubler;
use Prophecy\Exception\Exception;
interface DoublerException extends Exception
{
}

View File

@ -0,0 +1,20 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Doubler;
class InterfaceNotFoundException extends ClassNotFoundException
{
public function getInterfaceName()
{
return $this->getClassname();
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace Prophecy\Exception\Doubler;
class MethodNotExtendableException extends DoubleException
{
private $methodName;
private $className;
/**
* @param string $message
* @param string $className
* @param string $methodName
*/
public function __construct($message, $className, $methodName)
{
parent::__construct($message);
$this->methodName = $methodName;
$this->className = $className;
}
/**
* @return string
*/
public function getMethodName()
{
return $this->methodName;
}
/**
* @return string
*/
public function getClassName()
{
return $this->className;
}
}

View File

@ -0,0 +1,60 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Doubler;
class MethodNotFoundException extends DoubleException
{
/**
* @var string|object
*/
private $classname;
/**
* @var string
*/
private $methodName;
/**
* @var array
*/
private $arguments;
/**
* @param string $message
* @param string|object $classname
* @param string $methodName
* @param null|Argument\ArgumentsWildcard|array $arguments
*/
public function __construct($message, $classname, $methodName, $arguments = null)
{
parent::__construct($message);
$this->classname = $classname;
$this->methodName = $methodName;
$this->arguments = $arguments;
}
public function getClassname()
{
return $this->classname;
}
public function getMethodName()
{
return $this->methodName;
}
public function getArguments()
{
return $this->arguments;
}
}

View File

@ -0,0 +1,41 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Doubler;
class ReturnByReferenceException extends DoubleException
{
private $classname;
private $methodName;
/**
* @param string $message
* @param string $classname
* @param string $methodName
*/
public function __construct($message, $classname, $methodName)
{
parent::__construct($message);
$this->classname = $classname;
$this->methodName = $methodName;
}
public function getClassname()
{
return $this->classname;
}
public function getMethodName()
{
return $this->methodName;
}
}

View File

@ -0,0 +1,26 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception;
/**
* Core Prophecy exception interface.
* All Prophecy exceptions implement it.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
interface Exception
{
/**
* @return string
*/
public function getMessage();
}

View File

@ -0,0 +1,16 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception;
class InvalidArgumentException extends \InvalidArgumentException implements Exception
{
}

View File

@ -0,0 +1,51 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Prediction;
use Prophecy\Prophecy\ObjectProphecy;
class AggregateException extends \RuntimeException implements PredictionException
{
private $exceptions = array();
private $objectProphecy;
public function append(PredictionException $exception)
{
$message = $exception->getMessage();
$message = strtr($message, array("\n" => "\n "))."\n";
$message = empty($this->exceptions) ? $message : "\n" . $message;
$this->message = rtrim($this->message.$message);
$this->exceptions[] = $exception;
}
/**
* @return PredictionException[]
*/
public function getExceptions()
{
return $this->exceptions;
}
public function setObjectProphecy(ObjectProphecy $objectProphecy)
{
$this->objectProphecy = $objectProphecy;
}
/**
* @return ObjectProphecy
*/
public function getObjectProphecy()
{
return $this->objectProphecy;
}
}

View File

@ -0,0 +1,24 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Prediction;
use RuntimeException;
/**
* Basic failed prediction exception.
* Use it for custom prediction failures.
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
class FailedPredictionException extends RuntimeException implements PredictionException
{
}

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Prediction;
use Prophecy\Exception\Prophecy\MethodProphecyException;
class NoCallsException extends MethodProphecyException implements PredictionException
{
}

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Prediction;
use Prophecy\Exception\Exception;
interface PredictionException extends Exception
{
}

View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Prediction;
use Prophecy\Prophecy\MethodProphecy;
class UnexpectedCallsCountException extends UnexpectedCallsException
{
private $expectedCount;
public function __construct($message, MethodProphecy $methodProphecy, $count, array $calls)
{
parent::__construct($message, $methodProphecy, $calls);
$this->expectedCount = intval($count);
}
public function getExpectedCount()
{
return $this->expectedCount;
}
}

View File

@ -0,0 +1,32 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Prediction;
use Prophecy\Prophecy\MethodProphecy;
use Prophecy\Exception\Prophecy\MethodProphecyException;
class UnexpectedCallsException extends MethodProphecyException implements PredictionException
{
private $calls = array();
public function __construct($message, MethodProphecy $methodProphecy, array $calls)
{
parent::__construct($message, $methodProphecy);
$this->calls = $calls;
}
public function getCalls()
{
return $this->calls;
}
}

View File

@ -0,0 +1,34 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Prophecy;
use Prophecy\Prophecy\MethodProphecy;
class MethodProphecyException extends ObjectProphecyException
{
private $methodProphecy;
public function __construct($message, MethodProphecy $methodProphecy)
{
parent::__construct($message, $methodProphecy->getObjectProphecy());
$this->methodProphecy = $methodProphecy;
}
/**
* @return MethodProphecy
*/
public function getMethodProphecy()
{
return $this->methodProphecy;
}
}

View File

@ -0,0 +1,34 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Prophecy;
use Prophecy\Prophecy\ObjectProphecy;
class ObjectProphecyException extends \RuntimeException implements ProphecyException
{
private $objectProphecy;
public function __construct($message, ObjectProphecy $objectProphecy)
{
parent::__construct($message);
$this->objectProphecy = $objectProphecy;
}
/**
* @return ObjectProphecy
*/
public function getObjectProphecy()
{
return $this->objectProphecy;
}
}

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the Prophecy.
* (c) Konstantin Kudryashov <ever.zet@gmail.com>
* Marcello Duarte <marcello.duarte@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Prophecy\Exception\Prophecy;
use Prophecy\Exception\Exception;
interface ProphecyException extends Exception
{
}