BcryptFactory::createService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * @author Stefano Torresi (http://stefanotorresi.it)
4
 * @license See the file LICENSE.txt for copying permission.
5
 * ************************************************
6
 */
7
8
namespace Thorr\OAuth2\Factory;
9
10
use Thorr\OAuth2\Options\ModuleOptions;
11
use Zend\Crypt\Password\Bcrypt;
12
use Zend\ServiceManager\FactoryInterface;
13
use Zend\ServiceManager\ServiceLocatorInterface;
14
15
class BcryptFactory implements FactoryInterface
16
{
17
    /**
18
     * Create service
19
     *
20
     * @param ServiceLocatorInterface $serviceLocator
21
     *
22
     * @return Bcrypt
23
     */
24
    public function createService(ServiceLocatorInterface $serviceLocator)
25
    {
26
        /** @var ModuleOptions $moduleOptions */
27
        $moduleOptions = $serviceLocator->get(ModuleOptions::class);
28
29
        return new Bcrypt(['cost' => $moduleOptions->getBcryptCost()]);
30
    }
31
}
32