PaymentPage::addProducts()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 6
c 1
b 0
f 0
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Digikraaft\Paystack;
4
5
class PaymentPage extends ApiResource
6
{
7
    const OBJECT_NAME = 'page';
8
9
    use ApiOperations\All;
10
    use ApiOperations\Create;
11
    use ApiOperations\Fetch;
12
    use ApiOperations\Update;
13
14
    /**
15
     * @param string $slug details at
16
     *
17
     * @link https://paystack.com/docs/api/#page-check-slug
18
     *
19
     * @return array|object
20
     */
21
    public static function checkSlugAvailability($slug)
22
    {
23
        $slug = 'check_slug_availability/'.$slug;
24
        $url = static::endPointUrl($slug);
25
26
        return static::staticRequest('GET', $url);
27
    }
28
29
    /**
30
     * @param string $page_id
31
     * @param array  $params  details at
32
     *
33
     * @link https://paystack.com/docs/api/#page-add-products
34
     *
35
     * @return array|object
36
     */
37
    public static function addProducts($page_id, $params)
38
    {
39
        self::validateParams($params, true);
40
        $url = static::resourceUrl($page_id).'/product';
41
42
        return static::staticRequest('POST', $url);
43
    }
44
}
45