PHP Classes

File: src/Response.php

Recommend this page to a friend!
  Classes of Joseluis Laso   PHP Telegram CLI Wrapper   src/Response.php   Download  
File: src/Response.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Telegram CLI Wrapper
Send messages and other commands to Telegram users
Author: By
Last change:
Date: 8 years ago
Size: 518 bytes
 

Contents

Class file image Download
<?php

namespace TelegramCliWrapper;

class
Response
{
    public static function
json($data = array())
    {
       
header('Content-Type: application/json');
        echo
json_encode($data, true);

        return
0;
    }

    public static function
error($reason)
    {
        return
self::json(array(
           
'success' => false,
           
'reason' => $reason,
        ));
    }

    public static function
ok($data = array())
    {
       
$data['success'] = true;

        return
self::json($data);
    }
}