CakeRepository   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A findBySlug() 0 3 1
A findByRegionAndSlug() 0 3 1
1
<?php
2
3
namespace spec\Knp\RadBundle\Resource\Resolver;
4
5
use PhpSpec\ObjectBehavior;
6
use Prophecy\Argument;
7
8
class ExpressionLanguageBasedSpec extends ObjectBehavior
9
{
10
    /**
11
     * @param Symfony\Component\DependencyInjection\ContainerInterface $container
12
     * @param Symfony\Component\HttpFoundation\Request $request
13
     * @param Symfony\Component\HttpFoundation\ParameterBag $attributes
14
     * @param spec\Knp\RadBundle\Resource\Resolver\CakeRepository $cakeRepository
15
     * @param stdClass $cake
16
     */
17
    function let($container, $request, $cakeRepository, $attributes, $cake)
0 ignored issues
show
Unused Code introduced by
The parameter $cake is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19
        $this->beConstructedWith($container);
20
        $container->get('orm.cake_repository')->willReturn($cakeRepository);
21
        $request->attributes = $attributes;
22
    }
23
24
    function its_resolveResource_uses_ExpressionLanguage($request, $attributes, $cake, $cakeRepository)
0 ignored issues
show
Coding Style introduced by
Method name "ExpressionLanguageBasedSpec::its_resolveResource_uses_ExpressionLanguage" is not in camel caps format
Loading history...
25
    {
26
        $attributes->get('test')->willReturn('value!');
27
        $cakeRepository->findBySlug('value!')->shouldBeCalled()->willReturn($cake);
28
        $this->resolveResource($request, array('expr' => "service('orm.cake_repository').findBySlug(request.attributes.get('test'))"))->shouldReturn($cake);
29
    }
30
}
31
32
class CakeRepository
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
33
{
34
    public function findBySlug($slug)
0 ignored issues
show
Unused Code introduced by
The parameter $slug is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
    {
36
    }
37
38
    public function findByRegionAndSlug($region, $slug)
0 ignored issues
show
Unused Code introduced by
The parameter $region is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $slug is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
    {
40
    }
41
}
42