1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-11-09 11:42:28 +01:00

Add vendored files

This commit is contained in:
Chaoyi Zha 2016-02-27 16:11:17 -05:00
parent a1be7a0706
commit 3182a52c95
571 changed files with 64854 additions and 1 deletions

1
.gitignore vendored
View File

@ -5,5 +5,4 @@ env
.env
.env.bak
.env.example
vendor/
composer.phar

View File

@ -0,0 +1,27 @@
<?php
namespace Illuminate\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\Response;
class CheckResponseForModifications
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$response = $next($request);
if ($response instanceof Response) {
$response->isNotModified($request);
}
return $response;
}
}

120
vendor/illuminate/mail/MailServiceProvider.php vendored Executable file
View File

@ -0,0 +1,120 @@
<?php
namespace Illuminate\Mail;
use Swift_Mailer;
use Illuminate\Support\ServiceProvider;
class MailServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->singleton('mailer', function ($app) {
$this->registerSwiftMailer();
// Once we have create the mailer instance, we will set a container instance
// on the mailer. This allows us to resolve mailer classes via containers
// for maximum testability on said classes instead of passing Closures.
$mailer = new Mailer(
$app['view'], $app['swift.mailer'], $app['events']
);
$this->setMailerDependencies($mailer, $app);
// If a "from" address is set, we will set it on the mailer so that all mail
// messages sent by the applications will utilize the same "from" address
// on each one, which makes the developer's life a lot more convenient.
$from = $app['config']['mail.from'];
if (is_array($from) && isset($from['address'])) {
$mailer->alwaysFrom($from['address'], $from['name']);
}
$to = $app['config']['mail.to'];
if (is_array($to) && isset($to['address'])) {
$mailer->alwaysTo($to['address'], $to['name']);
}
// Here we will determine if the mailer should be in "pretend" mode for this
// environment, which will simply write out e-mail to the logs instead of
// sending it over the web, which is useful for local dev environments.
$pretend = $app['config']->get('mail.pretend', false);
$mailer->pretend($pretend);
return $mailer;
});
}
/**
* Set a few dependencies on the mailer instance.
*
* @param \Illuminate\Mail\Mailer $mailer
* @param \Illuminate\Foundation\Application $app
* @return void
*/
protected function setMailerDependencies($mailer, $app)
{
$mailer->setContainer($app);
if ($app->bound('Psr\Log\LoggerInterface')) {
$mailer->setLogger($app->make('Psr\Log\LoggerInterface'));
}
if ($app->bound('queue')) {
$mailer->setQueue($app['queue.connection']);
}
}
/**
* Register the Swift Mailer instance.
*
* @return void
*/
public function registerSwiftMailer()
{
$this->registerSwiftTransport();
// Once we have the transporter registered, we will register the actual Swift
// mailer instance, passing in the transport instances, which allows us to
// override this transporter instances during app start-up if necessary.
$this->app['swift.mailer'] = $this->app->share(function ($app) {
return new Swift_Mailer($app['swift.transport']->driver());
});
}
/**
* Register the Swift Transport instance.
*
* @return void
*/
protected function registerSwiftTransport()
{
$this->app['swift.transport'] = $this->app->share(function ($app) {
return new TransportManager($app);
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['mailer', 'swift.mailer', 'swift.transport'];
}
}

565
vendor/illuminate/mail/Mailer.php vendored Executable file
View File

@ -0,0 +1,565 @@
<?php
namespace Illuminate\Mail;
use Closure;
use Swift_Mailer;
use Swift_Message;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use SuperClosure\Serializer;
use Psr\Log\LoggerInterface;
use InvalidArgumentException;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Queue\Queue as QueueContract;
use Illuminate\Contracts\Mail\Mailer as MailerContract;
use Illuminate\Contracts\Mail\MailQueue as MailQueueContract;
class Mailer implements MailerContract, MailQueueContract
{
/**
* The view factory instance.
*
* @var \Illuminate\Contracts\View\Factory
*/
protected $views;
/**
* The Swift Mailer instance.
*
* @var \Swift_Mailer
*/
protected $swift;
/**
* The event dispatcher instance.
*
* @var \Illuminate\Contracts\Events\Dispatcher|null
*/
protected $events;
/**
* The global from address and name.
*
* @var array
*/
protected $from;
/**
* The log writer instance.
*
* @var \Psr\Log\LoggerInterface
*/
protected $logger;
/**
* The IoC container instance.
*
* @var \Illuminate\Contracts\Container\Container
*/
protected $container;
/**
* The queue implementation.
*
* @var \Illuminate\Contracts\Queue\Queue
*/
protected $queue;
/**
* Indicates if the actual sending is disabled.
*
* @var bool
*/
protected $pretending = false;
/**
* Array of failed recipients.
*
* @var array
*/
protected $failedRecipients = [];
/**
* Create a new Mailer instance.
*
* @param \Illuminate\Contracts\View\Factory $views
* @param \Swift_Mailer $swift
* @param \Illuminate\Contracts\Events\Dispatcher|null $events
* @return void
*/
public function __construct(Factory $views, Swift_Mailer $swift, Dispatcher $events = null)
{
$this->views = $views;
$this->swift = $swift;
$this->events = $events;
}
/**
* Set the global from address and name.
*
* @param string $address
* @param string|null $name
* @return void
*/
public function alwaysFrom($address, $name = null)
{
$this->from = compact('address', 'name');
}
/**
* Set the global to address and name.
*
* @param string $address
* @param string|null $name
* @return void
*/
public function alwaysTo($address, $name = null)
{
$this->to = compact('address', 'name');
}
/**
* Send a new message when only a raw text part.
*
* @param string $text
* @param mixed $callback
* @return int
*/
public function raw($text, $callback)
{
return $this->send(['raw' => $text], [], $callback);
}
/**
* Send a new message when only a plain part.
*
* @param string $view
* @param array $data
* @param mixed $callback
* @return int
*/
public function plain($view, array $data, $callback)
{
return $this->send(['text' => $view], $data, $callback);
}
/**
* Send a new message using a view.
*
* @param string|array $view
* @param array $data
* @param \Closure|string $callback
* @return void
*/
public function send($view, array $data, $callback)
{
$this->forceReconnection();
// First we need to parse the view, which could either be a string or an array
// containing both an HTML and plain text versions of the view which should
// be used when sending an e-mail. We will extract both of them out here.
list($view, $plain, $raw) = $this->parseView($view);
$data['message'] = $message = $this->createMessage();
// Once we have retrieved the view content for the e-mail we will set the body
// of this message using the HTML type, which will provide a simple wrapper
// to creating view based emails that are able to receive arrays of data.
$this->addContent($message, $view, $plain, $raw, $data);
$this->callMessageBuilder($callback, $message);
if (isset($this->to['address'])) {
$message->to($this->to['address'], $this->to['name'], true);
}
$message = $message->getSwiftMessage();
return $this->sendSwiftMessage($message);
}
/**
* Queue a new e-mail message for sending.
*
* @param string|array $view
* @param array $data
* @param \Closure|string $callback
* @param string|null $queue
* @return mixed
*/
public function queue($view, array $data, $callback, $queue = null)
{
$callback = $this->buildQueueCallable($callback);
return $this->queue->push('mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue);
}
/**
* Queue a new e-mail message for sending on the given queue.
*
* @param string $queue
* @param string|array $view
* @param array $data
* @param \Closure|string $callback
* @return mixed
*/
public function onQueue($queue, $view, array $data, $callback)
{
return $this->queue($view, $data, $callback, $queue);
}
/**
* Queue a new e-mail message for sending on the given queue.
*
* This method didn't match rest of framework's "onQueue" phrasing. Added "onQueue".
*
* @param string $queue
* @param string|array $view
* @param array $data
* @param \Closure|string $callback
* @return mixed
*/
public function queueOn($queue, $view, array $data, $callback)
{
return $this->onQueue($queue, $view, $data, $callback);
}
/**
* Queue a new e-mail message for sending after (n) seconds.
*
* @param int $delay
* @param string|array $view
* @param array $data
* @param \Closure|string $callback
* @param string|null $queue
* @return mixed
*/
public function later($delay, $view, array $data, $callback, $queue = null)
{
$callback = $this->buildQueueCallable($callback);
return $this->queue->later($delay, 'mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue);
}
/**
* Queue a new e-mail message for sending after (n) seconds on the given queue.
*
* @param string $queue
* @param int $delay
* @param string|array $view
* @param array $data
* @param \Closure|string $callback
* @return mixed
*/
public function laterOn($queue, $delay, $view, array $data, $callback)
{
return $this->later($delay, $view, $data, $callback, $queue);
}
/**
* Build the callable for a queued e-mail job.
*
* @param mixed $callback
* @return mixed
*/
protected function buildQueueCallable($callback)
{
if (! $callback instanceof Closure) {
return $callback;
}
return (new Serializer)->serialize($callback);
}
/**
* Handle a queued e-mail message job.
*
* @param \Illuminate\Contracts\Queue\Job $job
* @param array $data
* @return void
*/
public function handleQueuedMessage($job, $data)
{
$this->send($data['view'], $data['data'], $this->getQueuedCallable($data));
$job->delete();
}
/**
* Get the true callable for a queued e-mail message.
*
* @param array $data
* @return mixed
*/
protected function getQueuedCallable(array $data)
{
if (Str::contains($data['callback'], 'SerializableClosure')) {
return unserialize($data['callback'])->getClosure();
}
return $data['callback'];
}
/**
* Force the transport to re-connect.
*
* This will prevent errors in daemon queue situations.
*
* @return void
*/
protected function forceReconnection()
{
$this->getSwiftMailer()->getTransport()->stop();
}
/**
* Add the content to a given message.
*
* @param \Illuminate\Mail\Message $message
* @param string $view
* @param string $plain
* @param string $raw
* @param array $data
* @return void
*/
protected function addContent($message, $view, $plain, $raw, $data)
{
if (isset($view)) {
$message->setBody($this->getView($view, $data), 'text/html');
}
if (isset($plain)) {
$method = isset($view) ? 'addPart' : 'setBody';
$message->$method($this->getView($plain, $data), 'text/plain');
}
if (isset($raw)) {
$method = (isset($view) || isset($plain)) ? 'addPart' : 'setBody';
$message->$method($raw, 'text/plain');
}
}
/**
* Parse the given view name or array.
*
* @param string|array $view
* @return array
*
* @throws \InvalidArgumentException
*/
protected function parseView($view)
{
if (is_string($view)) {
return [$view, null, null];
}
// If the given view is an array with numeric keys, we will just assume that
// both a "pretty" and "plain" view were provided, so we will return this
// array as is, since must should contain both views with numeric keys.
if (is_array($view) && isset($view[0])) {
return [$view[0], $view[1], null];
}
// If the view is an array, but doesn't contain numeric keys, we will assume
// the the views are being explicitly specified and will extract them via
// named keys instead, allowing the developers to use one or the other.
if (is_array($view)) {
return [
Arr::get($view, 'html'),
Arr::get($view, 'text'),
Arr::get($view, 'raw'),
];
}
throw new InvalidArgumentException('Invalid view.');
}
/**
* Send a Swift Message instance.
*
* @param \Swift_Message $message
* @return void
*/
protected function sendSwiftMessage($message)
{
if ($this->events) {
$this->events->fire('mailer.sending', [$message]);
}
if (! $this->pretending) {
return $this->swift->send($message, $this->failedRecipients);
} elseif (isset($this->logger)) {
$this->logMessage($message);
}
}
/**
* Log that a message was sent.
*
* @param \Swift_Message $message
* @return void
*/
protected function logMessage($message)
{
$emails = implode(', ', array_keys((array) $message->getTo()));
$this->logger->info("Pretending to mail message to: {$emails}");
}
/**
* Call the provided message builder.
*
* @param \Closure|string $callback
* @param \Illuminate\Mail\Message $message
* @return mixed
*
* @throws \InvalidArgumentException
*/
protected function callMessageBuilder($callback, $message)
{
if ($callback instanceof Closure) {
return call_user_func($callback, $message);
}
if (is_string($callback)) {
return $this->container->make($callback)->mail($message);
}
throw new InvalidArgumentException('Callback is not valid.');
}
/**
* Create a new message instance.
*
* @return \Illuminate\Mail\Message
*/
protected function createMessage()
{
$message = new Message(new Swift_Message);
// If a global from address has been specified we will set it on every message
// instances so the developer does not have to repeat themselves every time
// they create a new message. We will just go ahead and push the address.
if (! empty($this->from['address'])) {
$message->from($this->from['address'], $this->from['name']);
}
return $message;
}
/**
* Render the given view.
*
* @param string $view
* @param array $data
* @return \Illuminate\View\View
*/
protected function getView($view, $data)
{
return $this->views->make($view, $data)->render();
}
/**
* Tell the mailer to not really send messages.
*
* @param bool $value
* @return void
*/
public function pretend($value = true)
{
$this->pretending = $value;
}
/**
* Check if the mailer is pretending to send messages.
*
* @return bool
*/
public function isPretending()
{
return $this->pretending;
}
/**
* Get the view factory instance.
*
* @return \Illuminate\Contracts\View\Factory
*/
public function getViewFactory()
{
return $this->views;
}
/**
* Get the Swift Mailer instance.
*
* @return \Swift_Mailer
*/
public function getSwiftMailer()
{
return $this->swift;
}
/**
* Get the array of failed recipients.
*
* @return array
*/
public function failures()
{
return $this->failedRecipients;
}
/**
* Set the Swift Mailer instance.
*
* @param \Swift_Mailer $swift
* @return void
*/
public function setSwiftMailer($swift)
{
$this->swift = $swift;
}
/**
* Set the log writer instance.
*
* @param \Psr\Log\LoggerInterface $logger
* @return $this
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
return $this;
}
/**
* Set the queue manager instance.
*
* @param \Illuminate\Contracts\Queue\Queue $queue
* @return $this
*/
public function setQueue(QueueContract $queue)
{
$this->queue = $queue;
return $this;
}
/**
* Set the IoC container instance.
*
* @param \Illuminate\Contracts\Container\Container $container
* @return void
*/
public function setContainer(Container $container)
{
$this->container = $container;
}
}

296
vendor/illuminate/mail/Message.php vendored Executable file
View File

@ -0,0 +1,296 @@
<?php
namespace Illuminate\Mail;
use Swift_Image;
use Swift_Attachment;
class Message
{
/**
* The Swift Message instance.
*
* @var \Swift_Message
*/
protected $swift;
/**
* Create a new message instance.
*
* @param \Swift_Message $swift
* @return void
*/
public function __construct($swift)
{
$this->swift = $swift;
}
/**
* Add a "from" address to the message.
*
* @param string $address
* @param string|null $name
* @return $this
*/
public function from($address, $name = null)
{
$this->swift->setFrom($address, $name);
return $this;
}
/**
* Set the "sender" of the message.
*
* @param string $address
* @param string|null $name
* @return $this
*/
public function sender($address, $name = null)
{
$this->swift->setSender($address, $name);
return $this;
}
/**
* Set the "return path" of the message.
*
* @param string $address
* @return $this
*/
public function returnPath($address)
{
$this->swift->setReturnPath($address);
return $this;
}
/**
* Add a recipient to the message.
*
* @param string|array $address
* @param string|null $name
* @param bool $override
* @return $this
*/
public function to($address, $name = null, $override = false)
{
if ($override) {
return $this->swift->setTo($address, $name);
}
return $this->addAddresses($address, $name, 'To');
}
/**
* Add a carbon copy to the message.
*
* @param string $address
* @param string|null $name
* @return $this
*/
public function cc($address, $name = null)
{
return $this->addAddresses($address, $name, 'Cc');
}
/**
* Add a blind carbon copy to the message.
*
* @param string $address
* @param string|null $name
* @return $this
*/
public function bcc($address, $name = null)
{
return $this->addAddresses($address, $name, 'Bcc');
}
/**
* Add a reply to address to the message.
*
* @param string $address
* @param string|null $name
* @return $this
*/
public function replyTo($address, $name = null)
{
return $this->addAddresses($address, $name, 'ReplyTo');
}
/**
* Add a recipient to the message.
*
* @param string|array $address
* @param string $name
* @param string $type
* @return $this
*/
protected function addAddresses($address, $name, $type)
{
if (is_array($address)) {
$this->swift->{"set{$type}"}($address, $name);
} else {
$this->swift->{"add{$type}"}($address, $name);
}
return $this;
}
/**
* Set the subject of the message.
*
* @param string $subject
* @return $this
*/
public function subject($subject)
{
$this->swift->setSubject($subject);
return $this;
}
/**
* Set the message priority level.
*
* @param int $level
* @return $this
*/
public function priority($level)
{
$this->swift->setPriority($level);
return $this;
}
/**
* Attach a file to the message.
*
* @param string $file
* @param array $options
* @return $this
*/
public function attach($file, array $options = [])
{
$attachment = $this->createAttachmentFromPath($file);
return $this->prepAttachment($attachment, $options);
}
/**
* Create a Swift Attachment instance.
*
* @param string $file
* @return \Swift_Attachment
*/
protected function createAttachmentFromPath($file)
{
return Swift_Attachment::fromPath($file);
}
/**
* Attach in-memory data as an attachment.
*
* @param string $data
* @param string $name
* @param array $options
* @return $this
*/
public function attachData($data, $name, array $options = [])
{
$attachment = $this->createAttachmentFromData($data, $name);
return $this->prepAttachment($attachment, $options);
}
/**
* Create a Swift Attachment instance from data.
*
* @param string $data
* @param string $name
* @return \Swift_Attachment
*/
protected function createAttachmentFromData($data, $name)
{
return Swift_Attachment::newInstance($data, $name);
}
/**
* Embed a file in the message and get the CID.
*
* @param string $file
* @return string
*/
public function embed($file)
{
return $this->swift->embed(Swift_Image::fromPath($file));
}
/**
* Embed in-memory data in the message and get the CID.
*
* @param string $data
* @param string $name
* @param string|null $contentType
* @return string
*/
public function embedData($data, $name, $contentType = null)
{
$image = Swift_Image::newInstance($data, $name, $contentType);
return $this->swift->embed($image);
}
/**
* Prepare and attach the given attachment.
*
* @param \Swift_Attachment $attachment
* @param array $options
* @return $this
*/
protected function prepAttachment($attachment, $options = [])
{
// First we will check for a MIME type on the message, which instructs the
// mail client on what type of attachment the file is so that it may be
// downloaded correctly by the user. The MIME option is not required.
if (isset($options['mime'])) {
$attachment->setContentType($options['mime']);
}
// If an alternative name was given as an option, we will set that on this
// attachment so that it will be downloaded with the desired names from
// the developer, otherwise the default file names will get assigned.
if (isset($options['as'])) {
$attachment->setFilename($options['as']);
}
$this->swift->attach($attachment);
return $this;
}
/**
* Get the underlying Swift Message instance.
*
* @return \Swift_Message
*/
public function getSwiftMessage()
{
return $this->swift;
}
/**
* Dynamically pass missing methods to the Swift instance.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
$callable = [$this->swift, $method];
return call_user_func_array($callable, $parameters);
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace Illuminate\Mail\Transport;
use Swift_Mime_Message;
use Swift_Mime_MimeEntity;
use Psr\Log\LoggerInterface;
class LogTransport extends Transport
{
/**
* The Logger instance.
*
* @var \Psr\Log\LoggerInterface
*/
protected $logger;
/**
* Create a new log transport instance.
*
* @param \Psr\Log\LoggerInterface $logger
* @return void
*/
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
/**
* {@inheritdoc}
*/
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
{
$this->beforeSendPerformed($message);
$this->logger->debug($this->getMimeEntityString($message));
}
/**
* Get a loggable string out of a Swiftmailer entity.
*
* @param \Swift_Mime_MimeEntity $entity
* @return string
*/
protected function getMimeEntityString(Swift_Mime_MimeEntity $entity)
{
$string = (string) $entity->getHeaders().PHP_EOL.$entity->getBody();
foreach ($entity->getChildren() as $children) {
$string .= PHP_EOL.PHP_EOL.$this->getMimeEntityString($children);
}
return $string;
}
}

View File

@ -0,0 +1,146 @@
<?php
namespace Illuminate\Mail\Transport;
use Swift_Mime_Message;
use GuzzleHttp\Post\PostFile;
use GuzzleHttp\ClientInterface;
class MailgunTransport extends Transport
{
/**
* Guzzle client instance.
*
* @var \GuzzleHttp\ClientInterface
*/
protected $client;
/**
* The Mailgun API key.
*
* @var string
*/
protected $key;
/**
* The Mailgun domain.
*
* @var string
*/
protected $domain;
/**
* THe Mailgun API end-point.
*
* @var string
*/
protected $url;
/**
* Create a new Mailgun transport instance.
*
* @param \GuzzleHttp\ClientInterface $client
* @param string $key
* @param string $domain
* @return void
*/
public function __construct(ClientInterface $client, $key, $domain)
{
$this->client = $client;
$this->key = $key;
$this->setDomain($domain);
}
/**
* {@inheritdoc}
*/
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
{
$this->beforeSendPerformed($message);
$options = ['auth' => ['api', $this->key]];
$to = $this->getTo($message);
$message->setBcc([]);
if (version_compare(ClientInterface::VERSION, '6') === 1) {
$options['multipart'] = [
['name' => 'to', 'contents' => $to],
['name' => 'message', 'contents' => $message->toString(), 'filename' => 'message.mime'],
];
} else {
$options['body'] = [
'to' => $to,
'message' => new PostFile('message', $message->toString()),
];
}
return $this->client->post($this->url, $options);
}
/**
* Get the "to" payload field for the API request.
*
* @param \Swift_Mime_Message $message
* @return array
*/
protected function getTo(Swift_Mime_Message $message)
{
$formatted = [];
$contacts = array_merge(
(array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc()
);
foreach ($contacts as $address => $display) {
$formatted[] = $display ? $display." <$address>" : $address;
}
return implode(',', $formatted);
}
/**
* Get the API key being used by the transport.
*
* @return string
*/
public function getKey()
{
return $this->key;
}
/**
* Set the API key being used by the transport.
*
* @param string $key
* @return string
*/
public function setKey($key)
{
return $this->key = $key;
}
/**
* Get the domain being used by the transport.
*
* @return string
*/
public function getDomain()
{
return $this->domain;
}
/**
* Set the domain being used by the transport.
*
* @param string $domain
* @return void
*/
public function setDomain($domain)
{
$this->url = 'https://api.mailgun.net/v3/'.$domain.'/messages.mime';
return $this->domain = $domain;
}
}

View File

@ -0,0 +1,107 @@
<?php
namespace Illuminate\Mail\Transport;
use Swift_Mime_Message;
use GuzzleHttp\ClientInterface;
class MandrillTransport extends Transport
{
/**
* Guzzle client instance.
*
* @var \GuzzleHttp\ClientInterface
*/
protected $client;
/**
* The Mandrill API key.
*
* @var string
*/
protected $key;
/**
* Create a new Mandrill transport instance.
*
* @param \GuzzleHttp\ClientInterface $client
* @param string $key
* @return void
*/
public function __construct(ClientInterface $client, $key)
{
$this->client = $client;
$this->key = $key;
}
/**
* {@inheritdoc}
*/
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
{
$this->beforeSendPerformed($message);
$data = [
'key' => $this->key,
'to' => $this->getToAddresses($message),
'raw_message' => $message->toString(),
'async' => false,
];
if (version_compare(ClientInterface::VERSION, '6') === 1) {
$options = ['form_params' => $data];
} else {
$options = ['body' => $data];
}
return $this->client->post('https://mandrillapp.com/api/1.0/messages/send-raw.json', $options);
}
/**
* Get all the addresses this message should be sent to.
*
* Note that Mandrill still respects CC, BCC headers in raw message itself.
*
* @param \Swift_Mime_Message $message
* @return array
*/
protected function getToAddresses(Swift_Mime_Message $message)
{
$to = [];
if ($message->getTo()) {
$to = array_merge($to, array_keys($message->getTo()));
}
if ($message->getCc()) {
$to = array_merge($to, array_keys($message->getCc()));
}
if ($message->getBcc()) {
$to = array_merge($to, array_keys($message->getBcc()));
}
return $to;
}
/**
* Get the API key being used by the transport.
*
* @return string
*/
public function getKey()
{
return $this->key;
}
/**
* Set the API key being used by the transport.
*
* @param string $key
* @return string
*/
public function setKey($key)
{
return $this->key = $key;
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace Illuminate\Mail\Transport;
use Aws\Ses\SesClient;
use Swift_Mime_Message;
class SesTransport extends Transport
{
/**
* The Amazon SES instance.
*
* @var \Aws\Ses\SesClient
*/
protected $ses;
/**
* Create a new SES transport instance.
*
* @param \Aws\Ses\SesClient $ses
* @return void
*/
public function __construct(SesClient $ses)
{
$this->ses = $ses;
}
/**
* {@inheritdoc}
*/
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
{
$this->beforeSendPerformed($message);
return $this->ses->sendRawEmail([
'Source' => key($message->getSender() ?: $message->getFrom()),
'RawMessage' => [
'Data' => $message->toString(),
],
]);
}
}

View File

@ -0,0 +1,70 @@
<?php
namespace Illuminate\Mail\Transport;
use Swift_Transport;
use Swift_Mime_Message;
use Swift_Events_SendEvent;
use Swift_Events_EventListener;
abstract class Transport implements Swift_Transport
{
/**
* The plug-ins registered with the transport.
*
* @var array
*/
public $plugins = [];
/**
* {@inheritdoc}
*/
public function isStarted()
{
return true;
}
/**
* {@inheritdoc}
*/
public function start()
{
return true;
}
/**
* {@inheritdoc}
*/
public function stop()
{
return true;
}
/**
* Register a plug-in with the transport.
*
* @param \Swift_Events_EventListener $plugin
* @return void
*/
public function registerPlugin(Swift_Events_EventListener $plugin)
{
array_push($this->plugins, $plugin);
}
/**
* Iterate through registered plugins and execute plugins' methods.
*
* @param \Swift_Mime_Message $message
* @return void
*/
protected function beforeSendPerformed(Swift_Mime_Message $message)
{
$event = new Swift_Events_SendEvent($this, $message);
foreach ($this->plugins as $plugin) {
if (method_exists($plugin, 'beforeSendPerformed')) {
$plugin->beforeSendPerformed($event);
}
}
}
}

View File

@ -0,0 +1,151 @@
<?php
namespace Illuminate\Mail;
use Aws\Ses\SesClient;
use Illuminate\Support\Arr;
use Illuminate\Support\Manager;
use GuzzleHttp\Client as HttpClient;
use Swift_SmtpTransport as SmtpTransport;
use Swift_MailTransport as MailTransport;
use Illuminate\Mail\Transport\LogTransport;
use Illuminate\Mail\Transport\MailgunTransport;
use Illuminate\Mail\Transport\MandrillTransport;
use Illuminate\Mail\Transport\SesTransport;
use Swift_SendmailTransport as SendmailTransport;
class TransportManager extends Manager
{
/**
* Create an instance of the SMTP Swift Transport driver.
*
* @return \Swift_SmtpTransport
*/
protected function createSmtpDriver()
{
$config = $this->app['config']['mail'];
// The Swift SMTP transport instance will allow us to use any SMTP backend
// for delivering mail such as Sendgrid, Amazon SES, or a custom server
// a developer has available. We will just pass this configured host.
$transport = SmtpTransport::newInstance(
$config['host'], $config['port']
);
if (isset($config['encryption'])) {
$transport->setEncryption($config['encryption']);
}
// Once we have the transport we will check for the presence of a username
// and password. If we have it we will set the credentials on the Swift
// transporter instance so that we'll properly authenticate delivery.
if (isset($config['username'])) {
$transport->setUsername($config['username']);
$transport->setPassword($config['password']);
}
return $transport;
}
/**
* Create an instance of the Sendmail Swift Transport driver.
*
* @return \Swift_SendmailTransport
*/
protected function createSendmailDriver()
{
$command = $this->app['config']['mail']['sendmail'];
return SendmailTransport::newInstance($command);
}
/**
* Create an instance of the Amazon SES Swift Transport driver.
*
* @return \Swift_SendmailTransport
*/
protected function createSesDriver()
{
$config = $this->app['config']->get('services.ses', []);
$config += [
'version' => 'latest', 'service' => 'email',
];
if ($config['key'] && $config['secret']) {
$config['credentials'] = Arr::only($config, ['key', 'secret']);
}
return new SesTransport(new SesClient($config));
}
/**
* Create an instance of the Mail Swift Transport driver.
*
* @return \Swift_MailTransport
*/
protected function createMailDriver()
{
return MailTransport::newInstance();
}
/**
* Create an instance of the Mailgun Swift Transport driver.
*
* @return \Illuminate\Mail\Transport\MailgunTransport
*/
protected function createMailgunDriver()
{
$config = $this->app['config']->get('services.mailgun', []);
$client = new HttpClient(Arr::get($config, 'guzzle', []));
return new MailgunTransport($client, $config['secret'], $config['domain']);
}
/**
* Create an instance of the Mandrill Swift Transport driver.
*
* @return \Illuminate\Mail\Transport\MandrillTransport
*/
protected function createMandrillDriver()
{
$config = $this->app['config']->get('services.mandrill', []);
$client = new HttpClient(Arr::get($config, 'guzzle', []));
return new MandrillTransport($client, $config['secret']);
}
/**
* Create an instance of the Log Swift Transport driver.
*
* @return \Illuminate\Mail\Transport\LogTransport
*/
protected function createLogDriver()
{
return new LogTransport($this->app->make('Psr\Log\LoggerInterface'));
}
/**
* Get the default cache driver name.
*
* @return string
*/
public function getDefaultDriver()
{
return $this->app['config']['mail.driver'];
}
/**
* Set the default cache driver name.
*
* @param string $name
* @return void
*/
public function setDefaultDriver($name)
{
$this->app['config']['mail.driver'] = $name;
}
}

39
vendor/illuminate/mail/composer.json vendored Executable file
View File

@ -0,0 +1,39 @@
{
"name": "illuminate/mail",
"description": "The Illuminate Mail package.",
"license": "MIT",
"homepage": "http://laravel.com",
"support": {
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
}
],
"require": {
"php": ">=5.5.9",
"illuminate/container": "5.1.*",
"illuminate/contracts": "5.1.*",
"illuminate/support": "5.1.*",
"psr/log": "~1.0",
"swiftmailer/swiftmailer": "~5.1"
},
"autoload": {
"psr-4": {
"Illuminate\\Mail\\": ""
}
},
"extra": {
"branch-alias": {
"dev-master": "5.1-dev"
}
},
"suggest": {
"aws/aws-sdk-php": "Required to use the SES mail driver (~3.0).",
"guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (~5.3|~6.0)."
},
"minimum-stability": "dev"
}

View File

@ -0,0 +1,16 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.yml]
indent_style = space
indent_size = 2

View File

@ -0,0 +1,27 @@
# Change Log
## [Unreleased]
### Added
### Changed
### Fixed
## [1.1.0] - 2015-01-26
### Added
- Support for non-hourly offset timezones
- Checks for valid expressions
### Changed
- Max Iterations no longer hardcoded for `getRunDate()`
- Supports DateTimeImmutable for newer PHP verions
### Fixed
- Fixed looping bug for PHP 7 when determining the last specified weekday of a month
## [1.0.3] - 2013-11-23
### Added
- Now supports expressions with any number of extra spaces, tabs, or newlines
### Changed
- Using static instead of self in `CronExpression::factory`
### Fixed
- Fixes issue [#28](https://github.com/mtdowling/cron-expression/issues/28) where PHP increments of ranges were failing due to PHP casting hyphens to 0
- Only set default timezone if the given $currentTime is not a DateTime instance ([#34](https://github.com/mtdowling/cron-expression/issues/34))

7
vendor/myclabs/deep-copy/.gitattributes vendored Executable file
View File

@ -0,0 +1,7 @@
# Auto detect text files and perform LF normalization
* text=auto
*.png binary
tests/ export-ignore
phpunit.xml.dist export-ignore

6
vendor/myclabs/deep-copy/.gitignore vendored Executable file
View File

@ -0,0 +1,6 @@
.DS_Store
.idea/*
vendor/*
composer.phar
composer.lock

24
vendor/myclabs/deep-copy/.travis.yml vendored Executable file
View File

@ -0,0 +1,24 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- hhvm
matrix:
allow_failures:
- php: hhvm
install:
- composer install
- composer require satooshi/php-coveralls:dev-master --dev --no-progress
before_script:
- mkdir -p build/logs
script:
- phpunit --coverage-clover build/logs/clover.xml
after_script:
- php vendor/bin/coveralls -v

20
vendor/myclabs/deep-copy/LICENSE vendored Normal file
View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2013 My C-Sense
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

209
vendor/myclabs/deep-copy/README.md vendored Normal file
View File

@ -0,0 +1,209 @@
# DeepCopy
DeepCopy helps you create deep copies (clones) of your objects. It is designed to handle cycles in the association graph.
[![Build Status](https://travis-ci.org/myclabs/DeepCopy.png?branch=master)](https://travis-ci.org/myclabs/DeepCopy) [![Coverage Status](https://coveralls.io/repos/myclabs/DeepCopy/badge.png?branch=master)](https://coveralls.io/r/myclabs/DeepCopy?branch=master) [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/myclabs/DeepCopy/badges/quality-score.png?s=2747100c19b275f93a777e3297c6c12d1b68b934)](https://scrutinizer-ci.com/g/myclabs/DeepCopy/)
[![Total Downloads](https://poser.pugx.org/myclabs/deep-copy/downloads.svg)](https://packagist.org/packages/myclabs/deep-copy)
## How?
Install with Composer:
```json
composer require myclabs/deep-copy
```
Use simply:
```php
use DeepCopy\DeepCopy;
$deepCopy = new DeepCopy();
$myCopy = $deepCopy->copy($myObject);
```
## Why?
- How do you create copies of your objects?
```php
$myCopy = clone $myObject;
```
- How do you create **deep** copies of your objects (i.e. copying also all the objects referenced in the properties)?
You use [`__clone()`](http://www.php.net/manual/en/language.oop5.cloning.php#object.clone) and implement the behavior yourself.
- But how do you handle **cycles** in the association graph?
Now you're in for a big mess :(
![association graph](doc/graph.png)
### Using simply `clone`
![Using clone](doc/clone.png)
### Overridding `__clone()`
![Overridding __clone](doc/deep-clone.png)
### With DeepCopy
![With DeepCopy](doc/deep-copy.png)
## How it works
DeepCopy traverses recursively all your object's properties and clones them.
To avoid cloning the same object twice (and thus, keep you object graph), it keeps a hash-map of all instances.
## Going further
You can add filters to customize the copy process.
The method to add a filter is `$deepCopy->addFilter($filter, $matcher)`,
with `$filter` implementing `DeepCopy\Filter\Filter`
and `$matcher` implementing `DeepCopy\Matcher\Matcher`.
We provide some generic filters and matchers.
### Matchers
#### Property name
The `PropertyNameMatcher` will match a property by its name:
```php
use DeepCopy\Matcher\PropertyNameMatcher;
$matcher = new PropertyNameMatcher('id');
// will apply a filter to any property of any objects named "id"
```
#### Specific property
The `PropertyMatcher` will match a specific property of a specific class:
```php
use DeepCopy\Matcher\PropertyMatcher;
$matcher = new PropertyMatcher('MyClass', 'id');
// will apply a filter to the property "id" of any objects of the class "MyClass"
```
#### Property type
The `PropertyTypeMatcher` will match a property by its type (instance of a class):
```php
use DeepCopy\Matcher\PropertyTypeMatcher;
$matcher = new PropertyTypeMatcher('Doctrine\Common\Collections\Collection');
// will apply a filter to any property that is an instance of Doctrine\Common\Collections\Collection
```
### Filters
#### `SetNullFilter`
Let's say for example that you are copying a database record (or a Doctrine entity), so you want the copy not to have any ID:
```php
use DeepCopy\DeepCopy;
use DeepCopy\Filter\SetNullFilter;
use DeepCopy\Matcher\PropertyNameMatcher;
$myObject = MyClass::load(123);
echo $myObject->id; // 123
$deepCopy = new DeepCopy();
$deepCopy->addFilter(new SetNullFilter(), new PropertyNameMatcher('id'));
$myCopy = $deepCopy->copy($myObject);
echo $myCopy->id; // null
```
#### `KeepFilter`
If you want a property to remain untouched (for example, an association to an object):
```php
use DeepCopy\DeepCopy;
use DeepCopy\Filter\KeepFilter;
use DeepCopy\Matcher\PropertyMatcher;
$deepCopy = new DeepCopy();
$deepCopy->addFilter(new KeepFilter(), new PropertyMatcher('MyClass', 'category'));
$myCopy = $deepCopy->copy($myObject);
// $myCopy->category has not been touched
```
#### `ReplaceFilter`
If you want to replace the value of a property:
```php
use DeepCopy\DeepCopy;
use DeepCopy\Filter\ReplaceFilter;
use DeepCopy\Matcher\PropertyMatcher;
$deepCopy = new DeepCopy();
$callback = function ($currentValue) {
return $currentValue . ' (copy)'
};
$deepCopy->addFilter(new ReplaceFilter($callback), new PropertyMatcher('MyClass', 'title'));
$myCopy = $deepCopy->copy($myObject);
// $myCopy->title will contain the data returned by the callback, e.g. 'The title (copy)'
```
The `$callback` parameter of the `ReplaceFilter` constructor accepts any PHP callable.
#### `DoctrineCollectionFilter`
If you use Doctrine and want to copy an entity, you will need to use the `DoctrineCollectionFilter`:
```php
use DeepCopy\DeepCopy;
use DeepCopy\Filter\Doctrine\DoctrineCollectionFilter;
use DeepCopy\Matcher\PropertyTypeMatcher;
$deepCopy = new DeepCopy();
$deepCopy->addFilter(new DoctrineCollectionFilter(), new PropertyTypeMatcher('Doctrine\Common\Collections\Collection'));
$myCopy = $deepCopy->copy($myObject);
```
#### `DoctrineEmptyCollectionFilter`
If you use Doctrine and want to copy an entity who contains a `Collection` that you want to be reset, you can use the `DoctrineEmptyCollectionFilter`
```php
use DeepCopy\DeepCopy;
use DeepCopy\Filter\Doctrine\DoctrineEmptyCollectionFilter;
use DeepCopy\Matcher\PropertyMatcher;
$deepCopy = new DeepCopy();
$deepCopy->addFilter(new DoctrineEmptyCollectionFilter(), new PropertyMatcher('MyClass', 'myProperty'));
$myCopy = $deepCopy->copy($myObject);
// $myCopy->myProperty will return an empty collection
```
## Contributing
DeepCopy is distributed under the MIT license.
### Tests
Running the tests is simple:
```php
phpunit
```

21
vendor/myclabs/deep-copy/composer.json vendored Normal file
View File

@ -0,0 +1,21 @@
{
"name": "myclabs/deep-copy",
"type": "library",
"description": "Create deep copies (clones) of your objects",
"keywords": ["clone", "copy", "duplicate", "object", "object graph"],
"homepage": "https://github.com/myclabs/DeepCopy",
"license": "MIT",
"autoload": {
"psr-4": { "DeepCopy\\": "src/DeepCopy/" }
},
"autoload-dev": {
"psr-4": { "DeepCopyTest\\": "tests/DeepCopyTest/" }
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"doctrine/collections": "1.*",
"phpunit/phpunit": "~4.1"
}
}

BIN
vendor/myclabs/deep-copy/doc/clone.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
vendor/myclabs/deep-copy/doc/graph.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -0,0 +1,223 @@
<?php
namespace DeepCopy;
use DeepCopy\Exception\CloneException;
use DeepCopy\Filter\Filter;
use DeepCopy\Matcher\Matcher;
use DeepCopy\TypeFilter\TypeFilter;
use DeepCopy\TypeMatcher\TypeMatcher;
use ReflectionProperty;
use DeepCopy\Reflection\ReflectionHelper;
/**
* DeepCopy
*/
class DeepCopy
{
/**
* @var array
*/
private $hashMap = [];
/**
* Filters to apply.
* @var array
*/
private $filters = [];
/**
* Type Filters to apply.
* @var array
*/
private $typeFilters = [];
private $skipUncloneable = false;
/**
* Cloning uncloneable properties won't throw exception.
* @param $skipUncloneable
* @return $this
*/
public function skipUncloneable($skipUncloneable = true)
{
$this->skipUncloneable = $skipUncloneable;
return $this;
}
/**
* Perform a deep copy of the object.
* @param mixed $object
* @return mixed
*/
public function copy($object)
{
$this->hashMap = [];
return $this->recursiveCopy($object);
}
public function addFilter(Filter $filter, Matcher $matcher)
{
$this->filters[] = [
'matcher' => $matcher,
'filter' => $filter,
];
}
public function addTypeFilter(TypeFilter $filter, TypeMatcher $matcher)
{
$this->typeFilters[] = [
'matcher' => $matcher,
'filter' => $filter,
];
}
private function recursiveCopy($var)
{
// Matches Type Filter
if ($filter = $this->getFirstMatchedTypeFilter($this->typeFilters, $var)) {
return $filter->apply($var);
}
// Resource
if (is_resource($var)) {
return $var;
}
// Array
if (is_array($var)) {
return $this->copyArray($var);
}
// Scalar
if (! is_object($var)) {
return $var;
}
// Object
return $this->copyObject($var);
}
/**
* Copy an array
* @param array $array
* @return array
*/
private function copyArray(array $array)
{
$copier = function($item) {
return $this->recursiveCopy($item);
};
return array_map($copier, $array);
}
/**
* Copy an object
* @param object $object
* @return object
*/
private function copyObject($object)
{
$objectHash = spl_object_hash($object);
if (isset($this->hashMap[$objectHash])) {
return $this->hashMap[$objectHash];
}
$reflectedObject = new \ReflectionObject($object);
if (false === $isCloneable = $reflectedObject->isCloneable() and $this->skipUncloneable) {
$this->hashMap[$objectHash] = $object;
return $object;
}
if (false === $isCloneable) {
throw new CloneException(sprintf(
'Class "%s" is not cloneable.',
$object->getName()
));
}
$newObject = clone $object;
$this->hashMap[$objectHash] = $newObject;
foreach (ReflectionHelper::getProperties($reflectedObject) as $property) {
$this->copyObjectProperty($newObject, $property);
}
return $newObject;
}
private function copyObjectProperty($object, ReflectionProperty $property)
{
// Ignore static properties
if ($property->isStatic()) {
return;
}
// Apply the filters
foreach ($this->filters as $item) {
/** @var Matcher $matcher */
$matcher = $item['matcher'];
/** @var Filter $filter */
$filter = $item['filter'];
if ($matcher->matches($object, $property->getName())) {
$filter->apply(
$object,
$property->getName(),
function ($object) {
return $this->recursiveCopy($object);
}
);
// If a filter matches, we stop processing this property
return;
}
}
$property->setAccessible(true);
$propertyValue = $property->getValue($object);
// Copy the property
$property->setValue($object, $this->recursiveCopy($propertyValue));
}
/**
* Returns first filter that matches variable, NULL if no such filter found.
* @param array $filterRecords Associative array with 2 members: 'filter' with value of type {@see TypeFilter} and
* 'matcher' with value of type {@see TypeMatcher}
* @param mixed $var
* @return TypeFilter|null
*/
private function getFirstMatchedTypeFilter(array $filterRecords, $var)
{
$matched = $this->first(
$filterRecords,
function (array $record) use ($var) {
/* @var TypeMatcher $matcher */
$matcher = $record['matcher'];
return $matcher->matches($var);
}
);
return isset($matched) ? $matched['filter'] : null;
}
/**
* Returns first element that matches predicate, NULL if no such element found.
* @param array $elements
* @param callable $predicate Predicate arguments are: element.
* @return mixed|null
*/
private function first(array $elements, callable $predicate)
{
foreach ($elements as $element) {
if (call_user_func($predicate, $element)) {
return $element;
}
}
return null;
}
}

View File

@ -0,0 +1,6 @@
<?php
namespace DeepCopy\Exception;
class CloneException extends \UnexpectedValueException
{
}

View File

@ -0,0 +1,31 @@
<?php
namespace DeepCopy\Filter\Doctrine;
use DeepCopy\Filter\Filter;
use ReflectionProperty;
/**
* Set a null value for a property
*/
class DoctrineCollectionFilter implements Filter
{
/**
* {@inheritdoc}
*/
public function apply($object, $property, $objectCopier)
{
$reflectionProperty = new ReflectionProperty($object, $property);
$reflectionProperty->setAccessible(true);
$oldCollection = $reflectionProperty->getValue($object);
$newCollection = $oldCollection->map(
function ($item) use ($objectCopier) {
return $objectCopier($item);
}
);
$reflectionProperty->setValue($object, $newCollection);
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace DeepCopy\Filter\Doctrine;
use DeepCopy\Filter\Filter;
use Doctrine\Common\Collections\ArrayCollection;
class DoctrineEmptyCollectionFilter implements Filter
{
/**
* Apply the filter to the object.
*
* @param object $object
* @param string $property
* @param callable $objectCopier
*/
public function apply($object, $property, $objectCopier)
{
$reflectionProperty = new \ReflectionProperty($object, $property);
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($object, new ArrayCollection());
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace DeepCopy\Filter;
/**
* Filter to apply to a property while copying an object
*/
interface Filter
{
/**
* Apply the filter to the object.
* @param object $object
* @param string $property
* @param callable $objectCopier
*/
public function apply($object, $property, $objectCopier);
}

View File

@ -0,0 +1,17 @@
<?php
namespace DeepCopy\Filter;
/**
* Keep the value of a property
*/
class KeepFilter implements Filter
{
/**
* {@inheritdoc}
*/
public function apply($object, $property, $objectCopier)
{
// Nothing to do
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace DeepCopy\Filter;
/**
* Replace the value of a property
*/
class ReplaceFilter implements Filter
{
/**
* @var callable
*/
protected $callback;
/**
* @param callable $callable Will be called to get the new value for each property to replace
*/
public function __construct(callable $callable)
{
$this->callback = $callable;
}
/**
* {@inheritdoc}
*/
public function apply($object, $property, $objectCopier)
{
$reflectionProperty = new \ReflectionProperty($object, $property);
$reflectionProperty->setAccessible(true);
$value = call_user_func($this->callback, $reflectionProperty->getValue($object));
$reflectionProperty->setValue($object, $value);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace DeepCopy\Filter;
use ReflectionProperty;
/**
* Set a null value for a property
*/
class SetNullFilter implements Filter
{
/**
* {@inheritdoc}
*/
public function apply($object, $property, $objectCopier)
{
$reflectionProperty = new ReflectionProperty($object, $property);
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($object, null);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace DeepCopy\Matcher;
/**
* Matcher interface
*/
interface Matcher
{
/**
* @param object $object
* @param string $property
* @return boolean
*/
public function matches($object, $property);
}

View File

@ -0,0 +1,37 @@
<?php
namespace DeepCopy\Matcher;
/**
* Match a specific property of a specific class
*/
class PropertyMatcher implements Matcher
{
/**
* @var string
*/
private $class;
/**
* @var string
*/
private $property;
/**
* @param string $class Class name
* @param string $property Property name
*/
public function __construct($class, $property)
{
$this->class = $class;
$this->property = $property;
}
/**
* {@inheritdoc}
*/
public function matches($object, $property)
{
return ($object instanceof $this->class) && ($property == $this->property);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace DeepCopy\Matcher;
/**
* Match a property by its name
*/
class PropertyNameMatcher implements Matcher
{
/**
* @var string
*/
private $property;
/**
* @param string $property Property name
*/
public function __construct($property)
{
$this->property = $property;
}
/**
* {@inheritdoc}
*/
public function matches($object, $property)
{
return $property == $this->property;
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace DeepCopy\Matcher;
use ReflectionProperty;
/**
* Match a property by its type
*
* @deprecated It is recommended to use {@see DeepCopy\TypeFilter\TypeFilter} instead, as it applies on all occurrences
* of given type in copied context (eg. array elements), not just on object properties.
*/
class PropertyTypeMatcher implements Matcher
{
/**
* @var string
*/
private $propertyType;
/**
* @param string $propertyType Property type
*/
public function __construct($propertyType)
{
$this->propertyType = $propertyType;
}
/**
* {@inheritdoc}
*/
public function matches($object, $property)
{
$reflectionProperty = new ReflectionProperty($object, $property);
$reflectionProperty->setAccessible(true);
return $reflectionProperty->getValue($object) instanceof $this->propertyType;
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace DeepCopy\Reflection;
class ReflectionHelper
{
/**
* Retrieves all properties (including private ones), from object and all its ancestors.
*
* Standard \ReflectionClass->getProperties() does not return private properties from ancestor classes.
*
* @author muratyaman@gmail.com
* @see http://php.net/manual/en/reflectionclass.getproperties.php
*
* @param \ReflectionClass $ref
* @return \ReflectionProperty[]
*/
public static function getProperties(\ReflectionClass $ref)
{
$props = $ref->getProperties();
$propsArr = array();
foreach ($props as $prop) {
$f = $prop->getName();
$propsArr[$f] = $prop;
}
if ($parentClass = $ref->getParentClass()) {
$parentPropsArr = self::getProperties($parentClass);
if (count($parentPropsArr) > 0) {
$propsArr = array_merge($parentPropsArr, $propsArr);
}
}
return $propsArr;
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace DeepCopy\TypeFilter;
class ReplaceFilter implements TypeFilter
{
/**
* @var callable
*/
protected $callback;
/**
* @param callable $callable Will be called to get the new value for each element to replace
*/
public function __construct(callable $callable)
{
$this->callback = $callable;
}
/**
* {@inheritdoc}
*/
public function apply($element)
{
return call_user_func($this->callback, $element);
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace DeepCopy\TypeFilter;
class ShallowCopyFilter implements TypeFilter
{
/**
* {@inheritdoc}
*/
public function apply($element)
{
return clone $element;
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace DeepCopy\TypeFilter;
interface TypeFilter
{
/**
* Apply the filter to the object.
* @param mixed $element
*/
public function apply($element);
}

View File

@ -0,0 +1,31 @@
<?php
namespace DeepCopy\TypeMatcher;
/**
* TypeMatcher class
*/
class TypeMatcher
{
/**
* @var string
*/
private $type;
/**
* @param string $type
*/
public function __construct($type)
{
$this->type = $type;
}
/**
* @param $element
* @return boolean
*/
public function matches($element)
{
return is_object($element) ? is_a($element, $this->type) : gettype($element) === $this->type;
}
}

View File

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*/
return array(
'year' => '1 jaar|:count jare',
'month' => '1 maand|:count maande',
'week' => '1 week|:count weke',
'day' => '1 dag|:count dae',
'hour' => '1 uur|:count ure',
'minute' => '1 minuut|:count minute',
'second' => '1 sekond|:count sekondes',
'ago' => ':time terug',
'from_now' => ':time van nou af',
'after' => ':time na',
'before' => ':time voor',
);

View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/
return array(
'year' => '1 aasta|:count aastat',
'month' => '1 kuu|:count kuud',
'week' => '1 nädal|:count nädalat',
'day' => '1 päev|:count päeva',
'hour' => '1 tund|:count tundi',
'minute' => '1 minut|:count minutit',
'second' => '1 sekund|:count sekundit',
'ago' => ':time tagasi',
'from_now' => ':time pärast',
'after' => ':time pärast',
'before' => ':time enne',
'year_from_now' => ':count aasta',
'month_from_now' => ':count kuu',
'week_from_now' => ':count nädala',
'day_from_now' => ':count päeva',
'hour_from_now' => ':count tunni',
'minute_from_now' => ':count minuti',
'second_from_now' => ':count sekundi',
);

View File

@ -0,0 +1,28 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*/
return array(
'year' => '1 vit|:count vjet',
'month' => '1 muaj|:count muaj',
'week' => '1 javë|:count javë',
'day' => '1 ditë|:count ditë',
'hour' => '1 orë|:count orë',
'minute' => '1 minutë|:count minuta',
'second' => '1 sekondë|:count sekonda',
'ago' => ':time më parë',
'from_now' => ':time nga tani',
'after' => ':time pas',
'before' => ':time para',
);

View File

@ -0,0 +1,209 @@
### Version 1.2.0 - 2015-02-05
* Whitespace and other cosmetic changes
* Added a changelog.
* We now ship with a command line utility to build a PHP Archive from the
command line.
Every time we publish a new release, we will also upload a .phar
to Github. Our public key is signed by our GPG key.
### Version 1.1.6 - 2015-01-29
* Eliminate `open_basedir` warnings by detecting this configuration setting.
(Thanks [@oucil](https://github.com/oucil) for reporting this.)
* Added install instructions to the README.
* Documentation cleanup (there is, in fact, no `MCRYPT_CREATE_IV` constant, I
meant to write `MCRYPT_DEV_URANDOM`)
### Version 1.1.5 - 2016-01-06
Prevent fatal errors on platforms with older versions of libsodium.
### Version 1.1.4 - 2015-12-10
Thanks [@narfbg](https://github.com/narfbg) for [critiquing the previous patch](https://github.com/paragonie/random_compat/issues/79#issuecomment-163590589)
and suggesting a fix.
### Version 1.1.3 - 2015-12-09
The test for COM in disabled_classes is now case-insensitive.
### Version 1.1.2 - 2015-12-09
Don't instantiate COM if it's a disabled class. Removes the E_WARNING on Windows.
### Version 1.1.1 - 2015-11-30
Fix a performance issue with `/dev/urandom` buffering.
### Version 1.1.0 - 2015-11-09
Fix performance issues with ancient versions of PHP on Windows, but dropped
support for PHP < 5.4.1 without mcrypt on Windows 7+ in the process. Since this
is a BC break, semver dictates a minor version bump.
### Version 1.0.10 - 2015-10-23
* Avoid a performance killer with OpenSSL on Windows PHP 5.3.0 - 5.3.3 that was
affecting [WordPress users](https://core.trac.wordpress.org/ticket/34409).
* Use `$var = null` instead of `unset($var)` to avoid triggering the garbage
collector and slowing things down.
### Version 1.0.9 - 2015-10-20
There is an outstanding issue `mcrypt_create_iv()` and PHP 7's `random_bytes()`
on Windows reported by [@nicolas-grekas](https://github.com/nicolas-grekas) caused by `proc_open()` and environment
variable handling (discovered by Appveyor when developing Symfony).
Since the break is consistent, it's not our responsibility to fix it, but we
should fail the same way PHP 7 will (i.e. throw an `Exception` rather than raise
an error and then throw an `Exception`).
### Version 1.0.8 - 2015-10-18
* Fix usability issues with Windows (`new COM('CAPICOM.Utilities.1')` is not
always available).
* You can now test all the possible drivers by running `phpunit.sh each` in the
`tests` directory.
### Version 1.0.7 - 2015-10-16
Several large integer handling bugfixes were contributed by [@oittaa](https://github.com/oittaa).
### Version 1.0.6 - 2015-10-15
Don't let the version number fool you, this was a pretty significant change.
1. Added support for ext-libsodium, if it exists on the system. This is morally
equivalent to adding `getrandom(2)` support without having to expose the
syscall interface in PHP-land.
2. Relaxed open_basedir restrictions. In previous versions, if open_basedir was
set, PHP wouldn't even try to read from `/dev/urandom`. Now it will still do
so if you can.
3. Fixed integer casting inconsistencies between random_compat and PHP 7.
4. Handle edge cases where an integer overflow turns one of the parameters into
a float.
One change that we discussed was making `random_bytes()` and `random_int()`
strict typed; meaning you could *only* pass integers to either function. While
most veteran programmers are probably only doing this already (we strongly
encourage it), it wouldn't be consistent with how these functions behave in PHP
7. Please use these functions responsibly.
We've had even more of the PHP community involved in this release; the
contributors list has been updated. If I forgot anybody, I promise you it's not
because your contributions (either code or ideas) aren't valued, it's because
I'm a bit overloaded with information at the moment. Please let me know
immediately and I will correct my oversight.
Thanks everyone for helping make random_compat better.
### Version 1.0.5 - 2015-10-08
Got rid of the methods in the `Throwable` interface, which was causing problems
on PHP 5.2. While we would normally not care about 5.2 (since [5.4 and earlier are EOL'd](https://secure.php.net/supported-versions.php)),
we do want to encourage widespread adoption (e.g. [Wordpress](https://core.trac.wordpress.org/ticket/28633)).
### Version 1.0.4 - 2015-10-02
Removed redundant `if()` checks, since `lib/random.php` is the entrypoint people
should use.
### Version 1.0.3 - 2015-10-02
This release contains bug fixes contributed by the community.
* Avoid a PHP Notice when PHP is running without the mbstring extension
* Use a compatible version of PHPUnit for testing on older versions of PHP
Although none of these bugs were outright security-affecting, updating ASAP is
still strongly encouraged.
### Version 1.0.2 - 2015-09-23
Less strict input validation on `random_int()` parameters. PHP 7's `random_int()`
accepts strings and floats that look like numbers, so we should too.
Thanks [@dd32](https://github.com/@dd32) for correcting this oversight.
### Version 1.0.1 - 2015-09-10
Instead of throwing an Exception immediately on insecure platforms, only do so
when `random_bytes()` is invoked.
### Version 1.0.0 - 2015-09-07
Our API is now stable and forward-compatible with the CSPRNG features in PHP 7
(as of 7.0.0 RC3).
A lot of great people have contributed their time and expertise to make this
compatibility library possible. That this library has reached a stable release
is more a reflection on the community than it is on PIE.
We are confident that random_compat will serve as the simplest and most secure
CSPRNG interface available for PHP5 projects.
### Version 0.9.7 (pre-release) - 2015-09-01
An attempt to achieve compatibility with Error/TypeError in the RFC.
This should be identical to 1.0.0 sans any last-minute changes or performance enhancements.
### Version 0.9.6 (pre-release) - 2015-08-06
* Split the implementations into their own file (for ease of auditing)
* Corrected the file type check after `/dev/urandom` has been opened (thanks
[@narfbg](https://github.com/narfbg) and [@jedisct1](https://github.com/jedisct1))
### Version 0.9.5 (pre-release) - 2015-07-31
* Validate that `/dev/urandom` is a character device
* Reported by [@lokdnet](https://twitter.com/lokdnet)
* Investigated by [@narfbg](https://github.com/narfbg) and [frymaster](http://stackoverflow.com/users/1226810/frymaster) on [StackOverflow](http://stackoverflow.com/q/31631066/2224584)
* Remove support for `/dev/arandom` which is an old OpenBSD feature, thanks [@jedisct1](https://github.com/jedisct1)
* Prevent race conditions on the `filetype()` check, thanks [@jedisct1](https://github.com/jedisct1)
* Buffer file reads to 8 bytes (performance optimization; PHP defaults to 8192 bytes)
### Version 0.9.4 (pre-release) - 2015-07-27
* Add logic to verify that `/dev/arandom` and `/dev/urandom` are actually devices.
* Some clean-up in the comments
### Version 0.9.3 (pre-release) - 2015-07-22
Unless the Exceptions change to PHP 7 fails, this should be the last pre-release
version. If need be, we'll make one more pre-release version with compatible
behavior.
Changes since 0.9.2:
* Prioritize `/dev/arandom` and `/dev/urandom` over mcrypt.
[@oittaa](https://github.com/oittaa) removed the -1 and +1 juggling on `$range` calculations for `random_int()`
* Whitespace and comment clean-up, plus better variable names
* Actually put a description in the composer.json file...
### Version 0.9.2 (pre-release) - 2015-07-16
* Consolidated `$range > PHP_INT_MAX` logic with `$range <= PHP_INT_MAX` (thanks
[@oittaa](https://github.com/oittaa) and [@CodesInChaos](https://github.com/CodesInChaos))
* `tests/phpunit.sh` now also runs the tests with `mbstring.func_overload` and
`open_basedir`
* Style consistency, whitespace cleanup, more meaningful variable names
### Version 0.9.1 (pre-release) - 2015-07-09
* Return random values on integer ranges > `PHP_INT_MAX` (thanks [@CodesInChaos](https://github.com/CodesInChaos))
* Determined CSPRNG preference:
1. `mcrypt_create_iv()` with `MCRYPT_DEV_URANDOM`
2. `/dev/arandom`
3. `/dev/urandom`
4. `openssl_random_pseudo_bytes()`
* Optimized backend selection (thanks [@lt](https://github.com/lt))
* Fix #3 (thanks [@scottchiefbaker](https://github.com/scottchiefbaker))
### Version 0.9.0 (pre-release) - 2015-07-07
This should be a sane polyfill for PHP 7's `random_bytes()` and `random_int()`.
We hesitate to call it production ready until it has received sufficient third
party review.

View File

@ -0,0 +1,5 @@
-----BEGIN PUBLIC KEY-----
MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEEd+wCqJDrx5B4OldM0dQE0ZMX+lx1ZWm
pui0SUqD4G29L3NGsz9UhJ/0HjBdbnkhIK5xviT0X5vtjacF6ajgcCArbTB+ds+p
+h7Q084NuSuIpNb6YPfoUFgC/CL9kAoc
-----END PUBLIC KEY-----

View File

@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)
iQEcBAABAgAGBQJWtW1hAAoJEGuXocKCZATaJf0H+wbZGgskK1dcRTsuVJl9IWip
QwGw/qIKI280SD6/ckoUMxKDCJiFuPR14zmqnS36k7N5UNPnpdTJTS8T11jttSpg
1LCmgpbEIpgaTah+cELDqFCav99fS+bEiAL5lWDAHBTE/XPjGVCqeehyPYref4IW
NDBIEsvnHPHPLsn6X5jq4+Yj5oUixgxaMPiR+bcO4Sh+RzOVB6i2D0upWfRXBFXA
NNnsg9/zjvoC7ZW73y9uSH+dPJTt/Vgfeiv52/v41XliyzbUyLalf02GNPY+9goV
JHG1ulEEBJOCiUD9cE1PUIJwHA/HqyhHIvV350YoEFiHl8iSwm7SiZu5kPjaq74=
=B6+8
-----END PGP SIGNATURE-----

View File

@ -0,0 +1,86 @@
<?php
/**
* Random_* Compatibility Library
* for using the new PHP 7 random_* API in PHP 5 projects
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Paragon Initiative Enterprises
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* If the libsodium PHP extension is loaded, we'll use it above any other
* solution.
*
* libsodium-php project:
* @ref https://github.com/jedisct1/libsodium-php
*
* @param int $bytes
*
* @throws Exception
*
* @return string
*/
function random_bytes($bytes)
{
try {
$bytes = RandomCompat_intval($bytes);
} catch (TypeError $ex) {
throw new TypeError(
'random_bytes(): $bytes must be an integer'
);
}
if ($bytes < 1) {
throw new Error(
'Length must be greater than 0'
);
}
/**
* \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be
* generated in one invocation.
*/
if ($bytes > 2147483647) {
$buf = '';
for ($i = 0; $i < $bytes; $i += 1073741824) {
$n = ($bytes - $i) > 1073741824
? 1073741824
: $bytes - $i;
$buf .= Sodium::randombytes_buf($n);
}
} else {
$buf = Sodium::randombytes_buf($bytes);
}
if ($buf !== false) {
if (RandomCompat_strlen($buf) === $bytes) {
return $buf;
}
}
/**
* If we reach here, PHP has failed us.
*/
throw new Exception(
'Could not gather sufficient random data'
);
}

View File

@ -0,0 +1,57 @@
<?php
$dist = dirname(__DIR__).'/dist';
if (!is_dir($dist)) {
mkdir($dist, 0755);
}
if (file_exists($dist.'/random_compat.phar')) {
unlink($dist.'/random_compat.phar');
}
$phar = new Phar(
$dist.'/random_compat.phar',
FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::KEY_AS_FILENAME,
'random_compat.phar'
);
rename(
dirname(__DIR__).'/lib/random.php',
dirname(__DIR__).'/lib/index.php'
);
$phar->buildFromDirectory(dirname(__DIR__).'/lib');
rename(
dirname(__DIR__).'/lib/index.php',
dirname(__DIR__).'/lib/random.php'
);
/**
* If we pass an (optional) path to a private key as a second argument, we will
* sign the Phar with OpenSSL.
*
* If you leave this out, it will produce an unsigned .phar!
*/
if ($argc > 1) {
if (!@is_readable($argv[1])) {
echo 'Could not read the private key file:', $argv[1], "\n";
exit(255);
}
$pkeyFile = file_get_contents($argv[1]);
$private = openssl_get_privatekey($pkeyFile);
if ($private !== false) {
$pkey = '';
openssl_pkey_export($private, $pkey);
$phar->setSignatureAlgorithm(Phar::OPENSSL, $pkey);
/**
* Save the corresponding public key to the file
*/
if (!@is_readable($dist.'/random_compat.phar.pubkey')) {
$details = openssl_pkey_get_details($private);
file_put_contents(
$dist.'/random_compat.phar.pubkey',
$details['key']
);
}
} else {
echo 'An error occurred reading the private key from OpenSSL.', "\n";
exit(255);
}
}

View File

@ -0,0 +1,43 @@
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->files()
->in('src')
->in('tests')
->name('*.php');
return Symfony\CS\Config\Config::create()
->level(\Symfony\CS\FixerInterface::NONE_LEVEL)
->fixers(
array(
'duplicate_semicolon',
'empty_return',
'extra_empty_lines',
'join_function',
'list_commas',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'phpdoc_indent',
'phpdoc_no_access',
'phpdoc_no_empty_return',
'phpdoc_no_package',
'phpdoc_params',
'phpdoc_scalar',
'phpdoc_to_comment',
'phpdoc_trim',
'return',
'self_accessor',
'single_quote',
'spaces_before_semicolon',
'spaces_cast',
'ternary_spaces',
'trim_array_spaces',
'unused_use',
'whitespacy_lines',
'align_double_arrow',
'align_equals',
'concat_with_spaces',
'short_array_syntax'
)
)
->finder($finder);

View File

@ -0,0 +1,31 @@
# Changes in PHP_CodeCoverage 3.0
All notable changes of the PHP_CodeCoverage 3.0 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [3.0.2] - 2015-11-12
### Changed
* It is now optional that `@deprecated` code is ignored
## [3.0.1] - 2015-10-06
### Fixed
* Fixed [#391](https://github.com/sebastianbergmann/php-code-coverage/pull/391): Missing `</abbr>` tag
## [3.0.0] - 2015-10-02
### Changed
* It is now mandatory to configure a whitelist
### Removed
* The blacklist functionality has been removed
* PHP_CodeCoverage is no longer supported on PHP 5.3, PHP 5.4, and PHP 5.5
[3.0.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.0.1...3.0.2
[3.0.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.0.0...3.0.1
[3.0.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2...3.0.0

View File

@ -0,0 +1,30 @@
# Changes in PHP_CodeCoverage 3.1
All notable changes of the PHP_CodeCoverage 3.1 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [3.1.1] - 2016-02-04
### Changed
* Allow version 2.0.x of `sebastian/version` dependency
## [3.1.0] - 2016-01-11
### Added
* Implemented [#234](https://github.com/sebastianbergmann/php-code-coverage/issues/234): Optionally raise an exception when a specified unit of code is not executed
### Changed
* The Clover XML report now contains cyclomatic complexity information
* The Clover XML report now contains method visibility information
* Cleanup and refactoring of various areas of code
* Added missing test cases
### Removed
* The functionality controlled by the `mapTestClassNameToCoveredClassName` setting has been removed
[3.1.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.1.0...3.1.1
[3.1.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.0...3.1.0

View File

@ -0,0 +1,16 @@
# Changes in PHP_CodeCoverage 3.2
All notable changes of the PHP_CodeCoverage 3.2 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [3.2.0] - 2016-02-13
### Added
* Added optional check for missing `@covers` annotation when the usage of `@covers` annotations is forced
### Changed
* Improved `PHP_CodeCoverage_UnintentionallyCoveredCodeException` message
[3.2.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/3.1...3.2.0

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the PHP_CodeCoverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Exception that is raised when covered code is not executed.
*
* @since Class available since Release 3.1.0
*/
class PHP_CodeCoverage_CoveredCodeNotExecutedException extends PHP_CodeCoverage_RuntimeException
{
}

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the PHP_CodeCoverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Exception interface for PHP_CodeCoverage component.
*
* @since Interface available since Release 3.0.0
*/
interface PHP_CodeCoverage_Exception
{
}

View File

@ -0,0 +1,37 @@
<?php
/*
* This file is part of the PHP_CodeCoverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @since Class available since Release 3.0.0
*/
class PHP_CodeCoverage_InvalidArgumentException extends InvalidArgumentException implements PHP_CodeCoverage_Exception
{
/**
* @param int $argument
* @param string $type
* @param mixed $value
* @return PHP_CodeCoverage_InvalidArgumentException
*/
public static function create($argument, $type, $value = null)
{
$stack = debug_backtrace(0);
return new self(
sprintf(
'Argument #%d%sof %s::%s() must be a %s',
$argument,
$value !== null ? ' (' . gettype($value) . '#' . $value . ')' : ' (No Value) ',
$stack[1]['class'],
$stack[1]['function'],
$type
)
);
}
}

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the PHP_CodeCoverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Exception that is raised when @covers must be used but is not.
*
* @since Class available since Release 3.2.0
*/
class PHP_CodeCoverage_MissingCoversAnnotationException extends PHP_CodeCoverage_RuntimeException
{
}

View File

@ -0,0 +1,16 @@
<?php
/*
* This file is part of the PHP_CodeCoverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* @since Class available since Release 3.0.0
*/
class PHP_CodeCoverage_RuntimeException extends RuntimeException implements PHP_CodeCoverage_Exception
{
}

View File

@ -0,0 +1,54 @@
<?php
/*
* This file is part of the PHP_CodeCoverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Exception that is raised when code is unintentionally covered.
*
* @since Class available since Release 2.0.0
*/
class PHP_CodeCoverage_UnintentionallyCoveredCodeException extends PHP_CodeCoverage_RuntimeException
{
/**
* @var array
*/
private $unintentionallyCoveredUnits = [];
/**
* @param array $unintentionallyCoveredUnits
*/
public function __construct(array $unintentionallyCoveredUnits)
{
$this->unintentionallyCoveredUnits = $unintentionallyCoveredUnits;
parent::__construct($this->toString());
}
/**
* @return array
*/
public function getUnintentionallyCoveredUnits()
{
return $this->unintentionallyCoveredUnits;
}
/**
* @return string
*/
private function toString()
{
$message = '';
foreach ($this->unintentionallyCoveredUnits as $unit) {
$message .= '- ' . $unit . "\n";
}
return $message;
}
}

View File

@ -0,0 +1,58 @@
<?php
/*
* This file is part of the PHP_CodeCoverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestCase.php';
/**
* Tests for the PHP_CodeCoverage_Report_Crap4j class.
*
* @since Class available since Release 3.1.0
*/
class PHP_CodeCoverage_Report_Crap4jTest extends PHP_CodeCoverage_TestCase
{
/**
* @covers PHP_CodeCoverage_Report_Crap4j
*/
public function testForBankAccountTest()
{
$crap4j = new PHP_CodeCoverage_Report_Crap4j;
$this->assertStringMatchesFormatFile(
TEST_FILES_PATH . 'BankAccount-crap4j.xml',
$crap4j->process($this->getCoverageForBankAccount(), null, 'BankAccount')
);
}
/**
* @covers PHP_CodeCoverage_Report_Crap4j
*/
public function testForFileWithIgnoredLines()
{
$crap4j = new PHP_CodeCoverage_Report_Crap4j;
$this->assertStringMatchesFormatFile(
TEST_FILES_PATH . 'ignored-lines-crap4j.xml',
$crap4j->process($this->getCoverageForFileWithIgnoredLines(), null, 'CoverageForFileWithIgnoredLines')
);
}
/**
* @covers PHP_CodeCoverage_Report_Crap4j
*/
public function testForClassWithAnonymousFunction()
{
$crap4j = new PHP_CodeCoverage_Report_Crap4j;
$this->assertStringMatchesFormatFile(
TEST_FILES_PATH . 'class-with-anonymous-function-crap4j.xml',
$crap4j->process($this->getCoverageForClassWithAnonymousFunction(), null, 'CoverageForClassWithAnonymousFunction')
);
}
}

View File

@ -0,0 +1,112 @@
<?php
/*
* This file is part of the PHP_CodeCoverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestCase.php';
/**
* Tests for the PHP_CodeCoverage_Report_HTML class.
*
* @since Class available since Release 3.1.0
*/
class PHP_CodeCoverage_Report_HTMLTest extends PHP_CodeCoverage_TestCase
{
static private $TEST_REPORT_PATH_SOURCE;
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
self::$TEST_REPORT_PATH_SOURCE = TEST_FILES_PATH . 'Report' . DIRECTORY_SEPARATOR . 'HTML';
}
protected function tearDown()
{
parent::tearDown();
$tmpFilesIterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator(self::$TEST_TMP_PATH, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($tmpFilesIterator as $path => $fileInfo) {
/* @var SplFileInfo $fileInfo */
$pathname = $fileInfo->getPathname();
$fileInfo->isDir() ? rmdir($pathname) : unlink($pathname);
}
}
/**
* @covers PHP_CodeCoverage_Report_HTML
*/
public function testForBankAccountTest()
{
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForBankAccount';
$report = new PHP_CodeCoverage_Report_HTML;
$report->process($this->getCoverageForBankAccount(), self::$TEST_TMP_PATH);
$this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH);
}
/**
* @covers PHP_CodeCoverage_Report_HTML
*/
public function testForFileWithIgnoredLines()
{
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForFileWithIgnoredLines';
$report = new PHP_CodeCoverage_Report_HTML;
$report->process($this->getCoverageForFileWithIgnoredLines(), self::$TEST_TMP_PATH);
$this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH);
}
/**
* @covers PHP_CodeCoverage_Report_HTML
*/
public function testForClassWithAnonymousFunction()
{
$expectedFilesPath =
self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForClassWithAnonymousFunction';
$report = new PHP_CodeCoverage_Report_HTML;
$report->process($this->getCoverageForClassWithAnonymousFunction(), self::$TEST_TMP_PATH);
$this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH);
}
/**
* @param string $expectedFilesPath
* @param string $actualFilesPath
*/
protected function assertFilesEquals($expectedFilesPath, $actualFilesPath)
{
$expectedFilesIterator = new FilesystemIterator($expectedFilesPath);
$actualFilesIterator = new RegexIterator(new FilesystemIterator($actualFilesPath), '/.html/');
$this->assertEquals(
iterator_count($expectedFilesIterator),
iterator_count($actualFilesIterator),
'Generated files and expected files not match'
);
foreach ($expectedFilesIterator as $path => $fileInfo) {
/* @var SplFileInfo $fileInfo */
$filename = $fileInfo->getFilename();
$actualFile = $actualFilesPath . DIRECTORY_SEPARATOR . $filename;
$this->assertFileExists($actualFile);
$this->assertStringMatchesFormatFile(
$fileInfo->getPathname(),
str_replace(PHP_EOL, "\n", file_get_contents($actualFile)),
"${filename} not match"
);
}
}
}

View File

@ -0,0 +1,58 @@
<?php
/*
* This file is part of the PHP_CodeCoverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestCase.php';
/**
* Tests for the PHP_CodeCoverage_Report_Text class.
*
* @since Class available since Release 3.1.0
*/
class PHP_CodeCoverage_Report_TextTest extends PHP_CodeCoverage_TestCase
{
/**
* @covers PHP_CodeCoverage_Report_Text
*/
public function testTextForBankAccountTest()
{
$text = new PHP_CodeCoverage_Report_Text(50, 90, false, false);
$this->assertStringMatchesFormatFile(
TEST_FILES_PATH . 'BankAccount-text.txt',
str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForBankAccount()))
);
}
/**
* @covers PHP_CodeCoverage_Report_Text
*/
public function testTextForFileWithIgnoredLines()
{
$text = new PHP_CodeCoverage_Report_Text(50, 90, false, false);
$this->assertStringMatchesFormatFile(
TEST_FILES_PATH . 'ignored-lines-text.txt',
str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForFileWithIgnoredLines()))
);
}
/**
* @covers PHP_CodeCoverage_Report_Text
*/
public function testTextForClassWithAnonymousFunction()
{
$text = new PHP_CodeCoverage_Report_Text(50, 90, false, false);
$this->assertStringMatchesFormatFile(
TEST_FILES_PATH . 'class-with-anonymous-function-text.txt',
str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForClassWithAnonymousFunction()))
);
}
}

View File

@ -0,0 +1,108 @@
<?php
/*
* This file is part of the PHP_CodeCoverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'TestCase.php';
/**
* Tests for the PHP_CodeCoverage_Report_XML class.
*
* @since Class available since Release 3.1.0
*/
class PHP_CodeCoverage_Report_XMLTest extends PHP_CodeCoverage_TestCase
{
static private $TEST_REPORT_PATH_SOURCE;
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
self::$TEST_REPORT_PATH_SOURCE = TEST_FILES_PATH . 'Report' . DIRECTORY_SEPARATOR . 'XML';
}
protected function tearDown()
{
parent::tearDown();
$tmpFilesIterator = new FilesystemIterator(self::$TEST_TMP_PATH);
foreach ($tmpFilesIterator as $path => $fileInfo) {
/* @var SplFileInfo $fileInfo */
unlink($fileInfo->getPathname());
}
}
/**
* @covers PHP_CodeCoverage_Report_XML
*/
public function testForBankAccountTest()
{
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForBankAccount';
$xml = new PHP_CodeCoverage_Report_XML;
$xml->process($this->getCoverageForBankAccount(), self::$TEST_TMP_PATH);
$this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH);
}
/**
* @covers PHP_CodeCoverage_Report_XML
*/
public function testForFileWithIgnoredLines()
{
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForFileWithIgnoredLines';
$xml = new PHP_CodeCoverage_Report_XML;
$xml->process($this->getCoverageForFileWithIgnoredLines(), self::$TEST_TMP_PATH);
$this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH);
}
/**
* @covers PHP_CodeCoverage_Report_XML
*/
public function testForClassWithAnonymousFunction()
{
$expectedFilesPath =
self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForClassWithAnonymousFunction';
$xml = new PHP_CodeCoverage_Report_XML;
$xml->process($this->getCoverageForClassWithAnonymousFunction(), self::$TEST_TMP_PATH);
$this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH);
}
/**
* @param string $expectedFilesPath
* @param string $actualFilesPath
*/
protected function assertFilesEquals($expectedFilesPath, $actualFilesPath)
{
$expectedFilesIterator = new FilesystemIterator($expectedFilesPath);
$actualFilesIterator = new FilesystemIterator($actualFilesPath);
$this->assertEquals(
iterator_count($expectedFilesIterator),
iterator_count($actualFilesIterator),
'Generated files and expected files not match'
);
foreach ($expectedFilesIterator as $path => $fileInfo) {
/* @var SplFileInfo $fileInfo */
$filename = $fileInfo->getFilename();
$actualFile = $actualFilesPath . DIRECTORY_SEPARATOR . $filename;
$this->assertFileExists($actualFile);
$this->assertStringMatchesFormatFile(
$fileInfo->getPathname(),
file_get_contents($actualFile),
"${filename} not match"
);
}
}
}

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<crap_result>
<project>BankAccount</project>
<timestamp>%s</timestamp>
<stats>
<name>Method Crap Stats</name>
<methodCount>4</methodCount>
<crapMethodCount>0</crapMethodCount>
<crapLoad>0</crapLoad>
<totalCrap>9</totalCrap>
<crapMethodPercent>0</crapMethodPercent>
</stats>
<methods>
<method>
<package>global</package>
<className>BankAccount</className>
<methodName>getBalance</methodName>
<methodSignature>getBalance()</methodSignature>
<fullMethod>getBalance()</fullMethod>
<crap>1</crap>
<complexity>1</complexity>
<coverage>100</coverage>
<crapLoad>0</crapLoad>
</method>
<method>
<package>global</package>
<className>BankAccount</className>
<methodName>setBalance</methodName>
<methodSignature>setBalance($balance)</methodSignature>
<fullMethod>setBalance($balance)</fullMethod>
<crap>6</crap>
<complexity>2</complexity>
<coverage>0</coverage>
<crapLoad>0</crapLoad>
</method>
<method>
<package>global</package>
<className>BankAccount</className>
<methodName>depositMoney</methodName>
<methodSignature>depositMoney($balance)</methodSignature>
<fullMethod>depositMoney($balance)</fullMethod>
<crap>1</crap>
<complexity>1</complexity>
<coverage>100</coverage>
<crapLoad>0</crapLoad>
</method>
<method>
<package>global</package>
<className>BankAccount</className>
<methodName>withdrawMoney</methodName>
<methodSignature>withdrawMoney($balance)</methodSignature>
<fullMethod>withdrawMoney($balance)</fullMethod>
<crap>1</crap>
<complexity>1</complexity>
<coverage>100</coverage>
<crapLoad>0</crapLoad>
</method>
</methods>
</crap_result>

View File

@ -0,0 +1,12 @@
Code Coverage Report:
%s
Summary:
Classes: 0.00% (0/1)
Methods: 75.00% (3/4)
Lines: 50.00% (5/10)
BankAccount
Methods: 75.00% ( 3/ 4) Lines: 50.00% ( 5/ 10)

View File

@ -0,0 +1,267 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Code Coverage for %s/BankAccount.php</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<div class="container">
<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li><a href="index.html">%s</a></li>
<li class="active">BankAccount.php</li>
</ol>
</div>
</div>
</div>
</header>
<div class="container">
<table class="table table-bordered">
<thead>
<tr>
<td>&nbsp;</td>
<td colspan="10"><div align="center"><strong>Code Coverage</strong></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
<td colspan="4"><div align="center"><strong>Functions and Methods</strong></div></td>
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
</tr>
</thead>
<tbody>
<tr>
<td class="danger">Total</td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
<span class="sr-only">0.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
<td class="warning big"> <div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="75.00" aria-valuemin="0" aria-valuemax="100" style="width: 75.00%">
<span class="sr-only">75.00% covered (warning)</span>
</div>
</div>
</td>
<td class="warning small"><div align="right">75.00%</div></td>
<td class="warning small"><div align="right">3&nbsp;/&nbsp;4</div></td>
<td class="warning small"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">50.00%</div></td>
<td class="danger small"><div align="right">5&nbsp;/&nbsp;10</div></td>
</tr>
<tr>
<td class="danger">BankAccount</td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
<span class="sr-only">0.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
<td class="warning big"> <div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="75.00" aria-valuemin="0" aria-valuemax="100" style="width: 75.00%">
<span class="sr-only">75.00% covered (warning)</span>
</div>
</div>
</td>
<td class="warning small"><div align="right">75.00%</div></td>
<td class="warning small"><div align="right">3&nbsp;/&nbsp;4</div></td>
<td class="warning small">8.12</td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">50.00%</div></td>
<td class="danger small"><div align="right">5&nbsp;/&nbsp;10</div></td>
</tr>
<tr>
<td class="success" colspan="4">&nbsp;<a href="#6"><abbr title="getBalance()">getBalance</abbr></a></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
<td class="success small">1</td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
</tr>
<tr>
<td class="danger" colspan="4">&nbsp;<a href="#11"><abbr title="setBalance($balance)">setBalance</abbr></a></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
<span class="sr-only">0.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
<td class="danger small">6</td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
<span class="sr-only">0.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0&nbsp;/&nbsp;5</div></td>
</tr>
<tr>
<td class="success" colspan="4">&nbsp;<a href="#20"><abbr title="depositMoney($balance)">depositMoney</abbr></a></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
<td class="success small">1</td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">2&nbsp;/&nbsp;2</div></td>
</tr>
<tr>
<td class="success" colspan="4">&nbsp;<a href="#27"><abbr title="withdrawMoney($balance)">withdrawMoney</abbr></a></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
<td class="success small">1</td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">2&nbsp;/&nbsp;2</div></td>
</tr>
</tbody>
</table>
<table id="code" class="table table-borderless table-condensed">
<tbody>
<tr><td><div align="right"><a name="1"></a><a href="#1">1</a></div></td><td class="codeLine"><span class="default">&lt;?php</span></td></tr>
<tr><td><div align="right"><a name="2"></a><a href="#2">2</a></div></td><td class="codeLine"><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">BankAccount</span></td></tr>
<tr><td><div align="right"><a name="3"></a><a href="#3">3</a></div></td><td class="codeLine"><span class="keyword">{</span></td></tr>
<tr><td><div align="right"><a name="4"></a><a href="#4">4</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">protected</span><span class="default">&nbsp;</span><span class="default">$balance</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">0</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="5"></a><a href="#5">5</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="6"></a><a href="#6">6</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span></td></tr>
<tr><td><div align="right"><a name="7"></a><a href="#7">7</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="2 tests cover line 8" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;BankAccountTest::testBalanceIsInitiallyZero&lt;/li&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="8"></a><a href="#8">8</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">balance</span><span class="keyword">;</span></td></tr>
<tr class="warning"><td><div align="right"><a name="9"></a><a href="#9">9</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="10"></a><a href="#10">10</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="11"></a><a href="#11">11</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">protected</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">setBalance</span><span class="keyword">(</span><span class="default">$balance</span><span class="keyword">)</span></td></tr>
<tr><td><div align="right"><a name="12"></a><a href="#12">12</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="danger"><td><div align="right"><a name="13"></a><a href="#13">13</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">if</span><span class="default">&nbsp;</span><span class="keyword">(</span><span class="default">$balance</span><span class="default">&nbsp;</span><span class="default">&gt;=</span><span class="default">&nbsp;</span><span class="default">0</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="danger"><td><div align="right"><a name="14"></a><a href="#14">14</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">balance</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">$balance</span><span class="keyword">;</span></td></tr>
<tr class="danger"><td><div align="right"><a name="15"></a><a href="#15">15</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><span class="default">&nbsp;</span><span class="keyword">else</span><span class="default">&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="danger"><td><div align="right"><a name="16"></a><a href="#16">16</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">throw</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">RuntimeException</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="17"></a><a href="#17">17</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr class="danger"><td><div align="right"><a name="18"></a><a href="#18">18</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="19"></a><a href="#19">19</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="20"></a><a href="#20">20</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">depositMoney</span><span class="keyword">(</span><span class="default">$balance</span><span class="keyword">)</span></td></tr>
<tr><td><div align="right"><a name="21"></a><a href="#21">21</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="2 tests cover line 22" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;BankAccountTest::testBalanceCannotBecomeNegative2&lt;/li&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="22"></a><a href="#22">22</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">setBalance</span><span class="keyword">(</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">+</span><span class="default">&nbsp;</span><span class="default">$balance</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="23"></a><a href="#23">23</a></div></td><td class="codeLine"></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 24" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="24"></a><a href="#24">24</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr class="warning"><td><div align="right"><a name="25"></a><a href="#25">25</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="26"></a><a href="#26">26</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="27"></a><a href="#27">27</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">withdrawMoney</span><span class="keyword">(</span><span class="default">$balance</span><span class="keyword">)</span></td></tr>
<tr><td><div align="right"><a name="28"></a><a href="#28">28</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="2 tests cover line 29" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;BankAccountTest::testBalanceCannotBecomeNegative&lt;/li&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="29"></a><a href="#29">29</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">setBalance</span><span class="keyword">(</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">-</span><span class="default">&nbsp;</span><span class="default">$balance</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="30"></a><a href="#30">30</a></div></td><td class="codeLine"></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 31" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="31"></a><a href="#31">31</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr class="warning"><td><div align="right"><a name="32"></a><a href="#32">32</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="33"></a><a href="#33">33</a></div></td><td class="codeLine"><span class="keyword">}</span></td></tr>
</tbody>
</table>
<footer>
<hr/>
<h4>Legend</h4>
<p>
<span class="success"><strong>Executed</strong></span>
<span class="danger"><strong>Not Executed</strong></span>
<span class="warning"><strong>Dead Code</strong></span>
</p>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage %s</a> using <a href="http://php.net/" target="_top">%s</a> at %s.</small>
</p>
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
var $window = $(window)
, $top_link = $('#toplink')
, $body = $('body, html')
, offset = $('#code').offset().top;
$top_link.hide().click(function(event) {
event.preventDefault();
$body.animate({scrollTop:0}, 800);
});
$window.scroll(function() {
if($window.scrollTop() > offset) {
$top_link.fadeIn();
} else {
$top_link.fadeOut();
}
}).scroll();
$('.popin').popover({trigger: 'hover'});
});
</script>
</body>
</html>

View File

@ -0,0 +1,290 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dashboard for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/nv.d3.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<div class="container">
<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li><a href="index.html">%s</a></li>
<li class="active">(Dashboard)</li>
</ol>
</div>
</div>
</div>
</header>
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>Classes</h2>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Coverage Distribution</h3>
<div id="classCoverageDistribution" style="height: 300px;">
<svg></svg>
</div>
</div>
<div class="col-md-6">
<h3>Complexity</h3>
<div id="classComplexity" style="height: 300px;">
<svg></svg>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Insufficient Coverage</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Class</th>
<th class="text-right">Coverage</th>
</tr>
</thead>
<tbody>
<tr><td><a href="BankAccount.php.html#2">BankAccount</a></td><td class="text-right">50%</td></tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h3>Project Risks</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Class</th>
<th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th>
</tr>
</thead>
<tbody>
<tr><td><a href="BankAccount.php.html#2">BankAccount</a></td><td class="text-right">8</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h2>Methods</h2>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Coverage Distribution</h3>
<div id="methodCoverageDistribution" style="height: 300px;">
<svg></svg>
</div>
</div>
<div class="col-md-6">
<h3>Complexity</h3>
<div id="methodComplexity" style="height: 300px;">
<svg></svg>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Insufficient Coverage</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Method</th>
<th class="text-right">Coverage</th>
</tr>
</thead>
<tbody>
<tr><td><a href="BankAccount.php.html#11"><abbr title="BankAccount::setBalance">setBalance</abbr></a></td><td class="text-right">0%</td></tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h3>Project Risks</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Method</th>
<th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th>
</tr>
</thead>
<tbody>
<tr><td><a href="BankAccount.php.html#11"><abbr title="BankAccount::setBalance">setBalance</abbr></a></td><td class="text-right">6</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<footer>
<hr/>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage %s</a> using <a href="http://php.net/" target="_top">%s</a> at %s.</small>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script src="js/d3.min.js" type="text/javascript"></script>
<script src="js/nv.d3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
nv.addGraph(function() {
var chart = nv.models.multiBarChart();
chart.tooltips(false)
.showControls(false)
.showLegend(false)
.reduceXTicks(false)
.staggerLabels(true)
.yAxis.tickFormat(d3.format('d'));
d3.select('#classCoverageDistribution svg')
.datum(getCoverageDistributionData([0,0,0,0,0,0,1,0,0,0,0,0], "Class Coverage"))
.transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
nv.addGraph(function() {
var chart = nv.models.multiBarChart();
chart.tooltips(false)
.showControls(false)
.showLegend(false)
.reduceXTicks(false)
.staggerLabels(true)
.yAxis.tickFormat(d3.format('d'));
d3.select('#methodCoverageDistribution svg')
.datum(getCoverageDistributionData([1,0,0,0,0,0,0,0,0,0,0,3], "Method Coverage"))
.transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
function getCoverageDistributionData(data, label) {
var labels = [
'0%',
'0-10%',
'10-20%',
'20-30%',
'30-40%',
'40-50%',
'50-60%',
'60-70%',
'70-80%',
'80-90%',
'90-100%',
'100%'
];
var values = [];
$.each(labels, function(key) {
values.push({x: labels[key], y: data[key]});
});
return [
{
key: label,
values: values,
color: "#4572A7"
}
];
}
nv.addGraph(function() {
var chart = nv.models.scatterChart()
.showDistX(true)
.showDistY(true)
.showLegend(false)
.forceX([0, 100]);
chart.tooltipContent(function(key, y, e, graph) {
return '<p>' + graph.point.class + '</p>';
});
chart.xAxis.axisLabel('Code Coverage (in percent)');
chart.yAxis.axisLabel('Cyclomatic Complexity');
d3.select('#classComplexity svg')
.datum(getComplexityData([[50,5,"<a href=\"BankAccount.php.html#2\">BankAccount<\/a>"]], 'Class Complexity'))
.transition()
.duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
nv.addGraph(function() {
var chart = nv.models.scatterChart()
.showDistX(true)
.showDistY(true)
.showLegend(false)
.forceX([0, 100]);
chart.tooltipContent(function(key, y, e, graph) {
return '<p>' + graph.point.class + '</p>';
});
chart.xAxis.axisLabel('Code Coverage (in percent)');
chart.yAxis.axisLabel('Method Complexity');
d3.select('#methodComplexity svg')
.datum(getComplexityData([[100,1,"<a href=\"BankAccount.php.html#6\">BankAccount::getBalance<\/a>"],[0,2,"<a href=\"BankAccount.php.html#11\">BankAccount::setBalance<\/a>"],[100,1,"<a href=\"BankAccount.php.html#20\">BankAccount::depositMoney<\/a>"],[100,1,"<a href=\"BankAccount.php.html#27\">BankAccount::withdrawMoney<\/a>"]], 'Method Complexity'))
.transition()
.duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
function getComplexityData(data, label) {
var values = [];
$.each(data, function(key) {
var value = Math.round(data[key][0]*100) / 100;
values.push({
x: value,
y: data[key][1],
class: data[key][2],
size: 0.05,
shape: 'diamond'
});
});
return [
{
key: label,
values: values,
color: "#4572A7"
}
];
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,119 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Code Coverage for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<div class="container">
<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li class="active">%s</li>
<li>(<a href="dashboard.html">Dashboard</a>)</li>
</ol>
</div>
</div>
</div>
</header>
<div class="container">
<table class="table table-bordered">
<thead>
<tr>
<td>&nbsp;</td>
<td colspan="9"><div align="center"><strong>Code Coverage</strong></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
<td colspan="3"><div align="center"><strong>Functions and Methods</strong></div></td>
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
</tr>
</thead>
<tbody>
<tr>
<td class="danger">Total</td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">50.00%</div></td>
<td class="danger small"><div align="right">5&nbsp;/&nbsp;10</div></td>
<td class="warning big"> <div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="75.00" aria-valuemin="0" aria-valuemax="100" style="width: 75.00%">
<span class="sr-only">75.00% covered (warning)</span>
</div>
</div>
</td>
<td class="warning small"><div align="right">75.00%</div></td>
<td class="warning small"><div align="right">3&nbsp;/&nbsp;4</div></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
<span class="sr-only">0.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
</tr>
<tr>
<td class="danger"><span class="glyphicon glyphicon-file"></span> <a href="BankAccount.php.html">BankAccount.php</a></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">50.00%</div></td>
<td class="danger small"><div align="right">5&nbsp;/&nbsp;10</div></td>
<td class="warning big"> <div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="75.00" aria-valuemin="0" aria-valuemax="100" style="width: 75.00%">
<span class="sr-only">75.00% covered (warning)</span>
</div>
</div>
</td>
<td class="warning small"><div align="right">75.00%</div></td>
<td class="warning small"><div align="right">3&nbsp;/&nbsp;4</div></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
<span class="sr-only">0.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
</tr>
</tbody>
</table>
<footer>
<hr/>
<h4>Legend</h4>
<p>
<span class="danger"><strong>Low</strong>: 0% to 50%</span>
<span class="warning"><strong>Medium</strong>: 50% to 90%</span>
<span class="success"><strong>High</strong>: 90% to 100%</span>
</p>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage %s</a> using <a href="http://php.net/" target="_top">%s</a> at %s.</small>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
</body>
</html>

View File

@ -0,0 +1,288 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dashboard for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/nv.d3.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<div class="container">
<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li><a href="index.html">%s</a></li>
<li class="active">(Dashboard)</li>
</ol>
</div>
</div>
</div>
</header>
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>Classes</h2>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Coverage Distribution</h3>
<div id="classCoverageDistribution" style="height: 300px;">
<svg></svg>
</div>
</div>
<div class="col-md-6">
<h3>Complexity</h3>
<div id="classComplexity" style="height: 300px;">
<svg></svg>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Insufficient Coverage</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Class</th>
<th class="text-right">Coverage</th>
</tr>
</thead>
<tbody>
<tr><td><a href="source_with_class_and_anonymous_function.php.html#3">CoveredClassWithAnonymousFunctionInStaticMethod</a></td><td class="text-right">87%</td></tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h3>Project Risks</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Class</th>
<th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h2>Methods</h2>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Coverage Distribution</h3>
<div id="methodCoverageDistribution" style="height: 300px;">
<svg></svg>
</div>
</div>
<div class="col-md-6">
<h3>Complexity</h3>
<div id="methodComplexity" style="height: 300px;">
<svg></svg>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Insufficient Coverage</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Method</th>
<th class="text-right">Coverage</th>
</tr>
</thead>
<tbody>
<tr><td><a href="source_with_class_and_anonymous_function.php.html#5"><abbr title="CoveredClassWithAnonymousFunctionInStaticMethod::runAnonymous">runAnonymous</abbr></a></td><td class="text-right">66%</td></tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h3>Project Risks</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Method</th>
<th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<footer>
<hr/>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage %s</a> using <a href="http://php.net/" target="_top">%s</a> at %s.</small>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script src="js/d3.min.js" type="text/javascript"></script>
<script src="js/nv.d3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
nv.addGraph(function() {
var chart = nv.models.multiBarChart();
chart.tooltips(false)
.showControls(false)
.showLegend(false)
.reduceXTicks(false)
.staggerLabels(true)
.yAxis.tickFormat(d3.format('d'));
d3.select('#classCoverageDistribution svg')
.datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,1,0,0], "Class Coverage"))
.transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
nv.addGraph(function() {
var chart = nv.models.multiBarChart();
chart.tooltips(false)
.showControls(false)
.showLegend(false)
.reduceXTicks(false)
.staggerLabels(true)
.yAxis.tickFormat(d3.format('d'));
d3.select('#methodCoverageDistribution svg')
.datum(getCoverageDistributionData([0,0,0,0,0,0,0,1,0,0,0,1], "Method Coverage"))
.transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
function getCoverageDistributionData(data, label) {
var labels = [
'0%',
'0-10%',
'10-20%',
'20-30%',
'30-40%',
'40-50%',
'50-60%',
'60-70%',
'70-80%',
'80-90%',
'90-100%',
'100%'
];
var values = [];
$.each(labels, function(key) {
values.push({x: labels[key], y: data[key]});
});
return [
{
key: label,
values: values,
color: "#4572A7"
}
];
}
nv.addGraph(function() {
var chart = nv.models.scatterChart()
.showDistX(true)
.showDistY(true)
.showLegend(false)
.forceX([0, 100]);
chart.tooltipContent(function(key, y, e, graph) {
return '<p>' + graph.point.class + '</p>';
});
chart.xAxis.axisLabel('Code Coverage (in percent)');
chart.yAxis.axisLabel('Cyclomatic Complexity');
d3.select('#classComplexity svg')
.datum(getComplexityData([[87.5,2,"<a href=\"source_with_class_and_anonymous_function.php.html#3\">CoveredClassWithAnonymousFunctionInStaticMethod<\/a>"]], 'Class Complexity'))
.transition()
.duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
nv.addGraph(function() {
var chart = nv.models.scatterChart()
.showDistX(true)
.showDistY(true)
.showLegend(false)
.forceX([0, 100]);
chart.tooltipContent(function(key, y, e, graph) {
return '<p>' + graph.point.class + '</p>';
});
chart.xAxis.axisLabel('Code Coverage (in percent)');
chart.yAxis.axisLabel('Method Complexity');
d3.select('#methodComplexity svg')
.datum(getComplexityData([[66.666666666667,1,"<a href=\"source_with_class_and_anonymous_function.php.html#5\">CoveredClassWithAnonymousFunctionInStaticMethod::runAnonymous<\/a>"],[100,1,"<a href=\"source_with_class_and_anonymous_function.php.html#11\">CoveredClassWithAnonymousFunctionInStaticMethod::anonymous function<\/a>"]], 'Method Complexity'))
.transition()
.duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
function getComplexityData(data, label) {
var values = [];
$.each(data, function(key) {
var value = Math.round(data[key][0]*100) / 100;
values.push({
x: value,
y: data[key][1],
class: data[key][2],
size: 0.05,
shape: 'diamond'
});
});
return [
{
key: label,
values: values,
color: "#4572A7"
}
];
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,119 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Code Coverage for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<div class="container">
<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li class="active">%s</li>
<li>(<a href="dashboard.html">Dashboard</a>)</li>
</ol>
</div>
</div>
</div>
</header>
<div class="container">
<table class="table table-bordered">
<thead>
<tr>
<td>&nbsp;</td>
<td colspan="9"><div align="center"><strong>Code Coverage</strong></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
<td colspan="3"><div align="center"><strong>Functions and Methods</strong></div></td>
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
</tr>
</thead>
<tbody>
<tr>
<td class="warning">Total</td>
<td class="warning big"> <div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="87.50" aria-valuemin="0" aria-valuemax="100" style="width: 87.50%">
<span class="sr-only">87.50% covered (warning)</span>
</div>
</div>
</td>
<td class="warning small"><div align="right">87.50%</div></td>
<td class="warning small"><div align="right">7&nbsp;/&nbsp;8</div></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">50.00%</div></td>
<td class="danger small"><div align="right">1&nbsp;/&nbsp;2</div></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
<span class="sr-only">0.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
</tr>
<tr>
<td class="warning"><span class="glyphicon glyphicon-file"></span> <a href="source_with_class_and_anonymous_function.php.html">source_with_class_and_anonymous_function.php</a></td>
<td class="warning big"> <div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="87.50" aria-valuemin="0" aria-valuemax="100" style="width: 87.50%">
<span class="sr-only">87.50% covered (warning)</span>
</div>
</div>
</td>
<td class="warning small"><div align="right">87.50%</div></td>
<td class="warning small"><div align="right">7&nbsp;/&nbsp;8</div></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">50.00%</div></td>
<td class="danger small"><div align="right">1&nbsp;/&nbsp;2</div></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
<span class="sr-only">0.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
</tr>
</tbody>
</table>
<footer>
<hr/>
<h4>Legend</h4>
<p>
<span class="danger"><strong>Low</strong>: 0% to 50%</span>
<span class="warning"><strong>Medium</strong>: 50% to 90%</span>
<span class="success"><strong>High</strong>: 90% to 100%</span>
</p>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage %s</a> using <a href="http://php.net/" target="_top">%s</a> at %s.</small>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
</body>
</html>

View File

@ -0,0 +1,211 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Code Coverage for %s/source_with_class_and_anonymous_function.php</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<div class="container">
<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li><a href="index.html">%s</a></li>
<li class="active">source_with_class_and_anonymous_function.php</li>
</ol>
</div>
</div>
</div>
</header>
<div class="container">
<table class="table table-bordered">
<thead>
<tr>
<td>&nbsp;</td>
<td colspan="10"><div align="center"><strong>Code Coverage</strong></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
<td colspan="4"><div align="center"><strong>Functions and Methods</strong></div></td>
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
</tr>
</thead>
<tbody>
<tr>
<td class="danger">Total</td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
<span class="sr-only">0.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">50.00%</div></td>
<td class="danger small"><div align="right">1&nbsp;/&nbsp;2</div></td>
<td class="danger small"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></td>
<td class="warning big"> <div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="87.50" aria-valuemin="0" aria-valuemax="100" style="width: 87.50%">
<span class="sr-only">87.50% covered (warning)</span>
</div>
</div>
</td>
<td class="warning small"><div align="right">87.50%</div></td>
<td class="warning small"><div align="right">7&nbsp;/&nbsp;8</div></td>
</tr>
<tr>
<td class="danger">CoveredClassWithAnonymousFunctionInStaticMethod</td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
<span class="sr-only">0.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">50.00%</div></td>
<td class="danger small"><div align="right">1&nbsp;/&nbsp;2</div></td>
<td class="danger small">2.01</td>
<td class="warning big"> <div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="87.50" aria-valuemin="0" aria-valuemax="100" style="width: 87.50%">
<span class="sr-only">87.50% covered (warning)</span>
</div>
</div>
</td>
<td class="warning small"><div align="right">87.50%</div></td>
<td class="warning small"><div align="right">7&nbsp;/&nbsp;8</div></td>
</tr>
<tr>
<td class="danger" colspan="4">&nbsp;<a href="#5"><abbr title="runAnonymous()">runAnonymous</abbr></a></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
<span class="sr-only">0.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
<td class="danger small">1.04</td>
<td class="warning big"> <div class="progress">
<div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="66.67" aria-valuemin="0" aria-valuemax="100" style="width: 66.67%">
<span class="sr-only">66.67% covered (warning)</span>
</div>
</div>
</td>
<td class="warning small"><div align="right">66.67%</div></td>
<td class="warning small"><div align="right">2&nbsp;/&nbsp;3</div></td>
</tr>
<tr>
<td class="success" colspan="4">&nbsp;<a href="#11"><abbr title="anonymous function (&amp;$val, $key)">anonymous function</abbr></a></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
<td class="success small">1</td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">2&nbsp;/&nbsp;2</div></td>
</tr>
</tbody>
</table>
<table id="code" class="table table-borderless table-condensed">
<tbody>
<tr><td><div align="right"><a name="1"></a><a href="#1">1</a></div></td><td class="codeLine"><span class="default">&lt;?php</span></td></tr>
<tr><td><div align="right"><a name="2"></a><a href="#2">2</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="3"></a><a href="#3">3</a></div></td><td class="codeLine"><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">CoveredClassWithAnonymousFunctionInStaticMethod</span></td></tr>
<tr><td><div align="right"><a name="4"></a><a href="#4">4</a></div></td><td class="codeLine"><span class="keyword">{</span></td></tr>
<tr><td><div align="right"><a name="5"></a><a href="#5">5</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">static</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">runAnonymous</span><span class="keyword">(</span><span class="keyword">)</span></td></tr>
<tr><td><div align="right"><a name="6"></a><a href="#6">6</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 7" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="7"></a><a href="#7">7</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$filter</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">[</span><span class="default">'abc124'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">'abc123'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">'123'</span><span class="keyword">]</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="8"></a><a href="#8">8</a></div></td><td class="codeLine"></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 9" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="9"></a><a href="#9">9</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">array_walk</span><span class="keyword">(</span></td></tr>
<tr class="danger"><td><div align="right"><a name="10"></a><a href="#10">10</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$filter</span><span class="keyword">,</span></td></tr>
<tr><td><div align="right"><a name="11"></a><a href="#11">11</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="keyword">(</span><span class="keyword">&amp;</span><span class="default">$val</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$key</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 12" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="12"></a><a href="#12">12</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$val</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">preg_replace</span><span class="keyword">(</span><span class="default">'|[^0-9]|'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">''</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$val</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 13" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="13"></a><a href="#13">13</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 14" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="14"></a><a href="#14">14</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="15"></a><a href="#15">15</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="16"></a><a href="#16">16</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">//&nbsp;Should&nbsp;be&nbsp;covered</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 17" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="17"></a><a href="#17">17</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$extravar</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">true</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 18" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="18"></a><a href="#18">18</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="19"></a><a href="#19">19</a></div></td><td class="codeLine"><span class="keyword">}</span></td></tr>
</tbody>
</table>
<footer>
<hr/>
<h4>Legend</h4>
<p>
<span class="success"><strong>Executed</strong></span>
<span class="danger"><strong>Not Executed</strong></span>
<span class="warning"><strong>Dead Code</strong></span>
</p>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage %s</a> using <a href="http://php.net/" target="_top">%s</a> at %s.</small>
</p>
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
var $window = $(window)
, $top_link = $('#toplink')
, $body = $('body, html')
, offset = $('#code').offset().top;
$top_link.hide().click(function(event) {
event.preventDefault();
$body.animate({scrollTop:0}, 800);
});
$window.scroll(function() {
if($window.scrollTop() > offset) {
$top_link.fadeIn();
} else {
$top_link.fadeOut();
}
}).scroll();
$('.popin').popover({trigger: 'hover'});
});
</script>
</body>
</html>

View File

@ -0,0 +1,286 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dashboard for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/nv.d3.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<div class="container">
<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li><a href="index.html">%s</a></li>
<li class="active">(Dashboard)</li>
</ol>
</div>
</div>
</div>
</header>
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>Classes</h2>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Coverage Distribution</h3>
<div id="classCoverageDistribution" style="height: 300px;">
<svg></svg>
</div>
</div>
<div class="col-md-6">
<h3>Complexity</h3>
<div id="classComplexity" style="height: 300px;">
<svg></svg>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Insufficient Coverage</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Class</th>
<th class="text-right">Coverage</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h3>Project Risks</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Class</th>
<th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h2>Methods</h2>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Coverage Distribution</h3>
<div id="methodCoverageDistribution" style="height: 300px;">
<svg></svg>
</div>
</div>
<div class="col-md-6">
<h3>Complexity</h3>
<div id="methodComplexity" style="height: 300px;">
<svg></svg>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<h3>Insufficient Coverage</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Method</th>
<th class="text-right">Coverage</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<div class="col-md-6">
<h3>Project Risks</h3>
<div class="scrollbox">
<table class="table">
<thead>
<tr>
<th>Method</th>
<th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<footer>
<hr/>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage %s</a> using <a href="http://php.net/" target="_top">%s</a> at %s.</small>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script src="js/d3.min.js" type="text/javascript"></script>
<script src="js/nv.d3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
nv.addGraph(function() {
var chart = nv.models.multiBarChart();
chart.tooltips(false)
.showControls(false)
.showLegend(false)
.reduceXTicks(false)
.staggerLabels(true)
.yAxis.tickFormat(d3.format('d'));
d3.select('#classCoverageDistribution svg')
.datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,0,2], "Class Coverage"))
.transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
nv.addGraph(function() {
var chart = nv.models.multiBarChart();
chart.tooltips(false)
.showControls(false)
.showLegend(false)
.reduceXTicks(false)
.staggerLabels(true)
.yAxis.tickFormat(d3.format('d'));
d3.select('#methodCoverageDistribution svg')
.datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,0,2], "Method Coverage"))
.transition().duration(500).call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
function getCoverageDistributionData(data, label) {
var labels = [
'0%',
'0-10%',
'10-20%',
'20-30%',
'30-40%',
'40-50%',
'50-60%',
'60-70%',
'70-80%',
'80-90%',
'90-100%',
'100%'
];
var values = [];
$.each(labels, function(key) {
values.push({x: labels[key], y: data[key]});
});
return [
{
key: label,
values: values,
color: "#4572A7"
}
];
}
nv.addGraph(function() {
var chart = nv.models.scatterChart()
.showDistX(true)
.showDistY(true)
.showLegend(false)
.forceX([0, 100]);
chart.tooltipContent(function(key, y, e, graph) {
return '<p>' + graph.point.class + '</p>';
});
chart.xAxis.axisLabel('Code Coverage (in percent)');
chart.yAxis.axisLabel('Cyclomatic Complexity');
d3.select('#classComplexity svg')
.datum(getComplexityData([[100,1,"<a href=\"source_with_ignore.php.html#11\">Foo<\/a>"],[100,1,"<a href=\"source_with_ignore.php.html#18\">Bar<\/a>"]], 'Class Complexity'))
.transition()
.duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
nv.addGraph(function() {
var chart = nv.models.scatterChart()
.showDistX(true)
.showDistY(true)
.showLegend(false)
.forceX([0, 100]);
chart.tooltipContent(function(key, y, e, graph) {
return '<p>' + graph.point.class + '</p>';
});
chart.xAxis.axisLabel('Code Coverage (in percent)');
chart.yAxis.axisLabel('Method Complexity');
d3.select('#methodComplexity svg')
.datum(getComplexityData([[100,1,"<a href=\"source_with_ignore.php.html#13\">Foo::bar<\/a>"],[100,1,"<a href=\"source_with_ignore.php.html#23\">Bar::foo<\/a>"]], 'Method Complexity'))
.transition()
.duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
function getComplexityData(data, label) {
var values = [];
$.each(data, function(key) {
var value = Math.round(data[key][0]*100) / 100;
values.push({
x: value,
y: data[key][1],
class: data[key][2],
size: 0.05,
shape: 'diamond'
});
});
return [
{
key: label,
values: values,
color: "#4572A7"
}
];
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,119 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Code Coverage for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<div class="container">
<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li class="active">%s</li>
<li>(<a href="dashboard.html">Dashboard</a>)</li>
</ol>
</div>
</div>
</div>
</header>
<div class="container">
<table class="table table-bordered">
<thead>
<tr>
<td>&nbsp;</td>
<td colspan="9"><div align="center"><strong>Code Coverage</strong></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
<td colspan="3"><div align="center"><strong>Functions and Methods</strong></div></td>
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
</tr>
</thead>
<tbody>
<tr>
<td class="danger">Total</td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">50.00%</div></td>
<td class="danger small"><div align="right">1&nbsp;/&nbsp;2</div></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">0&nbsp;/&nbsp;0</div></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">2&nbsp;/&nbsp;2</div></td>
</tr>
<tr>
<td class="danger"><span class="glyphicon glyphicon-file"></span> <a href="source_with_ignore.php.html">source_with_ignore.php</a></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">50.00%</div></td>
<td class="danger small"><div align="right">1&nbsp;/&nbsp;2</div></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">0&nbsp;/&nbsp;0</div></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">2&nbsp;/&nbsp;2</div></td>
</tr>
</tbody>
</table>
<footer>
<hr/>
<h4>Legend</h4>
<p>
<span class="danger"><strong>Low</strong>: 0% to 50%</span>
<span class="warning"><strong>Medium</strong>: 50% to 90%</span>
<span class="success"><strong>High</strong>: 90% to 100%</span>
</p>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage %s</a> using <a href="http://php.net/" target="_top">%s</a> at %s.</small>
</p>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
</body>
</html>

View File

@ -0,0 +1,279 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Code Coverage for %s/source_with_ignore.php</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<div class="container">
<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li><a href="index.html">%s</a></li>
<li class="active">source_with_ignore.php</li>
</ol>
</div>
</div>
</div>
</header>
<div class="container">
<table class="table table-bordered">
<thead>
<tr>
<td>&nbsp;</td>
<td colspan="10"><div align="center"><strong>Code Coverage</strong></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3"><div align="center"><strong>Classes and Traits</strong></div></td>
<td colspan="4"><div align="center"><strong>Functions and Methods</strong></div></td>
<td colspan="3"><div align="center"><strong>Lines</strong></div></td>
</tr>
</thead>
<tbody>
<tr>
<td class="success">Total</td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">2&nbsp;/&nbsp;2</div></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">0&nbsp;/&nbsp;0</div></td>
<td class="success small"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>
</div>
</div>
</td>
<td class="danger small"><div align="right">50.00%</div></td>
<td class="danger small"><div align="right">1&nbsp;/&nbsp;2</div></td>
</tr>
<tr>
<td class="success" colspan="4"><a href="#28"><abbr title="baz()">baz</abbr></a></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
<td class="success small">0</td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">0&nbsp;/&nbsp;0</div></td>
</tr>
<tr>
<td class="success">Foo</td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
<td class="success small">1</td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">0&nbsp;/&nbsp;0</div></td>
</tr>
<tr>
<td class="success" colspan="4">&nbsp;<a href="#13"><abbr title="bar()">bar</abbr></a></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
<td class="success small">1</td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">0&nbsp;/&nbsp;0</div></td>
</tr>
<tr>
<td class="success">Bar</td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
<td class="success small">1</td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">0&nbsp;/&nbsp;0</div></td>
</tr>
<tr>
<td class="success" colspan="4">&nbsp;<a href="#23"><abbr title="foo()">foo</abbr></a></td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">1&nbsp;/&nbsp;1</div></td>
<td class="success small">1</td>
<td class="success big"> <div class="progress">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100.00" aria-valuemin="0" aria-valuemax="100" style="width: 100.00%">
<span class="sr-only">100.00% covered (success)</span>
</div>
</div>
</td>
<td class="success small"><div align="right">100.00%</div></td>
<td class="success small"><div align="right">0&nbsp;/&nbsp;0</div></td>
</tr>
</tbody>
</table>
<table id="code" class="table table-borderless table-condensed">
<tbody>
<tr><td><div align="right"><a name="1"></a><a href="#1">1</a></div></td><td class="codeLine"><span class="default">&lt;?php</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 2" data-content="&lt;ul&gt;&lt;li class=&quot;covered-by-large-tests&quot;&gt;FileWithIgnoredLines&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="2"></a><a href="#2">2</a></div></td><td class="codeLine"><span class="keyword">if</span><span class="default">&nbsp;</span><span class="keyword">(</span><span class="default">$neverHappens</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">{</span></td></tr>
<tr><td><div align="right"><a name="3"></a><a href="#3">3</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">//&nbsp;@codeCoverageIgnoreStart</span></td></tr>
<tr><td><div align="right"><a name="4"></a><a href="#4">4</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">print</span><span class="default">&nbsp;</span><span class="default">'*'</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="5"></a><a href="#5">5</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">//&nbsp;@codeCoverageIgnoreEnd</span></td></tr>
<tr class="danger"><td><div align="right"><a name="6"></a><a href="#6">6</a></div></td><td class="codeLine"><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="7"></a><a href="#7">7</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="8"></a><a href="#8">8</a></div></td><td class="codeLine"><span class="comment">/**</span></td></tr>
<tr><td><div align="right"><a name="9"></a><a href="#9">9</a></div></td><td class="codeLine"><span class="comment">&nbsp;*&nbsp;@codeCoverageIgnore</span></td></tr>
<tr><td><div align="right"><a name="10"></a><a href="#10">10</a></div></td><td class="codeLine"><span class="comment">&nbsp;*/</span></td></tr>
<tr><td><div align="right"><a name="11"></a><a href="#11">11</a></div></td><td class="codeLine"><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">Foo</span></td></tr>
<tr><td><div align="right"><a name="12"></a><a href="#12">12</a></div></td><td class="codeLine"><span class="keyword">{</span></td></tr>
<tr><td><div align="right"><a name="13"></a><a href="#13">13</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">bar</span><span class="keyword">(</span><span class="keyword">)</span></td></tr>
<tr><td><div align="right"><a name="14"></a><a href="#14">14</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
<tr><td><div align="right"><a name="15"></a><a href="#15">15</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="16"></a><a href="#16">16</a></div></td><td class="codeLine"><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="17"></a><a href="#17">17</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="18"></a><a href="#18">18</a></div></td><td class="codeLine"><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">Bar</span></td></tr>
<tr><td><div align="right"><a name="19"></a><a href="#19">19</a></div></td><td class="codeLine"><span class="keyword">{</span></td></tr>
<tr><td><div align="right"><a name="20"></a><a href="#20">20</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">/**</span></td></tr>
<tr><td><div align="right"><a name="21"></a><a href="#21">21</a></div></td><td class="codeLine"><span class="comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@codeCoverageIgnore</span></td></tr>
<tr><td><div align="right"><a name="22"></a><a href="#22">22</a></div></td><td class="codeLine"><span class="comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span></td></tr>
<tr><td><div align="right"><a name="23"></a><a href="#23">23</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">foo</span><span class="keyword">(</span><span class="keyword">)</span></td></tr>
<tr><td><div align="right"><a name="24"></a><a href="#24">24</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
<tr><td><div align="right"><a name="25"></a><a href="#25">25</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="26"></a><a href="#26">26</a></div></td><td class="codeLine"><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="27"></a><a href="#27">27</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="28"></a><a href="#28">28</a></div></td><td class="codeLine"><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">baz</span><span class="keyword">(</span><span class="keyword">)</span></td></tr>
<tr><td><div align="right"><a name="29"></a><a href="#29">29</a></div></td><td class="codeLine"><span class="keyword">{</span></td></tr>
<tr><td><div align="right"><a name="30"></a><a href="#30">30</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">print</span><span class="default">&nbsp;</span><span class="default">'*'</span><span class="keyword">;</span><span class="default">&nbsp;</span><span class="comment">//&nbsp;@codeCoverageIgnore</span></td></tr>
<tr><td><div align="right"><a name="31"></a><a href="#31">31</a></div></td><td class="codeLine"><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="32"></a><a href="#32">32</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="33"></a><a href="#33">33</a></div></td><td class="codeLine"><span class="keyword">interface</span><span class="default">&nbsp;</span><span class="default">Bor</span></td></tr>
<tr><td><div align="right"><a name="34"></a><a href="#34">34</a></div></td><td class="codeLine"><span class="keyword">{</span></td></tr>
<tr><td><div align="right"><a name="35"></a><a href="#35">35</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">foo</span><span class="keyword">(</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="36"></a><a href="#36">36</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="37"></a><a href="#37">37</a></div></td><td class="codeLine"><span class="keyword">}</span></td></tr>
</tbody>
</table>
<footer>
<hr/>
<h4>Legend</h4>
<p>
<span class="success"><strong>Executed</strong></span>
<span class="danger"><strong>Not Executed</strong></span>
<span class="warning"><strong>Dead Code</strong></span>
</p>
<p>
<small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage %s</a> using <a href="http://php.net/" target="_top">%s</a> at %s.</small>
</p>
<a title="Back to the top" id="toplink" href="#"><span class="glyphicon glyphicon-arrow-up"></span></a>
</footer>
</div>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<script src="js/holder.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
var $window = $(window)
, $top_link = $('#toplink')
, $body = $('body, html')
, offset = $('#code').offset().top;
$top_link.hide().click(function(event) {
event.preventDefault();
$body.animate({scrollTop:0}, 800);
});
$window.scroll(function() {
if($window.scrollTop() > offset) {
$top_link.fadeIn();
} else {
$top_link.fadeOut();
}
}).scroll();
$('.popin').popover({trigger: 'hover'});
});
</script>
</body>
</html>

View File

@ -0,0 +1,40 @@
<?xml version="1.0"?>
<phpunit xmlns="http://schema.phpunit.de/coverage/1.0">
<file name="BankAccount.php">
<totals>
<lines total="33" comments="0" code="33" executable="10" executed="5" percent="50.00%"/>
<methods count="4" tested="3" percent="75.00%"/>
<functions count="0" tested="0" percent=""/>
<classes count="1" tested="0" percent="0.00%"/>
<traits count="0" tested="0" percent=""/>
</totals>
<class name="BankAccount" start="2" executable="10" executed="5" crap="8.12">
<package full="" name="" sub="" category=""/>
<namespace name=""/>
<method name="getBalance" signature="getBalance()" start="6" end="9" crap="1" executable="1" executed="1" coverage="100"/>
<method name="setBalance" signature="setBalance($balance)" start="11" end="18" crap="6" executable="5" executed="0" coverage="0"/>
<method name="depositMoney" signature="depositMoney($balance)" start="20" end="25" crap="1" executable="2" executed="2" coverage="100"/>
<method name="withdrawMoney" signature="withdrawMoney($balance)" start="27" end="32" crap="1" executable="2" executed="2" coverage="100"/>
</class>
<coverage>
<line nr="8">
<covered by="BankAccountTest::testBalanceIsInitiallyZero"/>
<covered by="BankAccountTest::testDepositWithdrawMoney"/>
</line>
<line nr="22">
<covered by="BankAccountTest::testBalanceCannotBecomeNegative2"/>
<covered by="BankAccountTest::testDepositWithdrawMoney"/>
</line>
<line nr="24">
<covered by="BankAccountTest::testDepositWithdrawMoney"/>
</line>
<line nr="29">
<covered by="BankAccountTest::testBalanceCannotBecomeNegative"/>
<covered by="BankAccountTest::testDepositWithdrawMoney"/>
</line>
<line nr="31">
<covered by="BankAccountTest::testDepositWithdrawMoney"/>
</line>
</coverage>
</file>
</phpunit>

View File

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<phpunit xmlns="http://schema.phpunit.de/coverage/1.0">
<project name="%s">
<tests>
<test name="BankAccountTest::testBalanceIsInitiallyZero" size="unknown" result="0" status="PASSED"/>
<test name="BankAccountTest::testBalanceCannotBecomeNegative" size="unknown" result="0" status="PASSED"/>
<test name="BankAccountTest::testBalanceCannotBecomeNegative2" size="unknown" result="0" status="PASSED"/>
<test name="BankAccountTest::testDepositWithdrawMoney" size="unknown" result="0" status="PASSED"/>
</tests>
<directory name="%s">
<totals>
<lines total="33" comments="0" code="33" executable="10" executed="5" percent="50.00%"/>
<methods count="4" tested="3" percent="75.00%"/>
<functions count="0" tested="0" percent=""/>
<classes count="1" tested="0" percent="0.00%"/>
<traits count="0" tested="0" percent=""/>
</totals>
<file name="BankAccount.php" href="BankAccount.php.xml">
<totals>
<lines total="33" comments="0" code="33" executable="10" executed="5" percent="50.00%"/>
<methods count="4" tested="3" percent="75.00%"/>
<functions count="0" tested="0" percent=""/>
<classes count="1" tested="0" percent="0.00%"/>
<traits count="0" tested="0" percent=""/>
</totals>
</file>
</directory>
</project>
</phpunit>

View File

@ -0,0 +1,26 @@
<?xml version="1.0"?>
<phpunit xmlns="http://schema.phpunit.de/coverage/1.0">
<project name="%s">
<tests>
<test name="ClassWithAnonymousFunction" size="unknown" result="0" status="PASSED"/>
</tests>
<directory name="%s">
<totals>
<lines total="19" comments="2" code="17" executable="8" executed="7" percent="87.50%"/>
<methods count="2" tested="1" percent="50.00%"/>
<functions count="0" tested="0" percent=""/>
<classes count="1" tested="0" percent="0.00%"/>
<traits count="0" tested="0" percent=""/>
</totals>
<file name="source_with_class_and_anonymous_function.php" href="source_with_class_and_anonymous_function.php.xml">
<totals>
<lines total="19" comments="2" code="17" executable="8" executed="7" percent="87.50%"/>
<methods count="2" tested="1" percent="50.00%"/>
<functions count="0" tested="0" percent=""/>
<classes count="1" tested="0" percent="0.00%"/>
<traits count="0" tested="0" percent=""/>
</totals>
</file>
</directory>
</project>
</phpunit>

View File

@ -0,0 +1,41 @@
<?xml version="1.0"?>
<phpunit xmlns="http://schema.phpunit.de/coverage/1.0">
<file name="source_with_class_and_anonymous_function.php">
<totals>
<lines total="19" comments="2" code="17" executable="8" executed="7" percent="87.50%"/>
<methods count="2" tested="1" percent="50.00%"/>
<functions count="0" tested="0" percent=""/>
<classes count="1" tested="0" percent="0.00%"/>
<traits count="0" tested="0" percent=""/>
</totals>
<class name="CoveredClassWithAnonymousFunctionInStaticMethod" start="3" executable="8" executed="7" crap="2.01">
<package full="" name="" sub="" category=""/>
<namespace name=""/>
<method name="runAnonymous" signature="runAnonymous()" start="5" end="18" crap="1.04" executable="3" executed="2" coverage="66.666666666667"/>
<method name="anonymous function" signature="anonymous function (&amp;$val, $key)" start="11" end="13" crap="1" executable="2" executed="2" coverage="100"/>
</class>
<coverage>
<line nr="7">
<covered by="ClassWithAnonymousFunction"/>
</line>
<line nr="9">
<covered by="ClassWithAnonymousFunction"/>
</line>
<line nr="12">
<covered by="ClassWithAnonymousFunction"/>
</line>
<line nr="13">
<covered by="ClassWithAnonymousFunction"/>
</line>
<line nr="14">
<covered by="ClassWithAnonymousFunction"/>
</line>
<line nr="17">
<covered by="ClassWithAnonymousFunction"/>
</line>
<line nr="18">
<covered by="ClassWithAnonymousFunction"/>
</line>
</coverage>
</file>
</phpunit>

View File

@ -0,0 +1,26 @@
<?xml version="1.0"?>
<phpunit xmlns="http://schema.phpunit.de/coverage/1.0">
<project name="%s">
<tests>
<test name="FileWithIgnoredLines" size="unknown" result="0" status="PASSED"/>
</tests>
<directory name="%s">
<totals>
<lines total="37" comments="12" code="25" executable="2" executed="1" percent="50.00%"/>
<methods count="0" tested="0" percent=""/>
<functions count="1" tested="0" percent="0.00%"/>
<classes count="2" tested="2" percent="100.00%"/>
<traits count="0" tested="0" percent=""/>
</totals>
<file name="source_with_ignore.php" href="source_with_ignore.php.xml">
<totals>
<lines total="37" comments="12" code="25" executable="2" executed="1" percent="50.00%"/>
<methods count="0" tested="0" percent=""/>
<functions count="1" tested="0" percent="0.00%"/>
<classes count="2" tested="2" percent="100.00%"/>
<traits count="0" tested="0" percent=""/>
</totals>
</file>
</directory>
</project>
</phpunit>

View File

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<phpunit xmlns="http://schema.phpunit.de/coverage/1.0">
<file name="source_with_ignore.php">
<totals>
<lines total="37" comments="12" code="25" executable="2" executed="1" percent="50.00%"/>
<methods count="0" tested="0" percent=""/>
<functions count="1" tested="0" percent="0.00%"/>
<classes count="2" tested="2" percent="100.00%"/>
<traits count="0" tested="0" percent=""/>
</totals>
<class name="Foo" start="11" executable="0" executed="0" crap="1">
<package full="" name="" sub="" category=""/>
<namespace name=""/>
<method name="bar" signature="bar()" start="13" end="15" crap="1" executable="0" executed="0" coverage="100"/>
</class>
<class name="Bar" start="18" executable="0" executed="0" crap="1">
<package full="" name="" sub="" category=""/>
<namespace name=""/>
<method name="foo" signature="foo()" start="23" end="25" crap="1" executable="0" executed="0" coverage="100"/>
</class>
<function name="baz" signature="baz()" start="28" crap="0" executable="0" executed="0" coverage="0"/>
<coverage>
<line nr="2">
<covered by="FileWithIgnoredLines"/>
</line>
</coverage>
</file>
</phpunit>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<crap_result>
<project>CoverageForClassWithAnonymousFunction</project>
<timestamp>%s</timestamp>
<stats>
<name>Method Crap Stats</name>
<methodCount>2</methodCount>
<crapMethodCount>0</crapMethodCount>
<crapLoad>0</crapLoad>
<totalCrap>2.04</totalCrap>
<crapMethodPercent>0</crapMethodPercent>
</stats>
<methods>
<method>
<package>global</package>
<className>CoveredClassWithAnonymousFunctionInStaticMethod</className>
<methodName>runAnonymous</methodName>
<methodSignature>runAnonymous()</methodSignature>
<fullMethod>runAnonymous()</fullMethod>
<crap>1.04</crap>
<complexity>1</complexity>
<coverage>66.67</coverage>
<crapLoad>0</crapLoad>
</method>
<method>
<package>global</package>
<className>CoveredClassWithAnonymousFunctionInStaticMethod</className>
<methodName>anonymous function</methodName>
<methodSignature>anonymous function (&amp;$val, $key)</methodSignature>
<fullMethod>anonymous function (&amp;$val, $key)</fullMethod>
<crap>1</crap>
<complexity>1</complexity>
<coverage>100</coverage>
<crapLoad>0</crapLoad>
</method>
</methods>
</crap_result>

View File

@ -0,0 +1,12 @@
Code Coverage Report:
%s
Summary:
Classes: 0.00% (0/1)
Methods: 50.00% (1/2)
Lines: 87.50% (7/8)
CoveredClassWithAnonymousFunctionInStaticMethod
Methods: 50.00% ( 1/ 2) Lines: 80.00% ( 4/ 5)

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<crap_result>
<project>CoverageForFileWithIgnoredLines</project>
<timestamp>%s</timestamp>
<stats>
<name>Method Crap Stats</name>
<methodCount>2</methodCount>
<crapMethodCount>0</crapMethodCount>
<crapLoad>0</crapLoad>
<totalCrap>2</totalCrap>
<crapMethodPercent>0</crapMethodPercent>
</stats>
<methods>
<method>
<package>global</package>
<className>Foo</className>
<methodName>bar</methodName>
<methodSignature>bar()</methodSignature>
<fullMethod>bar()</fullMethod>
<crap>1</crap>
<complexity>1</complexity>
<coverage>100</coverage>
<crapLoad>0</crapLoad>
</method>
<method>
<package>global</package>
<className>Bar</className>
<methodName>foo</methodName>
<methodSignature>foo()</methodSignature>
<fullMethod>foo()</fullMethod>
<crap>1</crap>
<complexity>1</complexity>
<coverage>100</coverage>
<crapLoad>0</crapLoad>
</method>
</methods>
</crap_result>

View File

@ -0,0 +1,10 @@
Code Coverage Report:
%s
Summary:
Classes: 100.00% (2/2)
Methods: (0/0)
Lines: 50.00% (1/2)

View File

@ -0,0 +1,43 @@
<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
->files()
->in('src')
->in('tests')
->name('*.php');
return Symfony\CS\Config\Config::create()
->level(\Symfony\CS\FixerInterface::NONE_LEVEL)
->fixers(
array(
'duplicate_semicolon',
'empty_return',
'extra_empty_lines',
'join_function',
'list_commas',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'phpdoc_indent',
'phpdoc_no_access',
'phpdoc_no_empty_return',
'phpdoc_no_package',
'phpdoc_params',
'phpdoc_scalar',
'phpdoc_to_comment',
'phpdoc_trim',
'return',
'self_accessor',
'single_quote',
'spaces_before_semicolon',
'spaces_cast',
'ternary_spaces',
'trim_array_spaces',
'unused_use',
'whitespacy_lines',
'align_double_arrow',
'align_equals',
'concat_with_spaces',
'short_array_syntax'
)
)
->finder($finder);

View File

@ -0,0 +1,38 @@
<?php
class Framework_MockObject_Builder_InvocationMockerTest extends PHPUnit_Framework_TestCase
{
public function testWillReturnWithOneValue()
{
$mock = $this->getMock('stdClass', ['foo']);
$mock
->expects($this->any())
->method('foo')
->willReturn(1);
$this->assertEquals(1, $mock->foo());
}
public function testWillReturnWithMultipleValues()
{
$mock = $this->getMock('stdClass', ['foo']);
$mock
->expects($this->any())
->method('foo')
->willReturn(1, 2, 3);
$this->assertEquals(1, $mock->foo());
$this->assertEquals(2, $mock->foo());
$this->assertEquals(3, $mock->foo());
}
public function testWillReturnOnConsecutiveCalls()
{
$mock = $this->getMock('stdClass', ['foo']);
$mock
->expects($this->any())
->method('foo')
->willReturnOnConsecutiveCalls(1, 2, 3);
$this->assertEquals(1, $mock->foo());
$this->assertEquals(2, $mock->foo());
$this->assertEquals(3, $mock->foo());
}
}

View File

@ -0,0 +1,103 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
--SKIPIF--
<?php
if (!method_exists('ReflectionMethod', 'getReturnType')) print 'skip: PHP >= 7.0.0 required';
?>
--FILE--
<?php
class Foo
{
public function bar(string $baz): Bar
{
return 'test';
}
}
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$mock = $generator->generate(
'Foo',
array(),
'MockFoo',
true,
true
);
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
public function __clone()
{
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function bar(string $baz): Bar
{
$arguments = array($baz);
$count = func_num_args();
if ($count > 1) {
$_arguments = func_get_args();
for ($i = 1; $i < $count; $i++) {
$arguments[] = $_arguments[$i];
}
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
'Foo', 'bar', $arguments, 'Bar', $this, true
)
);
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
{
return $this->__phpunit_getInvocationMocker()->expects($matcher);
}
public function method()
{
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
public function __phpunit_setOriginalObject($originalObject)
{
$this->__phpunit_originalObject = $originalObject;
}
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
}
return $this->__phpunit_invocationMocker;
}
public function __phpunit_hasMatchers()
{
return $this->__phpunit_getInvocationMocker()->hasMatchers();
}
public function __phpunit_verify($unsetInvocationMocker = true)
{
$this->__phpunit_getInvocationMocker()->verify();
if ($unsetInvocationMocker) {
$this->__phpunit_invocationMocker = null;
}
}
}

View File

@ -0,0 +1,100 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
--SKIPIF--
<?php
if (!method_exists('ReflectionMethod', 'getReturnType')) print 'skip: PHP >= 7.0.0 required';
?>
--FILE--
<?php
interface Foo
{
public function bar(string $baz): self;
}
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$mock = $generator->generate(
'Foo',
array(),
'MockFoo',
true,
true
);
print $mock['code'];
?>
--EXPECTF--
class MockFoo implements PHPUnit_Framework_MockObject_MockObject, Foo
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
public function __clone()
{
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public function bar(string $baz): Foo
{
$arguments = array($baz);
$count = func_num_args();
if ($count > 1) {
$_arguments = func_get_args();
for ($i = 1; $i < $count; $i++) {
$arguments[] = $_arguments[$i];
}
}
$result = $this->__phpunit_getInvocationMocker()->invoke(
new PHPUnit_Framework_MockObject_Invocation_Object(
'Foo', 'bar', $arguments, 'Foo', $this, true
)
);
return $result;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
{
return $this->__phpunit_getInvocationMocker()->expects($matcher);
}
public function method()
{
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
public function __phpunit_setOriginalObject($originalObject)
{
$this->__phpunit_originalObject = $originalObject;
}
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
}
return $this->__phpunit_invocationMocker;
}
public function __phpunit_hasMatchers()
{
return $this->__phpunit_getInvocationMocker()->hasMatchers();
}
public function __phpunit_verify($unsetInvocationMocker = true)
{
$this->__phpunit_getInvocationMocker()->verify();
if ($unsetInvocationMocker) {
$this->__phpunit_invocationMocker = null;
}
}
}

View File

@ -0,0 +1,86 @@
--TEST--
PHPUnit_Framework_MockObject_Generator::generate('Foo', array(), 'MockFoo', true, true)
--SKIPIF--
<?php
if (!method_exists('ReflectionMethod', 'getReturnType')) print 'skip: PHP >= 7.0.0 required';
?>
--FILE--
<?php
class Foo
{
public static function bar(string $baz): Bar
{
return 'test';
}
}
require __DIR__ . '/../../vendor/autoload.php';
$generator = new PHPUnit_Framework_MockObject_Generator;
$mock = $generator->generate(
'Foo',
array(),
'MockFoo',
true,
true
);
print $mock['code'];
?>
--EXPECTF--
class MockFoo extends Foo implements PHPUnit_Framework_MockObject_MockObject
{
private $__phpunit_invocationMocker;
private $__phpunit_originalObject;
public function __clone()
{
$this->__phpunit_invocationMocker = clone $this->__phpunit_getInvocationMocker();
}
public static function bar(string $baz): Bar
{
throw new PHPUnit_Framework_MockObject_BadMethodCallException;
}
public function expects(PHPUnit_Framework_MockObject_Matcher_Invocation $matcher)
{
return $this->__phpunit_getInvocationMocker()->expects($matcher);
}
public function method()
{
$any = new PHPUnit_Framework_MockObject_Matcher_AnyInvokedCount;
$expects = $this->expects($any);
return call_user_func_array(array($expects, 'method'), func_get_args());
}
public function __phpunit_setOriginalObject($originalObject)
{
$this->__phpunit_originalObject = $originalObject;
}
public function __phpunit_getInvocationMocker()
{
if ($this->__phpunit_invocationMocker === null) {
$this->__phpunit_invocationMocker = new PHPUnit_Framework_MockObject_InvocationMocker;
}
return $this->__phpunit_invocationMocker;
}
public function __phpunit_hasMatchers()
{
return $this->__phpunit_getInvocationMocker()->hasMatchers();
}
public function __phpunit_verify($unsetInvocationMocker = true)
{
$this->__phpunit_getInvocationMocker()->verify();
if ($unsetInvocationMocker) {
$this->__phpunit_invocationMocker = null;
}
}
}

View File

@ -0,0 +1,5 @@
<?php
interface InterfaceWithSemiReservedMethodName
{
public function unset();
}

View File

@ -0,0 +1,8 @@
<?php
class StringableClass
{
public function __toString()
{
return '12345';
}
}

128
vendor/phpunit/phpunit/ChangeLog-5.0.md vendored Normal file
View File

@ -0,0 +1,128 @@
# Changes in PHPUnit 5.0
All notable changes of the PHPUnit 5.0 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [5.0.10] - 2015-11-30
### Fixed
* Fixed [#1953](https://github.com/sebastianbergmann/phpunit/issues/1953): `Error`s raised outside the scope of a test method are not handled properly
* Fixed [#1955](https://github.com/sebastianbergmann/phpunit/issues/1955): Process isolation fails when running tests with `phpdbg -qrr`
## [5.0.9] - 2015-11-10
### Added
* Merged [#1909](https://github.com/sebastianbergmann/phpunit/issues/1909): Added `flowId` parameter to each TeamCity message (for parallel tests)
### Fixed
* Fixed [#1935](https://github.com/sebastianbergmann/phpunit/issues/1935): `PHP_CodeCoverage_Exception` not handled properly
* Fixed [#1944](https://github.com/sebastianbergmann/phpunit/issues/1944): Exceptions are not handled correctly on PHP 7 when an exception is expected
* Fixed [#1948](https://github.com/sebastianbergmann/phpunit/issues/1948): Unable to use PHAR due to unsupported signature error
### Removed
* Removed leftover references to PHPUnit_Selenium
## [5.0.8] - 2015-10-23
### Added
* Implemented [#1925](https://github.com/sebastianbergmann/phpunit/issues/1925): Provide a library-only PHAR
## [5.0.7] - 2015-10-22
### Fixed
* The backup of global state is now properly restored when changes to global state are disallowed
* The `__PHPUNIT_PHAR__` constant is now properly set when the PHPUnit PHAR is used as a library
## [5.0.6] - 2015-10-14
### Added
* Added the `--self-upgrade` commandline switch for upgrading a PHPUnit PHAR to the latest version
### Changed
* The `--self-update` commandline switch now updates a PHPUnit PHAR to the latest version within the same release series
### Fixed
* Fixed [#1892](https://github.com/sebastianbergmann/phpunit/issues/1892): `--coverage-text` does not honor color settings
## [5.0.5] - 2015-10-12
### Changed
* Merged [#1893](https://github.com/sebastianbergmann/phpunit/issues/1893): Removed workaround for phpab bug
## [5.0.4] - 2015-10-07
### Fixed
* Fixed [#1857](https://github.com/sebastianbergmann/phpunit/issues/1857): `@covers` and `@uses` should only take a single word
* Fixed [#1898](https://github.com/sebastianbergmann/phpunit/issues/1898): `@covers` and `@uses` cannot be used for namespaced functions
## [5.0.3] - 2015-10-02
* Fixed check for PHP version in PHAR distribution of PHPUnit
## [5.0.2] - 2015-10-02
### Fixed
* Fixed [#1879](https://github.com/sebastianbergmann/phpunit/issues/1879): `assertEqualXMLStructure()` cannot compare nodes with an ID
* Fixed [#1887](https://github.com/sebastianbergmann/phpunit/issues/1887): PHAR distribution of PHPUnit 5.0.1 does not work
## [5.0.1] - 2015-10-02
### Fixed
* Merged [#1885](https://github.com/sebastianbergmann/phpunit/issues/1885): Fixed handling of PHP configuration settings for process isolation
* An outdated version of DbUnit was bundled in the PHAR distribution of PHPUnit
## [5.0.0] - 2015-10-02
### Added
* Implemented [#1604](https://github.com/sebastianbergmann/phpunit/issues/1604): A `@small` test should be marked as risky when it executes code that performs I/O operations
* Implemented [#1656](https://github.com/sebastianbergmann/phpunit/issues/1656): Allow sorting test failures in reverse
* Merged [#1753](https://github.com/sebastianbergmann/phpunit/issues/1753): Added the `assertFinite()`, `assertInfinite()` and `assertNan()` assertions
* Merged [#1876](https://github.com/sebastianbergmann/phpunit/issues/1876): Added the `--atleast-version` commandline option
* Implemented [#1780](https://github.com/sebastianbergmann/phpunit/issues/1780): Support for deep-cloning of results passed between tests using `@depends`
* Implemented [#1821](https://github.com/sebastianbergmann/phpunit/issues/1821): Expectations on mock objects passed via `@depends` are now also evaluated for the depending test
* Added `--whitelist` commandline option to configure a whitelist for code coverage analysis
* Added convenience wrapper `getMockWithoutInvokingTheOriginalConstructor()` to create a test double without invoking the original class' constructor
* Added TeamCity test result logger for more seamless integration of PHPUnit with PhpStorm
### Changed
* Merged [#1781](https://github.com/sebastianbergmann/phpunit/issues/1781): Empty string is not treated as a valid JSON string anymore
* Merged [#1822](https://github.com/sebastianbergmann/phpunit/issues/1822): Always output progress totals on last line
* It is now mandatory to configure a whitelist for code coverage analysis
* Renamed the `beStrictAboutTestSize` configuration option to `enforceTimeLimit`
* Printer-related CLI options now override printer-related configuration settings
### Removed
* The `assertSelectCount()`, `assertSelectRegExp()`, `assertSelectEquals()`, `assertTag()`, `assertNotTag()` assertions have been removed
* The `--strict` commandline option and the XML configuration's `strict` attribute have been removed
* The code coverage blacklist functionality has been removed
* The PHPUnit_Selenium component is no longer bundled in the PHAR distribution
* The PHPUnit_Selenium component can no longer be configured using the `<selenium/browser>` element of PHPUnit's configuration file
* PHPUnit is no longer supported on PHP 5.3, PHP 5.4, and PHP 5.5
[5.0.10]: https://github.com/sebastianbergmann/phpunit/compare/5.0.9...5.0.10
[5.0.9]: https://github.com/sebastianbergmann/phpunit/compare/5.0.8...5.0.9
[5.0.8]: https://github.com/sebastianbergmann/phpunit/compare/5.0.7...5.0.8
[5.0.7]: https://github.com/sebastianbergmann/phpunit/compare/5.0.6...5.0.7
[5.0.6]: https://github.com/sebastianbergmann/phpunit/compare/5.0.5...5.0.6
[5.0.5]: https://github.com/sebastianbergmann/phpunit/compare/5.0.4...5.0.5
[5.0.4]: https://github.com/sebastianbergmann/phpunit/compare/5.0.3...5.0.4
[5.0.3]: https://github.com/sebastianbergmann/phpunit/compare/5.0.2...5.0.3
[5.0.2]: https://github.com/sebastianbergmann/phpunit/compare/5.0.1...5.0.2
[5.0.1]: https://github.com/sebastianbergmann/phpunit/compare/5.0.0...5.0.1
[5.0.0]: https://github.com/sebastianbergmann/phpunit/compare/4.8...5.0.0

68
vendor/phpunit/phpunit/ChangeLog-5.1.md vendored Normal file
View File

@ -0,0 +1,68 @@
# Changes in PHPUnit 5.1
All notable changes of the PHPUnit 5.1 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [5.1.7] - 2016-02-02
### Fixed
* Fixed [#2050](https://github.com/sebastianbergmann/phpunit/issues/2050): `PHPUnit_Util_XML::load()` raises exception with empty message when XML string is empty
## [5.1.6] - 2016-01-29
### Fixed
* Fixed [#2052](https://github.com/sebastianbergmann/phpunit/issues/2052): PHPUnit 5.1.5 breaks coverage whitelist include directory globbing
## [5.1.5] - 2016-01-29
### Fixed
* An exception is now raised when non-existant directories or files are to be added to the code coverage whitelist
* Fixed a bug in `PHPUnit_Runner_Version::series()`
## [5.1.4] - 2016-01-11
### Fixed
* Fixed [#1959](https://github.com/sebastianbergmann/phpunit/issues/1959): Prophecy errors are not handled correctly
### Fixed
## [5.1.3] - 2015-12-10
### Added
* Added support for `Throwable` to `PHPUnit_Framework_TestCase::throwsException()`
## [5.1.2] - 2015-12-07
### Fixed
* Fixed a backwards compatibility break related to the execution order of `@before` and `setUp()` introduced in PHPUnit 5.1.0
## [5.1.1] - 2015-12-07
### Fixed
* Fixed a backwards compatibility break in the `PHPUnit_Framework_TestListener` interface introduced in PHPUnit 5.1.0
## [5.1.0] - 2015-12-04
### Added
* Implemented [#1802](https://github.com/sebastianbergmann/phpunit/issues/1802): Refactor how PHPUnit emits warnings (such as `No tests found in class "Test"`)
* Merged [#1824](https://github.com/sebastianbergmann/phpunit/issues/1824): Added support for the `--CLEAN--` and `--EXPECTREGEX--` sections for PHPT test cases
* Merged [#1825](https://github.com/sebastianbergmann/phpunit/issues/1825): Redirect STDERR to STDOUT when running PHPT test cases
* Merged [#1871](https://github.com/sebastianbergmann/phpunit/issues/1871): Added support for `@testdox` annotations on classes
* Merged [#1917](https://github.com/sebastianbergmann/phpunit/issues/1917): Allow `@coversDefaultClass` annotation to work on traits
[5.1.7]: https://github.com/sebastianbergmann/phpunit/compare/5.1.6...5.1.7
[5.1.6]: https://github.com/sebastianbergmann/phpunit/compare/5.1.5...5.1.6
[5.1.5]: https://github.com/sebastianbergmann/phpunit/compare/5.1.4...5.1.5
[5.1.4]: https://github.com/sebastianbergmann/phpunit/compare/5.1.3...5.1.4
[5.1.3]: https://github.com/sebastianbergmann/phpunit/compare/5.1.2...5.1.3
[5.1.2]: https://github.com/sebastianbergmann/phpunit/compare/5.1.1...5.1.2
[5.1.1]: https://github.com/sebastianbergmann/phpunit/compare/5.1.0...5.1.1
[5.1.0]: https://github.com/sebastianbergmann/phpunit/compare/5.0...5.1.0

61
vendor/phpunit/phpunit/ChangeLog-5.2.md vendored Normal file
View File

@ -0,0 +1,61 @@
# Changes in PHPUnit 5.2
All notable changes of the PHPUnit 5.2 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [5.2.5] - 2016-02-13
### Fixed
* Fixed [#2076](https://github.com/sebastianbergmann/phpunit/issues/2076): Code of custom comparators should not result in a test being marked as risky when PHPUnit is strict about @covers annotation usage
## [5.2.4] - 2016-02-11
### Fixed
* Fixed [#2072](https://github.com/sebastianbergmann/phpunit/issues/2072): Paths in XML configuration file were not handled correctly when they have whitespace around them
## [5.2.3] - 2016-02-08
### Removed
* Removed the implementation of [#1899](https://github.com/sebastianbergmann/phpunit/issues/1899) due to a [bug](https://github.com/sebastianbergmann/php-code-coverage/issues/420) in PHP_CodeCoverage
## [5.2.2] - 2016-02-07
### Removed
* Removed the implementation of [#1902](https://github.com/sebastianbergmann/phpunit/issues/1902) due to [#2042](https://github.com/sebastianbergmann/phpunit/issues/2042)
## [5.2.1] - 2016-02-05
### Fixed
* Fixed [#2060](https://github.com/sebastianbergmann/phpunit/issues/2060): Allow usage of `sebastian/version` in version 1
## [5.2.0] - 2016-02-05
### Added
* Implemented [#1899](https://github.com/sebastianbergmann/phpunit/issues/1899): Mark a test as risky that does not execute the code it wants to test
* Implemented [#1902](https://github.com/sebastianbergmann/phpunit/issues/1902): Mark a test as risky when it performs an assertion on a test double
* Implemented [#1905](https://github.com/sebastianbergmann/phpunit/issues/1905): Add `--fail-on-risky` and `--fail-on-warning` commandline options as well as `failOnRisky` and `failOnWarning` configuration options
* Implemented [#1912](https://github.com/sebastianbergmann/phpunit/issues/1912): Add support for specifying the extension version with the `@requires` annotation
* Implemented [#1977](https://github.com/sebastianbergmann/phpunit/issues/1977): Add support for disabling annotations that control the ignoring of code coverage
* Added `PHPUnit_Framework_TestCase::expectException()`, `PHPUnit_Framework_TestCase::expectExceptionCode()`, `PHPUnit_Framework_TestCase::expectExceptionMessage()`, and `PHPUnit_Framework_TestCase::expectExceptionMessageRegExp()` for programmatically setting expectations for exceptions
### Changed
* Deprecated `PHPUnit_Framework_TestCase::setExpectedException()`
* Deprecated the `checkForUnintentionallyCoveredCode` configuration setting (use `beStrictAboutCoversAnnotation` instead)
### Removed
* The `mapTestClassNameToCoveredClassName` configuration setting has been removed
[5.2.5]: https://github.com/sebastianbergmann/phpunit/compare/5.2.4...5.2.5
[5.2.4]: https://github.com/sebastianbergmann/phpunit/compare/5.2.3...5.2.4
[5.2.3]: https://github.com/sebastianbergmann/phpunit/compare/5.2.2...5.2.3
[5.2.2]: https://github.com/sebastianbergmann/phpunit/compare/5.2.1...5.2.2
[5.2.1]: https://github.com/sebastianbergmann/phpunit/compare/5.2.0...5.2.1
[5.2.0]: https://github.com/sebastianbergmann/phpunit/compare/5.1...5.2.0

View File

@ -0,0 +1,40 @@
<?php
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Constraint that accepts finite.
*
* @since Class available since Release 4.8.0
*/
class PHPUnit_Framework_Constraint_IsFinite extends PHPUnit_Framework_Constraint
{
/**
* Evaluates the constraint for parameter $other. Returns true if the
* constraint is met, false otherwise.
*
* @param mixed $other Value or object to evaluate.
*
* @return bool
*/
protected function matches($other)
{
return is_finite($other);
}
/**
* Returns a string representation of the constraint.
*
* @return string
*/
public function toString()
{
return 'is finite';
}
}

View File

@ -0,0 +1,40 @@
<?php
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Constraint that accepts infinite.
*
* @since Class available since Release 4.8.0
*/
class PHPUnit_Framework_Constraint_IsInfinite extends PHPUnit_Framework_Constraint
{
/**
* Evaluates the constraint for parameter $other. Returns true if the
* constraint is met, false otherwise.
*
* @param mixed $other Value or object to evaluate.
*
* @return bool
*/
protected function matches($other)
{
return is_infinite($other);
}
/**
* Returns a string representation of the constraint.
*
* @return string
*/
public function toString()
{
return 'is infinite';
}
}

View File

@ -0,0 +1,40 @@
<?php
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Constraint that accepts nan.
*
* @since Class available since Release 4.8.0
*/
class PHPUnit_Framework_Constraint_IsNan extends PHPUnit_Framework_Constraint
{
/**
* Evaluates the constraint for parameter $other. Returns true if the
* constraint is met, false otherwise.
*
* @param mixed $other Value or object to evaluate.
*
* @return bool
*/
protected function matches($other)
{
return is_nan($other);
}
/**
* Returns a string representation of the constraint.
*
* @return string
*/
public function toString()
{
return 'is nan';
}
}

View File

@ -0,0 +1,19 @@
<?php
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Extension to PHPUnit_Framework_AssertionFailedError to mark the special
* case of a test that does not execute the code it wants to cover.
*
* @since Class available since Release 5.2.0
*/
class PHPUnit_Framework_CoveredCodeNotExecutedException extends PHPUnit_Framework_RiskyTestError
{
}

View File

@ -0,0 +1,81 @@
<?php
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* A warning.
*
* @since Class available since Release 2.0.0
*/
class PHPUnit_Framework_WarningTestCase extends PHPUnit_Framework_TestCase
{
/**
* @var string
*/
protected $message = '';
/**
* @var bool
*/
protected $backupGlobals = false;
/**
* @var bool
*/
protected $backupStaticAttributes = false;
/**
* @var bool
*/
protected $runTestInSeparateProcess = false;
/**
* @var bool
*/
protected $useErrorHandler = false;
/**
* @param string $message
*/
public function __construct($message = '')
{
$this->message = $message;
parent::__construct('Warning');
}
/**
* @throws PHPUnit_Framework_Exception
*/
protected function runTest()
{
throw new PHPUnit_Framework_Warning($this->message);
}
/**
* @return string
*
* @since Method available since Release 3.0.0
*/
public function getMessage()
{
return $this->message;
}
/**
* Returns a string representation of the test case.
*
* @return string
*
* @since Method available since Release 3.4.0
*/
public function toString()
{
return 'Warning';
}
}

View File

@ -0,0 +1,409 @@
<?php
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use SebastianBergmann\Comparator\ComparisonFailure;
/**
* A TestListener that generates a logfile of the test execution using the
* TeamCity format (for use with PhpStorm, for instance).
*
* @since Class available since Release 5.0.0
*/
class PHPUnit_Util_Log_TeamCity extends PHPUnit_TextUI_ResultPrinter
{
/**
* @var bool
*/
private $isSummaryTestCountPrinted = false;
/**
* @var string
*/
private $startedTestName;
/**
* @var string
*/
private $flowId;
/**
* @param string $progress
*/
protected function writeProgress($progress)
{
}
/**
* @param PHPUnit_Framework_TestResult $result
*/
public function printResult(PHPUnit_Framework_TestResult $result)
{
$this->printHeader();
$this->printFooter($result);
}
/**
* An error occurred.
*
* @param PHPUnit_Framework_Test $test
* @param Exception $e
* @param float $time
*/
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
{
$this->printEvent(
'testFailed',
[
'name' => $test->getName(),
'message' => self::getMessage($e),
'details' => self::getDetails($e),
]
);
}
/**
* A warning occurred.
*
* @param PHPUnit_Framework_Test $test
* @param PHPUnit_Framework_Warning $e
* @param float $time
*
* @since Method available since Release 5.1.0
*/
public function addWarning(PHPUnit_Framework_Test $test, PHPUnit_Framework_Warning $e, $time)
{
$this->printEvent(
'testFailed',
[
'name' => $test->getName(),
'message' => self::getMessage($e),
'details' => self::getDetails($e)
]
);
}
/**
* A failure occurred.
*
* @param PHPUnit_Framework_Test $test
* @param PHPUnit_Framework_AssertionFailedError $e
* @param float $time
*/
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
{
$parameters = [
'name' => $test->getName(),
'message' => self::getMessage($e),
'details' => self::getDetails($e),
];
if ($e instanceof PHPUnit_Framework_ExpectationFailedException) {
$comparisonFailure = $e->getComparisonFailure();
if ($comparisonFailure instanceof ComparisonFailure) {
$expectedString = $comparisonFailure->getExpectedAsString();
if (is_null($expectedString) || empty($expectedString)) {
$expectedString = self::getPrimitiveValueAsString($comparisonFailure->getExpected());
}
$actualString = $comparisonFailure->getActualAsString();
if (is_null($actualString) || empty($actualString)) {
$actualString = self::getPrimitiveValueAsString($comparisonFailure->getActual());
}
if (!is_null($actualString) && !is_null($expectedString)) {
$parameters['actual'] = $actualString;
$parameters['expected'] = $expectedString;
}
}
}
$this->printEvent('testFailed', $parameters);
}
/**
* Incomplete test.
*
* @param PHPUnit_Framework_Test $test
* @param Exception $e
* @param float $time
*/
public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
$this->printIgnoredTest($test->getName(), $e);
}
/**
* Risky test.
*
* @param PHPUnit_Framework_Test $test
* @param Exception $e
* @param float $time
*/
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
$this->addError($test, $e, $time);
}
/**
* Skipped test.
*
* @param PHPUnit_Framework_Test $test
* @param Exception $e
* @param float $time
*/
public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
{
$testName = $test->getName();
if ($this->startedTestName != $testName) {
$this->startTest($test);
$this->printIgnoredTest($testName, $e);
$this->endTest($test, $time);
} else {
$this->printIgnoredTest($testName, $e);
}
}
public function printIgnoredTest($testName, Exception $e)
{
$this->printEvent(
'testIgnored',
[
'name' => $testName,
'message' => self::getMessage($e),
'details' => self::getDetails($e),
]
);
}
/**
* A testsuite started.
*
* @param PHPUnit_Framework_TestSuite $suite
*/
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
{
if (stripos(ini_get('disable_functions'), 'getmypid') === false) {
$this->flowId = getmypid();
} else {
$this->flowId = false;
}
if (!$this->isSummaryTestCountPrinted) {
$this->isSummaryTestCountPrinted = true;
$this->printEvent(
'testCount',
['count' => count($suite)]
);
}
$suiteName = $suite->getName();
if (empty($suiteName)) {
return;
}
$parameters = ['name' => $suiteName];
if (class_exists($suiteName, false)) {
$fileName = self::getFileName($suiteName);
$parameters['locationHint'] = "php_qn://$fileName::\\$suiteName";
} else {
$split = preg_split('/::/', $suiteName);
if (count($split) == 2 && method_exists($split[0], $split[1])) {
$fileName = self::getFileName($split[0]);
$parameters['locationHint'] = "php_qn://$fileName::\\$suiteName";
$parameters['name'] = $split[1];
}
}
$this->printEvent('testSuiteStarted', $parameters);
}
/**
* A testsuite ended.
*
* @param PHPUnit_Framework_TestSuite $suite
*/
public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
{
$suiteName = $suite->getName();
if (empty($suiteName)) {
return;
}
$parameters = ['name' => $suiteName];
if (!class_exists($suiteName, false)) {
$split = preg_split('/::/', $suiteName);
if (count($split) == 2 && method_exists($split[0], $split[1])) {
$parameters['name'] = $split[1];
}
}
$this->printEvent('testSuiteFinished', $parameters);
}
/**
* A test started.
*
* @param PHPUnit_Framework_Test $test
*/
public function startTest(PHPUnit_Framework_Test $test)
{
$testName = $test->getName();
$this->startedTestName = $testName;
$params = ['name' => $testName];
if ($test instanceof PHPUnit_Framework_TestCase) {
$className = get_class($test);
$fileName = self::getFileName($className);
$params['locationHint'] = "php_qn://$fileName::\\$className::$testName";
}
$this->printEvent('testStarted', $params);
}
/**
* A test ended.
*
* @param PHPUnit_Framework_Test $test
* @param float $time
*/
public function endTest(PHPUnit_Framework_Test $test, $time)
{
parent::endTest($test, $time);
$this->printEvent(
'testFinished',
[
'name' => $test->getName(),
'duration' => (int) (round($time, 2) * 1000)
]
);
}
/**
* @param string $eventName
* @param array $params
*/
private function printEvent($eventName, $params = [])
{
$this->write("\n##teamcity[$eventName");
if ($this->flowId) {
$params['flowId'] = $this->flowId;
}
foreach ($params as $key => $value) {
$escapedValue = self::escapeValue($value);
$this->write(" $key='$escapedValue'");
}
$this->write("]\n");
}
/**
* @param Exception $e
*
* @return string
*/
private static function getMessage(Exception $e)
{
$message = '';
if (!$e instanceof PHPUnit_Framework_Exception) {
if (strlen(get_class($e)) != 0) {
$message = $message . get_class($e);
}
if (strlen($message) != 0 && strlen($e->getMessage()) != 0) {
$message = $message . ' : ';
}
}
return $message . $e->getMessage();
}
/**
* @param Exception $e
*
* @return string
*/
private static function getDetails(Exception $e)
{
$stackTrace = PHPUnit_Util_Filter::getFilteredStacktrace($e);
$previous = $e->getPrevious();
while ($previous) {
$stackTrace .= "\nCaused by\n" .
PHPUnit_Framework_TestFailure::exceptionToString($previous) . "\n" .
PHPUnit_Util_Filter::getFilteredStacktrace($previous);
$previous = $previous->getPrevious();
}
return ' ' . str_replace("\n", "\n ", $stackTrace);
}
/**
* @param mixed $value
*
* @return string
*/
private static function getPrimitiveValueAsString($value)
{
if (is_null($value)) {
return 'null';
} elseif (is_bool($value)) {
return $value == true ? 'true' : 'false';
} elseif (is_scalar($value)) {
return print_r($value, true);
}
return;
}
/**
* @param $text
*
* @return string
*/
private static function escapeValue($text)
{
$text = str_replace('|', '||', $text);
$text = str_replace("'", "|'", $text);
$text = str_replace("\n", '|n', $text);
$text = str_replace("\r", '|r', $text);
$text = str_replace(']', '|]', $text);
$text = str_replace('[', '|[', $text);
return $text;
}
/**
* @param string $className
*
* @return string
*/
private static function getFileName($className)
{
$reflectionClass = new ReflectionClass($className);
$fileName = $reflectionClass->getFileName();
return $fileName;
}
}

Some files were not shown because too many files have changed in this diff Show More