Completed
Push — master ( 48605d...525c6d )
by Zbigniew
03:52
created

ApiFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * This file is part of the WrikePhpSdk package.
4
 *
5
 * (c) Zbigniew Ślązak
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Zibios\WrikePhpSdk;
12
13
use Zibios\WrikePhpGuzzle\ClientFactory;
14
use Zibios\WrikePhpJmsserializer\Transformer\Response\ResponseModelTransformer;
15
use Zibios\WrikePhpJmsserializer\SerializerFactory;
16
use Zibios\WrikePhpLibrary\Api;
17
18
/**
19
 * Api Factory
20
 */
21
class ApiFactory
0 ignored issues
show
Coding Style introduced by
ApiFactory does not seem to conform to the naming convention (Utils?$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
22
{
23
    /**
24
     * @return Api
25
     * @throws \InvalidArgumentException
26
     */
27 5
    public static function create()
28 1
    {
29 5
        $client = ClientFactory::create();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 14 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
30 5
        $serializer = SerializerFactory::createSerializer();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
31 5
        $responseTransformer = new ResponseModelTransformer($serializer);
32
33 5
        return new Api($client, $responseTransformer);
34
    }
35
36
    /**
37
     * @param string $bearerToken
38
     *
39
     * @return Api
40
     * @throws \InvalidArgumentException
41
     */
42 4
    public static function createForBearerToken($bearerToken)
43
    {
44 4
        $api = self::create();
45 4
        $api->setBearerToken($bearerToken);
46
47 1
        return $api;
48
    }
49
}
50