Completed
Push — master ( b5c7fa...23b509 )
by Taosikai
13:59
created

ClosureNamer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 17
c 0
b 0
f 0
wmc 2
lcom 1
cbo 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A generate() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the slince/upload package.
5
 *
6
 * (c) Slince <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Slince\Upload\Naming;
13
14
use Symfony\Component\HttpFoundation\File\UploadedFile;
15
16
class ClosureNamer implements NamerInterface
17
{
18
    protected $closure;
19
20
    public function __construct(\Closure $closure)
21
    {
22
        $this->closure = $closure;
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function generate(UploadedFile $file)
29
    {
30
        return call_user_func($this->closure, $file);
31
    }
32
}