sscarpa / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
Apache License 2.0
0 stars 0 forks source link

Improvement > Countable interface in apiModel class #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The implementation of the Countable interface in apiModel class should be done 
this way (based on r240) :

  public function count()
  {
    if (null === $this->items || 0 == ($nbItems = count($this->items)))
    {
      return 1;
    }

    return $nbItems;
  }

I guess the apiModel class should be made abstract as well !

Original issue reported on code.google.com by x.cour...@gmail.com on 10 Oct 2011 at 11:11

GoogleCodeExporter commented 8 years ago
Errrrrr, should work better this way :

  public function count()
  {
    if (null === $this->items)
    {
      return 1;
    }

    return count($this->items);
  }

Original comment by x.cour...@gmail.com on 10 Oct 2011 at 11:15

GoogleCodeExporter commented 8 years ago
Hi,

Where are you seeing a Countable interface in apiModel?

Original comment by chirags@google.com on 11 Oct 2011 at 12:33

GoogleCodeExporter commented 8 years ago
This is not done but I guess it should be something nice to implement ... ! :-)

Original comment by x.cour...@gmail.com on 11 Oct 2011 at 12:37

GoogleCodeExporter commented 8 years ago
Please reopen if this is still valuable for you.

Original comment by ianbar...@google.com on 22 Mar 2013 at 1:38