Applied fixes from StyleCI
This commit is contained in:
parent
741f166640
commit
3a0a7179d4
@ -11,6 +11,7 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
class API extends Exception
|
||||
{
|
||||
public $session;
|
||||
|
@ -9,7 +9,9 @@ See the GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with the MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
/**
|
||||
* Manages connection to telegram servers.
|
||||
*/
|
||||
|
@ -9,7 +9,9 @@ See the GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with the MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
class Crypt
|
||||
{
|
||||
public function ige_encrypt($message, $key, $iv)
|
||||
|
@ -9,9 +9,11 @@ See the GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with the MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
class DebugFunctions {
|
||||
class DebugFunctions
|
||||
{
|
||||
/**
|
||||
* Function to dump the hex version of a string.
|
||||
*
|
||||
|
@ -9,7 +9,9 @@ See the GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with the MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
class Exception extends \Exception
|
||||
{
|
||||
public function __construct($message, $code = 0, Exception $previous = null)
|
||||
@ -21,6 +23,7 @@ class Exception extends \Exception
|
||||
// make sure everything is assigned properly
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
/**
|
||||
* ExceptionErrorHandler.
|
||||
*
|
||||
@ -32,6 +35,6 @@ class Exception extends \Exception
|
||||
if (error_reporting() === 0) {
|
||||
return true; // return true to continue through the others error handlers
|
||||
}
|
||||
throw new Exception($errstr.' on line '.$errline.' of file '.$errfile, $errno);
|
||||
throw new self($errstr.' on line '.$errline.' of file '.$errfile, $errno);
|
||||
}
|
||||
}
|
||||
|
@ -12,10 +12,14 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
/*
|
||||
* Logging class
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto;
|
||||
class Logging {
|
||||
|
||||
class Logging
|
||||
{
|
||||
public $mode = null;
|
||||
public $optional = null;
|
||||
|
||||
/*
|
||||
* Constructor function
|
||||
* Accepts various logging modes:
|
||||
@ -24,11 +28,14 @@ class Logging {
|
||||
* 2 - Log to file defined in second parameter
|
||||
* 3 - Echo logs
|
||||
*/
|
||||
public function __construct($mode, $optional = null){
|
||||
public function __construct($mode, $optional = null)
|
||||
{
|
||||
$this->mode = (string) $mode;
|
||||
$this->optional = $optional;
|
||||
}
|
||||
public function __invoke(...$params){
|
||||
|
||||
public function __invoke(...$params)
|
||||
{
|
||||
foreach ($params as $param) {
|
||||
switch ($this->mode) {
|
||||
case '1':
|
||||
@ -45,7 +52,9 @@ class Logging {
|
||||
}
|
||||
}
|
||||
}
|
||||
public function log(...$params) {
|
||||
|
||||
public function log(...$params)
|
||||
{
|
||||
if ($this->mode == null) {
|
||||
$mode = array_pop($params);
|
||||
} else {
|
||||
|
@ -9,7 +9,9 @@ See the GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with the MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
class PrimeModule
|
||||
{
|
||||
public function __construct()
|
||||
|
@ -9,7 +9,9 @@ See the GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with the MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
class RSA extends TL\TL
|
||||
{
|
||||
public $key; // phpseclib\Crypt\RSA class
|
||||
@ -32,6 +34,7 @@ class RSA extends TL\TL
|
||||
public function encrypt($data)
|
||||
{
|
||||
$bigintdata = new \phpseclib\Math\BigInteger($data, 256);
|
||||
|
||||
return $bigintdata->powMod($this->e, $this->n)->toBytes();
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,9 @@ See the GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with the MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
/**
|
||||
* Manages encryption and message frames.
|
||||
*/
|
||||
@ -40,7 +42,7 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
||||
-----END RSA PUBLIC KEY-----',
|
||||
'logging' => 1,
|
||||
'logging_param' => '/tmp/MadelineProto.log',
|
||||
'logging' => 3
|
||||
'logging' => 3,
|
||||
];
|
||||
foreach ($default_settings as $key => $param) {
|
||||
if (!isset($settings[$key])) {
|
||||
@ -65,9 +67,9 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
||||
$this->tl = new TL\TL(__DIR__.'/TL_schema.JSON');
|
||||
}
|
||||
// Istantiate logging class
|
||||
$this->log = new Logging($this->settings["logging"], $this->settings["logging_param"]);
|
||||
$this->log = new Logging($this->settings['logging'], $this->settings['logging_param']);
|
||||
// Set some defaults
|
||||
$this->auth_key = $this->settings["auth_key"];
|
||||
$this->auth_key = $this->settings['auth_key'];
|
||||
$this->number = 0;
|
||||
$this->timedelta = 0;
|
||||
$this->session_id = \phpseclib\Crypt\Random::string(8);
|
||||
|
@ -9,7 +9,9 @@ See the GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with the MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto\TL;
|
||||
|
||||
class TL
|
||||
{
|
||||
public function __construct($filename)
|
||||
|
@ -9,7 +9,9 @@ See the GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with the MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto\TL;
|
||||
|
||||
class TLConstructor
|
||||
{
|
||||
public function __construct($json_dict)
|
||||
|
@ -9,7 +9,9 @@ See the GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with the MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto\TL;
|
||||
|
||||
class TLMethod
|
||||
{
|
||||
public function __construct($json_dict)
|
||||
|
@ -9,7 +9,9 @@ See the GNU Affero General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with the MadelineProto.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto\TL;
|
||||
|
||||
class TLObject extends \ArrayObject
|
||||
{
|
||||
public function __construct($tl_elem)
|
||||
|
@ -11,6 +11,7 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace danog\MadelineProto;
|
||||
|
||||
/**
|
||||
* Some tools.
|
||||
*/
|
||||
@ -60,6 +61,7 @@ class Tools
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
// taken from mochikit: range( [start,] stop[, step] )
|
||||
public static function range($start, $stop = null, $step = 1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user