Completed
Push — 23 ( 2cbb94...e876bd )
by Harald
11:26 queued 05:21
created

AchMandate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 5 1
A _initialize() 0 7 1
A factory() 0 7 1
1
<?php
2
namespace Braintree;
3
4
/**
5
 * Braintree AchMandate module
6
 * PHP Version 5
7
 *
8
 * @package   Braintree
9
 * @copyright 2015 Braintree, a division of PayPal, Inc.
10
 *
11
 * @property-read string $text
12
 * @property-read string $acceptedAt
13
 */
14
class AchMandate extends Base
15
{
16
    /**
17
     * create a printable representation of the object as:
18
     * ClassName[property=value, property=value]
19
     * @ignore
20
     * @return string
21
     */
22
    public function  __toString()
23
    {
24
        return __CLASS__ . '[' .
25
                Util::attributesToString($this->_attributes) . ']';
26
    }
27
28
    /**
29
     * sets instance properties from an array of values
30
     *
31
     * @ignore
32
     * @access protected
33
     * @param array $achAttribs array of achMandate data
34
     * @return void
35
     */
36
    protected function _initialize($achAttribs)
37
    {
38
        // set the attributes
39
        $this->_attributes = $achAttribs;
40
        $date = new \DateTime($this->acceptedAt);
41
        $this->_set('acceptedAt', $date);
42
    }
43
44
    /**
45
     *  factory method: returns an instance of AchMandate
46
     *  to the requesting method, with populated properties
47
     * @ignore
48
     * @return AchMandate
49
     */
50
    public static function factory($attributes)
51
    {
52
        $instance = new self();
53
        $instance->_initialize($attributes);
54
        return $instance;
55
56
    }
57
}
58
class_alias('Braintree\AchMandate', 'Braintree_Mandate');
59