for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BestServedCold\PhalueObjects\DateTime\Unit\Day;
use BestServedCold\PhalueObjects\Contract\DateTime as DateTimeInterface;
use BestServedCold\PhalueObjects\DateTime\DateTimeTrait;
use BestServedCold\PhalueObjects\Mathematical\Integer;
/**
* Class Week
*
* @package BestServedCold\PhalueObjects\DateTime\Unit\Day
* @author Adam Lewis <[email protected]>
* @copyright Copyright (c) 2015 Best Served Cold Media Limited
* @license http://http://opensource.org/licenses/GPL-3.0 GPL License
* @link http://bestservedcold.com
* @since 0.0.1-alpha
* @version 0.0.2-alpha
*/
final class Week extends Integer implements DateTimeInterface
{
use DateTimeTrait;
* @param integer $value
public function __construct($value)
parent::__construct($value);
}
* @return static
public static function now()
return new static(static::getNowDateTimeFormat('N'));
* From String.
* @param $string
public static function fromString($string)
return ctype_digit($string)
? new static((int) $string)
: self::fromNative(new \DateTime($string));
* From Native
* @param \DateTime $native
* @return DateTimeInterface
public static function fromNative(\DateTime $native)
return new static((int) $native->format('N'));
* @return int
public function getMaximum()
return 7;
public function getMinimum()
return 1;