src/TelebotSDK/Jsonable.php
public static function parse($jsonText) {
        // Create a mapper instance
        $mapper = JsonMapper::getInstance();

        // To throw an exception if there's a missing required property
        $mapper->bExceptionOnMissingData = true;

        try {
            // Map the parsed json to an object of the current class
            $obj = $mapper->map(
            // Parse JSON text to an object
                json_decode($jsonText),
                // Create a new object of the current class
                self::instantiate(__CLASS__)
            );
        } catch (\JsonMapper_Exception $e) {
            // This is usually caused when a missing required property is detected
            throw new Telebot_InvalidJsonException(
                "Invalid telegram update json data: " . $e->getMessage(), 0, $e
            );
        }

        return $obj;
    }
public static function parse($jsonText) {
        // Create a mapper instance
        $mapper = JsonMapper::getInstance();

        // To throw an exception if there's a missing required property
        $mapper->bExceptionOnMissingData = true;

        try {
            // Map the parsed json to an object of the current class
            $obj = $mapper->map(
            // Parse JSON text to an object
                json_decode($jsonText),
                // Create a new object of the current class
                self::instantiate(__CLASS__)
            );
        } catch (\JsonMapper_Exception $e) {
            // This is usually caused when a missing required property is detected
            throw new Telebot_InvalidJsonException(
                "Invalid telegram update json data: " . $e->getMessage(), 0, $e
            );
        }

        return $obj;
    }
Parses/maps the text json to the current class

@param string $jsonText JSON data that represents the current class

@return object A new object of the current class
@throws Telebot_InvalidJsonException When a required property is missing or unexpected data
provided