| Total Complexity | 4 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 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); |
||
|
|
|||
| 20 | $this->blogs = $this->service->blogs; |
||
| 21 | $this->posts = $this->service->posts; |
||
| 22 | } |
||
| 23 | |||
| 24 | function get_blog_byurl(string $url) |
||
| 25 | { |
||
| 26 | $blog = $this->service->blogs->getByUrl($url); |
||
| 27 | $this->blogid = $blog->getId(); |
||
| 28 | return $blog; |
||
| 29 | } |
||
| 30 | |||
| 31 | function list_posts($limit = 5) |
||
| 32 | { |
||
| 33 | return $this->posts->listPosts($this->blogid, ["maxResults" => $limit]); |
||
| 34 | } |
||
| 35 | |||
| 36 | function set_blog_id($id) |
||
| 39 | } |
||
| 40 | } |
||
| 41 |