1 | <?php |
||
28 | class Order extends Attribute |
||
29 | { |
||
30 | const JSAPI = 'JSAPI'; |
||
31 | const NATIVE = 'NATIVE'; |
||
32 | const APP = 'APP'; |
||
33 | const MICROPAY = 'MICROPAY'; |
||
34 | |||
35 | protected $attributes = [ |
||
36 | 'body', |
||
37 | 'detail', |
||
38 | 'attach', |
||
39 | 'out_trade_no', |
||
40 | 'fee_type', |
||
41 | 'total_fee', |
||
42 | 'spbill_create_ip', |
||
43 | 'time_start', |
||
44 | 'time_expire', |
||
45 | 'goods_tag', |
||
46 | 'notify_url', |
||
47 | 'trade_type', |
||
48 | 'product_id', |
||
49 | 'limit_pay', |
||
50 | 'openid', |
||
51 | 'sub_openid', |
||
52 | 'auth_code', |
||
53 | ]; |
||
54 | |||
55 | /** |
||
56 | * Constructor. |
||
57 | * |
||
58 | * @param array $attributes |
||
59 | */ |
||
60 | 2 | public function __construct(array $attributes) |
|
66 | } |
||
67 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: