Passed
Push — feature/super-model ( 24c950...13c8a0 )
by axel
02:30
created

PeoplePictureModel::getAllInfo()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 7
nc 2
nop 0
dl 0
loc 12
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace MalScraper\Model\Additional;
4
5
use MalScraper\Helper\Helper;
6
use MalScraper\Model\MainModel;
7
8
/**
9
 * PeoplePictureModel class.
10
 */
11
class PeoplePictureModel extends MainModel
12
{
13
    /**
14
     * Id of the people.
15
     *
16
     * @var string|int
17
     */
18
	private $_id;
19
20
    /**
21
     * Default constructor.
22
     *
23
     * @param string|int $id
24
     * @param string $parserArea
25
     *
26
     * @return void
27
     */
28
	public function __construct($id, $parserArea = '#content table tr td')
29
    {
30
    	$this->_id = $id;
31
        $this->_url = $this->_myAnimeListUrl.'/people/'.$id;
32
    	$this->_parserArea = $parserArea;
33
34
        parent::errorCheck($this);
35
    }
36
37
    /**
38
     * Default call.
39
     *
40
     * @param string $method
41
     * @param array  $arguments
42
     *
43
     * @return array|string|int
44
     */
45
    public function __call($method, $arguments)
46
    {
47
        if ($this->_error)
48
            return $this->_error;
49
        return call_user_func_array([$this, $method], $arguments);
50
    }
51
52
    /**
53
     * Get type.
54
     *
55
     * @return string
56
     */
57
    private function getType()
58
    {
59
        return null;
60
    }
61
62
    /**
63
     * Get people id.
64
     *
65
     * @return string
66
     */
67
    private function getId()
68
    {
69
    	return $this->_id;
70
    }
71
72
    /**
73
     * Get people additional pictures.
74
     *
75
     * @return array
76
     */
77
    private function getAllInfo()
78
    {
79
        $data = [];
80
        $picture_table = $this->_parser->find('table', 0);
81
        if ($picture_table) {
82
            foreach ($picture_table->find('img') as $each_picture) {
83
                if ($each_picture) {
84
                    $data[] = $each_picture->src;
85
                }
86
            }
87
        }
88
        return $data;
89
    }
90
}