for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Shrikeh\PagerDuty\Entity\ContactMethod\Resource;
use Shrikeh\PagerDuty\Entity\ContactMethod\Resource;
use Shrikeh\PagerDuty\Entity\ContactMethod\Resource\Blacklisted;
use Shrikeh\PagerDuty\Entity\ContactMethod\Resource\Blacklistable;
use Shrikeh\PagerDuty\Entity\ContactMethod\Resource\Type;
final class Sms implements Resource, Blacklistable
{
use Type;
use Blacklisted;
private $countryCode;
private $number;
public function __construct(
$number,
$countryCode,
$enabled,
$blacklisted = false
) {
$this->number = $number;
$this->countryCode = $countryCode;
$this->enabled = $enabled;
enabled
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->blacklisted = $blacklisted;
}
public function __toString()
return $this->render();
public function countryCode()
return $this->countryCode;
public function number()
return $this->number;
public function enabled()
return $this->enabled;
public function render($prependCountryCode = true)
if ($prependCountryCode) {
return sprintf('+%d%d', $this->countryCode, $this->number);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: