Completed
Push — master ( b659c5...c65770 )
by Michael
10:22
created

SchemaTimestamp   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 37
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A execute() 0 6 1
1
<?php
2
declare(strict_types = 1);
3
/**
4
 * Contains class SchemaTimestamp.
5
 *
6
 * PHP version 7.0+
7
 *
8
 * LICENSE:
9
 * This file is part of Yet Another Php Eve Api Library also know as Yapeal
10
 * which can be used to access the Eve Online API data and place it into a
11
 * database.
12
 * Copyright (C) 2016-2017 Michael Cummings
13
 *
14
 * This program is free software: you can redistribute it and/or modify it
15
 * under the terms of the GNU Lesser General Public License as published by the
16
 * Free Software Foundation, either version 3 of the License, or (at your
17
 * option) any later version.
18
 *
19
 * This program is distributed in the hope that it will be useful, but WITHOUT
20
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
22
 * for more details.
23
 *
24
 * You should have received a copy of the GNU Lesser General Public License
25
 * along with this program. If not, see
26
 * <http://spdx.org/licenses/LGPL-3.0.html>.
27
 *
28
 * You should be able to find a copy of this license in the COPYING-LESSER.md
29
 * file. A copy of the GNU GPL should also be available in the COPYING.md file.
30
 *
31
 * @author    Michael Cummings <[email protected]>
32
 * @copyright 2016-2017 Michael Cummings
33
 * @license   LGPL-3.0+
34
 */
35
namespace Yapeal\Console\Schema;
36
37
use Symfony\Component\Console\Command\Command;
38
use Symfony\Component\Console\Input\InputInterface;
39
use Symfony\Component\Console\Output\OutputInterface;
40
41
/**
42
 * Class SchemaTimestamp.
43
 */
44
class SchemaTimestamp extends Command
45
{
46
    /**
47
     * Constructor.
48
     *
49
     * @param string|null $name The name of the command; passing null means it must be set in configure()
50
     *
51
     * @throws \LogicException When the command name is empty
52
     */
53
    public function __construct(string $name = null)
54
    {
55
        $this->setDescription('Prints Yapeal style timestamp for the current time');
56
        parent::__construct($name);
57
    }
58
    /** @noinspection PhpMissingParentCallCommonInspection */
59
    /**
60
     * Executes the current command.
61
     *
62
     * This method is not abstract because you can use this class
63
     * as a concrete class. In this case, instead of defining the
64
     * execute() method, you set the code to execute by passing
65
     * a Closure to the setCode() method.
66
     *
67
     * @param InputInterface  $input  An InputInterface instance
68
     * @param OutputInterface $output An OutputInterface instance
69
     *
70
     * @return null|int null or 0 if everything went fine, or an error code
71
     *
72
     * @see setCode()
73
     */
74
    public function execute(InputInterface $input, OutputInterface $output): int
75
    {
76
        list($mSec, $sec) = explode(' ', microtime());
77
        $output->writeln(gmdate('YmdHis', (int)$sec) . substr($mSec, 1, 4));
78
        return 0;
79
    }
80
}
81