Issues (994)

src/GoogleExt/blogger.php (4 issues)

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
It seems like $client can also be of type GoogleExt\client; however, parameter $client of Google_Service_Blogger::__construct() does only seem to accept Google_Client, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

19
    $this->service = new Google_Service_Blogger(/** @scrutinizer ignore-type */ $client);
Loading history...
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
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
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
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
32
  {
33
    return $this->posts->listPosts($this->blogid, ["maxResults" => $limit]);
34
  }
35
36
  function set_blog_id($id)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
37
  {
38
    $this->blogid = $id;
39
  }
40
}
41