1 | <?php |
||
2 | |||
3 | namespace GoogleExt; |
||
4 | |||
5 | use Google_Service_Blogger; |
||
6 | |||
7 | class blogger |
||
8 | { |
||
9 | private $service; |
||
10 | public $posts; |
||
11 | public $blogs; |
||
12 | public $blogid; |
||
13 | |||
14 | /** |
||
15 | * @param \Google\Client|\GoogleExt\client $client |
||
16 | */ |
||
17 | function __construct($client) |
||
18 | { |
||
19 | $this->service = new Google_Service_Blogger($client); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
20 | $this->blogs = $this->service->blogs; |
||
21 | $this->posts = $this->service->posts; |
||
22 | } |
||
23 | |||
24 | function get_blog_byurl(string $url) |
||
0 ignored issues
–
show
|
|||
25 | { |
||
26 | $blog = $this->service->blogs->getByUrl($url); |
||
27 | $this->blogid = $blog->getId(); |
||
28 | return $blog; |
||
29 | } |
||
30 | |||
31 | function list_posts($limit = 5) |
||
0 ignored issues
–
show
|
|||
32 | { |
||
33 | return $this->posts->listPosts($this->blogid, ["maxResults" => $limit]); |
||
34 | } |
||
35 | |||
36 | function set_blog_id($id) |
||
0 ignored issues
–
show
|
|||
37 | { |
||
38 | $this->blogid = $id; |
||
39 | } |
||
40 | } |
||
41 |