Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
25.00% covered (danger)
25.00%
1 / 4
CRAP
50.00% covered (danger)
50.00%
3 / 6
GregorianCalendar
0.00% covered (danger)
0.00%
0 / 1
25.00% covered (danger)
25.00%
1 / 4
13.12
50.00% covered (danger)
50.00%
3 / 6
 format
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 formatDateRepresentation
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 parse
0.00% covered (danger)
0.00%
0 / 1
4.59
66.67% covered (warning)
66.67%
2 / 3
 parseToDateRepresentation
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
<?php
namespace Popy\Calendar\Calendar;
use DateTimeZone;
use DateTimeImmutable;
use RuntimeException;
use DateTimeInterface;
use Popy\Calendar\CalendarInterface;
use Popy\Calendar\ValueObject\DateRepresentationInterface;
/**
 * Basic GregorianCalendar implementation using native php formating.
 */
class GregorianCalendar implements CalendarInterface
{
    /**
     * @inheritDoc
     */
    public function format(DateTimeInterface $input, $format)
    {
        return $input->format($format);
    }
    /**
     * @inheritDoc
     */
    public function formatDateRepresentation(DateRepresentationInterface $input, $format)
    {
        throw new RuntimeException('Not implemented');
    }
    /**
     * @inheritDoc
     */
    public function parse($input, $format, DateTimeZone $timezone = null)
    {
        if ($timezone !== null) {
            return DateTimeImmutable::createFromFormat($format, $input, $timezone) ?: null;
        }
        return DateTimeImmutable::createFromFormat($format, $input) ?: null;
    }
    /**
     * @inheritDoc
     */
    public function parseToDateRepresentation($input, $format, DateTimeZone $timezone = null)
    {
        throw new RuntimeException('Not implemented');
    }
}