Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ sudo: required
language: php

addons:
mariadb: 10.1
mariadb: 10.1

cache:
directories:
- $HOME/.composer/cache
- "$HOME/.composer/cache"

matrix:
include:
Expand Down Expand Up @@ -39,10 +39,10 @@ before_script:
script:
- composer check-code
- if [[ "$COVERAGE" == "1" ]] ; then composer test-cov-live; fi
- if [[ "$COVERAGE" != "1" ]] ; then composer test-live; fi
- if [[ "$COVERAGE" != "1" ]] ; then composer test; fi

after_success:
- if [[ "$COVERAGE" == "1" ]]; then bash <(curl -s https://codecov.io/bash); fi
- if [[ "$COVERAGE" == "1" ]]; then composer test-cov-upload; fi

env:
global:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

## [0.43.0] - 2017-04-17
### Added
- PHP CodeSniffer introduced and cleaned code to pass tests.
- Custom exceptions for better error handling.
- Request limiter options.

## [0.42.0.1] - 2017-04-11
### Added
- Changelog.
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Installation and usage is pretty straight forward:
Either run this command in your command line:

```bash
composer require noplanman/telegram-bot-manager:^0.42
composer require noplanman/telegram-bot-manager:^0.43
```

**or**
Expand All @@ -29,7 +29,7 @@ For existing Composer projects, edit your project's `composer.json` file to requ

```yaml
"require": {
"noplanman/telegram-bot-manager": "^0.42"
"noplanman/telegram-bot-manager": "^0.43"
}
```
and then run `composer update`
Expand Down Expand Up @@ -161,14 +161,14 @@ Here is a list of available extra parameters:
| *string* | *e.g.* `'https://example.com/manager.php'` |
| certificate | Path to a self-signed certificate (if necessary). |
| *string* | *e.g.* `__DIR__ . '/server.crt'` |
| max_connections | Maximum allowed simultaneous HTTPS connections to the webhook |
| max_connections | Maximum allowed simultaneous HTTPS connections to the webhook. |
| *int* | *e.g.* `20` |
| allowed_updates | List the types of updates you want your bot to receive |
| allowed_updates | List the types of updates you want your bot to receive. |
| *array* | *e.g.* `['message', 'edited_channel_post', 'callback_query']` |
| logging | Path(s) where to the log files should be put. This is an array that can contain all 3 log file paths (`error`, `debug` and `update`). |
| *array* | *e.g.* `['error' => __DIR__ . '/php-telegram-bot-error.log']` |
| limiter | Enable or disable the limiter functionality |
| *bool* | *e.g.* `true` or `false` |
| limiter | Enable or disable the limiter functionality, also accepts options array. |
| *bool|array* | *e.g.* `true` or `false` or `['interval' => 2]` |
| admins | An array of user ids that have admin access to your bot. |
| *array* | *e.g.* `[12345]` |
| mysql | Mysql credentials to connect a database (necessary for [`getUpdates`](#using-getupdates-method) method!). |
Expand Down
19 changes: 12 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
],
"require": {
"php": "^7.0",
"longman/telegram-bot": "^0.42"
"longman/telegram-bot": "^0.43"
},
"require-dev": {
"jakub-onderka/php-parallel-lint": "^0.9.2",
"phpunit/phpunit": "^6.1"
"phpunit/phpunit": "^6.1",
"squizlabs/php_codesniffer": "^2.8"
},
"autoload": {
"psr-4": {
Expand All @@ -37,19 +38,23 @@
},
"scripts": {
"check-code": [
"parallel-lint . --exclude vendor"
"vendor/bin/parallel-lint . --exclude vendor",
"vendor/bin/phpcs --standard=psr2 src/ tests/ -snp --encoding=utf-8 --report-width=150"
],
"test": [
"phpunit --exclude-group live"
"vendor/bin/phpunit --exclude-group live"
],
"test-live": [
"phpunit"
"vendor/bin/phpunit"
],
"test-cov": [
"phpunit --coverage-clover=coverage.xml --exclude-group live"
"vendor/bin/phpunit --coverage-clover=coverage.xml --exclude-group live"
],
"test-cov-live": [
"phpunit --coverage-clover=coverage.xml"
"vendor/bin/phpunit --coverage-clover=coverage.xml"
],
"test-cov-upload": [
"curl -s https://codecov.io/bash | bash"
]
}
}
122 changes: 100 additions & 22 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace NPM\TelegramBotManager;

use NPM\TelegramBotManager\Exception\InvalidActionException;

class Action
{
/**
Expand All @@ -32,14 +34,14 @@ class Action
*
* @param string $action
*
* @throws \InvalidArgumentException
* @throws \NPM\TelegramBotManager\Exception\InvalidActionException
*/
public function __construct($action = 'handle')
{
$this->action = $action ?: 'handle';

if (!$this->isAction(self::$valid_actions)) {
throw new \InvalidArgumentException('Invalid action: ' . $this->action);
throw new InvalidActionException('Invalid action: ' . $this->action);
}
}

Expand Down
Loading