AbstractQuery   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
1
<?php
2
/**
3
 * Created by Carl Owens ([email protected])
4
 * Company: PartFire Ltd (www.partfire.co.uk)
5
 * Copyright © 2016 PartFire Ltd. All rights reserved.
6
 *
7
 * User:    Carl Owens
8
 * Date:    27/11/2016
9
 * Time:    21:12
10
 * File:    AbstractQuery.php
11
 **/
12
13
namespace PartFire\MangoPayBundle\Models\Adapters;
14
15
use MangoPay\MangoPayApi;
16
use Monolog\Handler\StreamHandler;
17
use Symfony\Bridge\Monolog\Logger;
18
19
abstract class AbstractQuery
20
{
21
    /**
22
     * @var MangoPayApi
23
     */
24
    protected $mangoPayApi;
25
    /**
26
     * @var Logger
27
     */
28
    protected $logger;
29
30
    public function __construct($clientId, $clientPassword, $baseUrl, MangoPayApi $mangoPayApi, Logger $logger)
31
    {
32
        $this->logger = $logger;
33
        $path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR. '..' . DIRECTORY_SEPARATOR. '..' . DIRECTORY_SEPARATOR. '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR. 'var/logs/mangopay.log';
34
        $this->logger->pushHandler(new StreamHandler($path, Logger::DEBUG));
35
36
        $this->mangoPayApi = $mangoPayApi;
37
        $this->mangoPayApi->Config->ClientId = $clientId;
38
        $this->mangoPayApi->Config->ClientPassword = $clientPassword;
39
        $this->mangoPayApi->Config->BaseUrl = $baseUrl;
40
        $this->mangoPayApi->Config->TemporaryFolder = sys_get_temp_dir();
41
        $this->mangoPayApi->setLogger($this->logger);
42
    }
43
}
44