Skip to content

Commit

Permalink
Refactoring and docs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
iGusev committed Dec 12, 2015
1 parent 4d54469 commit ae0a3d1
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/BaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ abstract class BaseType
* Validate input data
*
* @param array $data
*
* @return bool
*
* @throws InvalidArgumentException
*/
public static function validate($data)
{
Expand Down
2 changes: 2 additions & 0 deletions src/BotApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ public function getUserProfilePhotos($userId, $offset = 0, $limit = 100)
* @param \CURLFile|string $certificate Upload your public key certificate
* so that the root certificate in use can be checked
*
* @return string
*
* @throws \TelegramBot\Api\Exception
*/
public function setWebhook($url = '', $certificate = null)
Expand Down
4 changes: 4 additions & 0 deletions src/Types/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public function getLatitude()

/**
* @param float $latitude
*
* @throws InvalidArgumentException
*/
public function setLatitude($latitude)
{
Expand All @@ -75,6 +77,8 @@ public function getLongitude()

/**
* @param float $longitude
*
* @throws InvalidArgumentException
*/
public function setLongitude($longitude)
{
Expand Down
6 changes: 6 additions & 0 deletions src/Types/PhotoSize.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public function getFileSize()

/**
* @param int $fileSize
*
* @throws InvalidArgumentException
*/
public function setFileSize($fileSize)
{
Expand All @@ -107,6 +109,8 @@ public function getHeight()

/**
* @param int $height
*
* @throws InvalidArgumentException
*/
public function setHeight($height)
{
Expand All @@ -127,6 +131,8 @@ public function getWidth()

/**
* @param int $width
*
* @throws InvalidArgumentException
*/
public function setWidth($width)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Types/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Update extends BaseType implements TypeInterface
*/
static protected $map = [
'update_id' => true,
'message' => \TelegramBot\Api\Types\Message::class,
'message' => Message::class,
];

/**
Expand All @@ -37,7 +37,7 @@ class Update extends BaseType implements TypeInterface
/**
* Optional. New incoming message of any kind — text, photo, sticker, etc.
*
* @var \TelegramBot\Api\Types\Message
* @var Message
*/
protected $message;

Expand Down Expand Up @@ -68,7 +68,7 @@ public function getMessage()
/**
* @param Message $message
*/
public function setMessage($message)
public function setMessage(Message $message)
{
$this->message = $message;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Types/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public function getId()

/**
* @param int $id
*
* @throws InvalidArgumentException
*/
public function setId($id)
{
Expand Down
4 changes: 3 additions & 1 deletion src/Types/UserProfilePhotos.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class UserProfilePhotos extends BaseType implements TypeInterface
*/
static protected $map = [
'total_count' => true,
'photos' => \TelegramBot\Api\Types\ArrayOfArrayOfPhotoSize::class,
'photos' => ArrayOfArrayOfPhotoSize::class,
];

/**
Expand Down Expand Up @@ -72,6 +72,8 @@ public function getTotalCount()

/**
* @param int $totalCount
*
* @throws InvalidArgumentException
*/
public function setTotalCount($totalCount)
{
Expand Down
12 changes: 10 additions & 2 deletions src/Types/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Video extends BaseType implements TypeInterface
'width' => true,
'height' => true,
'duration' => true,
'thumb' => \TelegramBot\Api\Types\PhotoSize::class,
'thumb' => PhotoSize::class,
'mime_type' => true,
'file_size' => true
];
Expand Down Expand Up @@ -67,7 +67,7 @@ class Video extends BaseType implements TypeInterface
/**
* Video thumbnail
*
* @var \TelegramBot\Api\Types\PhotoSize
* @var PhotoSize
*/
protected $thumb;

Expand Down Expand Up @@ -96,6 +96,8 @@ public function getDuration()

/**
* @param int $duration
*
* @throws InvalidArgumentException
*/
public function setDuration($duration)
{
Expand Down Expand Up @@ -132,6 +134,8 @@ public function getFileSize()

/**
* @param int $fileSize
*
* @throws InvalidArgumentException
*/
public function setFileSize($fileSize)
{
Expand All @@ -152,6 +156,8 @@ public function getHeight()

/**
* @param int $height
*
* @throws InvalidArgumentException
*/
public function setHeight($height)
{
Expand Down Expand Up @@ -204,6 +210,8 @@ public function getWidth()

/**
* @param int $width
*
* @throws InvalidArgumentException
*/
public function setWidth($width)
{
Expand Down
4 changes: 4 additions & 0 deletions src/Types/Voice.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public function getDuration()

/**
* @param int $duration
*
* @throws InvalidArgumentException
*/
public function setDuration($duration)
{
Expand Down Expand Up @@ -123,6 +125,8 @@ public function getFileSize()

/**
* @param int $fileSize
*
* @throws InvalidArgumentException
*/
public function setFileSize($fileSize)
{
Expand Down

0 comments on commit ae0a3d1

Please sign in to comment.