GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

DateTimeElementFactory::createService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
ccs 7
cts 7
cp 1
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
crap 1
1
<?php
2
/*
3
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
5
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
6
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
7
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
8
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9
 */
10
11
namespace MpaCustomDoctrineHydrator\Factory;
12
13
use Locale;
14
use MpaCustomDoctrineHydrator\Form\Element\DateTime;
15
use Zend\Form\FormElementManager;
16
use Zend\ServiceManager\FactoryInterface;
17
use Zend\ServiceManager\ServiceLocatorInterface;
18
19
class DateTimeElementFactory implements FactoryInterface
20
{
21
    /**
22
     * Create service
23
     *
24
     * @param  ServiceLocatorInterface $serviceLocator
25
     * @return DateTime
26
     */
27 6
    public function createService(ServiceLocatorInterface $serviceLocator)
28
    {
29
        /** @var $serviceLocator FormElementManager */
30 6
        $parentLocator = $serviceLocator->getServiceLocator();
31 6
        $config        = $parentLocator->get('Config')['mpacustomdoctrinehydrator']['formats'][Locale::getDefault()];
32
33 6
        $formElement = new DateTime();
34 6
        $formElement->setFormat($config['datetime_format']);
35 6
        $formElement->setAttribute('placeholder', $config['datetime_placeholder']);
36
37 6
        return $formElement;
38
    }
39
}
40