Skip to content

Commit

Permalink
Refactor, testing
Browse files Browse the repository at this point in the history
  • Loading branch information
punyflash committed Sep 2, 2020
1 parent 12d44a1 commit 3325670
Show file tree
Hide file tree
Showing 87 changed files with 606 additions and 394 deletions.
6 changes: 3 additions & 3 deletions docs/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The sub-object's types are automaticaly casted when you create a new object inst
#### ** Input **

```php
$keyboard = \WeStacks\TeleBot\TelegramObject\Keyboard::create([
$keyboard = \WeStacks\TeleBot\Objects\Keyboard::create([
'inline_keyboard' => [[
[
'text' => 'Google',
Expand All @@ -24,10 +24,10 @@ var_dump($keyboard);
#### ** Output **

```php
object(WeStacks\TeleBot\TelegramObject\Keyboard\InlineKeyboardMarkup)#448 (1) {
object(WeStacks\TeleBot\Objects\Keyboard\InlineKeyboardMarkup)#448 (1) {
["inline_keyboard"] => array(1) {
[0] => array(1) {
[0] => object(WeStacks\TeleBot\TelegramObject\InlineKeyboardButton)#447 (2) {
[0] => object(WeStacks\TeleBot\Objects\InlineKeyboardButton)#447 (2) {
["text"] => string(6) "Google"
["url"] => string(19) "https://google.com/"
}
Expand Down
4 changes: 2 additions & 2 deletions src/Bot.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use WeStacks\TeleBot\Exception\TeleBotMehtodException;
use WeStacks\TeleBot\Exception\TeleBotObjectException;
use WeStacks\TeleBot\TelegramObject\User;
use WeStacks\TeleBot\TelegramObject\Message;
use WeStacks\TeleBot\Objects\User;
use WeStacks\TeleBot\Objects\Message;
use WeStacks\TeleBot\TelegramMethod\GetMeMethod;
use WeStacks\TeleBot\TelegramMethod\SendMessageMethod;
use WeStacks\TeleBot\TelegramMethod\SendPhotoMethod;
Expand Down
5 changes: 0 additions & 5 deletions src/Exception/TeleBotObjectException.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,4 @@ public static function configKeyIsRequired(string $key, string $class)
{
return new TeleBotObjectException("Required key \"$key\" is not specified for \"$class\"");
}

public static function objectBuiltWrong(string $message, string $class)
{
return new TeleBotObjectException("Unable to create \"$class\" instance. ".$message, 400);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -17,7 +17,7 @@
* @property String $mime_type _Optional_. MIME type of the file as defined by sender
* @property Integer $file_size _Optional_. File size
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class Animation extends TelegramObject
Expand Down
4 changes: 2 additions & 2 deletions src/TelegramObject/Audio.php → src/Objects/Audio.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -16,7 +16,7 @@
* @property Integer $file_size _Optional_. File size
* @property PhotoSize $thumb _Optional_. Thumbnail of the album cover to which the music file belongs
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class Audio extends TelegramObject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -10,7 +10,7 @@
* @property String $command Text of the command, 1-32 characters. Can contain only lowercase English letters, digits and underscores.
* @property String $description Description of the command, 3-256 characters.
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class BotCommand extends TelegramObject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -15,7 +15,7 @@
* @property String $data _Optional_. Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field.
* @property String $game_short_name _Optional_. Short name of a Game to be returned, serves as the unique identifier for the game
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class CallbackQuery extends TelegramObject
Expand Down
4 changes: 2 additions & 2 deletions src/TelegramObject/Chat.php → src/Objects/Chat.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -22,7 +22,7 @@
* @property String $sticker_set_name _Optional_. For supergroups, name of group sticker set. Returned only in getChat.
* @property Boolean $can_set_sticker_set _Optional_. True, if the bot can change the group sticker set. Returned only in getChat.
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class Chat extends TelegramObject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -27,7 +27,7 @@
* @property Boolean $can_send_other_messages _Optional_. Restricted only. True, if the user is allowed to send animations, games, stickers and use inline bots
* @property Boolean $can_add_web_page_previews _Optional_. Restricted only. True, if the user is allowed to add web page previews to their messages
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class ChatMember extends TelegramObject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -16,7 +16,7 @@
* @property Boolean $can_invite_users _Optional_. True, if the user is allowed to invite new users to the chat
* @property Boolean $can_pin_messages _Optional_. True, if the user is allowed to pin messages. Ignored in public supergroups
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class ChatPermissions extends TelegramObject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -12,7 +12,7 @@
* @property String $big_file_id File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.
* @property String $big_file_unique_id Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class ChatPhoto extends TelegramObject
Expand Down
4 changes: 2 additions & 2 deletions src/TelegramObject/Contact.php → src/Objects/Contact.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -13,7 +13,7 @@
* @property Integer $user_id _Optional_. Contact's user identifier in Telegram
* @property String $vcard _Optional_. Additional data about the contact in the form of a vCard
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class Contact extends TelegramObject
Expand Down
4 changes: 2 additions & 2 deletions src/TelegramObject/Dice.php → src/Objects/Dice.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -10,7 +10,7 @@
* @property String $emoji Emoji on which the dice throw animation is based
* @property Integer $value Value of the dice, 1-6 for “🎲” and “🎯” base emoji, 1-5 for “🏀” base emoji
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class Dice extends TelegramObject
Expand Down
4 changes: 2 additions & 2 deletions src/TelegramObject/Document.php → src/Objects/Document.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -14,7 +14,7 @@
* @property String $mime_type _Optional_. MIME type of the file as defined by sender
* @property Integer $file_size _Optional_. File size
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class Document extends TelegramObject
Expand Down
4 changes: 2 additions & 2 deletions src/TelegramObject/File.php → src/Objects/File.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -13,7 +13,7 @@
* @property Integer $file_size _Optional_. File size, if known
* @property String $file_path _Optional_. File path. Use "_https://api.telegram.org/file/bot<token\>/\<file_path\>_" to get the file.
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class File extends TelegramObject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace WeStacks\TeleBot\TelegramObject\Games;
namespace WeStacks\TeleBot\Objects\Games;

use WeStacks\TeleBot\TelegramObject;

/**
* A placeholder, currently holds no information. Use BotFather to set up your game.
*
* @package WeStacks\TeleBot\TelegramObject\Games
* @package WeStacks\TeleBot\Objects\Games
*/
class CallbackGame extends TelegramObject
{
Expand Down
10 changes: 5 additions & 5 deletions src/TelegramObject/Games/Game.php → src/Objects/Games/Game.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace WeStacks\TeleBot\TelegramObject\Games;
namespace WeStacks\TeleBot\Objects\Games;

use WeStacks\TeleBot\TelegramObject\Animation;
use WeStacks\TeleBot\TelegramObject\MessageEntity;
use WeStacks\TeleBot\TelegramObject\PhotoSize;
use WeStacks\TeleBot\Objects\Animation;
use WeStacks\TeleBot\Objects\MessageEntity;
use WeStacks\TeleBot\Objects\PhotoSize;
use WeStacks\TeleBot\TelegramObject;

/**
Expand All @@ -17,7 +17,7 @@
* @property Array<MessageEntity> $text_entities _Optional_. Special entities that appear in text, such as usernames, URLs, bot commands, etc.
* @property Animation $animation _Optional_. Animation that will be displayed in the game message in chats. Upload via BotFather
*
* @package WeStacks\TeleBot\TelegramObject\Games
* @package WeStacks\TeleBot\Objects\Games
*/
class Game extends TelegramObject
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace WeStacks\TeleBot\TelegramObject\Games;
namespace WeStacks\TeleBot\Objects\Games;

use WeStacks\TeleBot\TelegramObject;
use WeStacks\TeleBot\TelegramObject\User;
use WeStacks\TeleBot\Objects\User;

/**
* This object represents one row of the high scores table for a game.
Expand All @@ -12,7 +12,7 @@
* @property User $user User
* @property Integer $score Score
*
* @package WeStacks\TeleBot\TelegramObject\Games
* @package WeStacks\TeleBot\Objects\Games
*/
class GameHighScore extends TelegramObject
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;
use WeStacks\TeleBot\TelegramObject\Games\CallbackGame;
use WeStacks\TeleBot\Objects\Games\CallbackGame;

/**
* This object represents one button of an inline keyboard. You must use exactly one of the optional fields.
Expand All @@ -17,7 +17,7 @@
* @property CallbackGame $callback_game _Optional_. Description of the game that will be launched when the user presses the button. NOTE: This type of button must always be the first button in the first row.
* @property Boolean $pay _Optional_. Specify True, to send a Pay button. NOTE: This type of button must always be the first button in the first row.
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class InlineKeyboardButton extends TelegramObject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace WeStacks\TeleBot\TelegramObject;
namespace WeStacks\TeleBot\Objects;

use WeStacks\TeleBot\TelegramObject;

Expand All @@ -13,7 +13,7 @@
* @property String &query Text of the query (up to 256 characters)
* @property String &offset Offset of the results to be returned, can be controlled by the bot
*
* @package WeStacks\TeleBot\TelegramObject
* @package WeStacks\TeleBot\Objects
*/

class InlineQuery extends TelegramObject
Expand Down

0 comments on commit 3325670

Please sign in to comment.