| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | declare(strict_types = 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * Contains class DatabaseTimestamp. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 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 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 Michael Cummings | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  * @license   LGPL-3.0+ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | namespace Yapeal\Console\Command; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 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 DatabaseTimestamp. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | class DatabaseTimestamp 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 |  |  |         parent::__construct($name); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     /** @noinspection PhpMissingParentCallCommonInspection */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |      * Executes the current command. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |      * This method is not abstract because you can use this class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |      * as a concrete class. In this case, instead of defining the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |      * execute() method, you set the code to execute by passing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |      * a Closure to the setCode() method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |      * @param InputInterface  $input  An InputInterface instance | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |      * @param OutputInterface $output An OutputInterface instance | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |      * @return null|int null or 0 if everything went fine, or an error code | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      * @see setCode() | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 72 |  |  |      */ | 
            
                                                        
            
                                    
            
            
                | 73 |  |  |     public function execute(InputInterface $input, OutputInterface $output): int | 
            
                                                        
            
                                    
            
            
                | 74 |  |  |     { | 
            
                                                        
            
                                    
            
            
                | 75 |  |  |         list($mSec, $sec) = explode(' ', microtime()); | 
            
                                                        
            
                                    
            
            
                | 76 |  |  |         $output->writeln(gmdate('YmdHis', (int)$sec) . substr($mSec, 1, 4)); | 
            
                                                        
            
                                    
            
            
                | 77 |  |  |         return 0; | 
            
                                                        
            
                                    
            
            
                | 78 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 79 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 80 |  |  |  |