for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Defines Ingenerator\Mailhook\Matcher\EmailWithLinkMatcher
*
* @copyright 2014 inGenerator Ltd
* @licence BSD
*/
namespace Ingenerator\Mailhook\Matcher;
use Ingenerator\Mailhook\Email;
use Ingenerator\Mailhook\EmailMatcher;
* Matches an email containing a link - optionally with a particular URL pattern
* @package Ingenerator\Mailhook\Matcher
* @see spec\Ingenerator\Mailhook\Matcher\EmailWithLinkMatcherSpec
class EmailWithLinkMatcher implements EmailMatcher {
* @var string
protected $url_pattern;
* @param string $url_pattern
$url_pattern
string|null
This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.
@param
It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.
public function __construct($url_pattern = NULL)
{
$this->url_pattern = $url_pattern;
}
* {@inheritdoc}
public function matches(Email $email)
if ($this->url_pattern) {
return (bool) $email->getLinksMatching($this->url_pattern);
} else {
return (bool) $email->getLinks();
public function __toString()
if ($this->url_pattern)
return \sprintf('With link matching "%s"', $this->url_pattern);
return 'With any link';
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.