Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
04e2d488
Commit
04e2d488
authored
Apr 15, 2016
by
Jack'lul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'InputMessageContent' and it's 4 types
parent
da0cc114
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
169 additions
and
0 deletions
+169
-0
InputContactMessageContent.php
src/Entities/InputContactMessageContent.php
+37
-0
InputLocationMessageContent.php
src/Entities/InputLocationMessageContent.php
+34
-0
InputMessageContent.php
src/Entities/InputMessageContent.php
+16
-0
InputTextMessageContent.php
src/Entities/InputTextMessageContent.php
+33
-0
InputVenueMessageContent.php
src/Entities/InputVenueMessageContent.php
+49
-0
No files found.
src/Entities/InputContactMessageContent.php
0 → 100644
View file @
04e2d488
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Longman\TelegramBot\Entities
;
use
Longman\TelegramBot\Exception\TelegramException
;
class
InputContactMessageContent
extends
InputMessageContent
{
protected
$phone_number
;
protected
$first_name
;
protected
$last_name
;
public
function
__construct
(
array
$data
)
{
//parent::__construct($data);
$this
->
phone_number
isset
(
$data
[
'phone_number'
])
?
$data
[
'phone_number'
]
:
null
;
if
(
empty
(
$this
->
phone_number
))
{
throw
new
TelegramException
(
'phone_number is empty!'
);
}
$this
->
first_name
isset
(
$data
[
'first_name'
])
?
$data
[
'first_name'
]
:
null
;
if
(
empty
(
$this
->
first_name
))
{
throw
new
TelegramException
(
'first_name is empty!'
);
}
$this
->
last_name
isset
(
$data
[
'last_name'
])
?
$data
[
'last_name'
]
:
null
;
}
}
src/Entities/InputLocationMessageContent.php
0 → 100644
View file @
04e2d488
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Longman\TelegramBot\Entities
;
use
Longman\TelegramBot\Exception\TelegramException
;
class
InputLocationMessageContent
extends
InputMessageContent
{
protected
$latitude
;
protected
$longitude
;
public
function
__construct
(
array
$data
)
{
//parent::__construct($data);
$this
->
latitude
isset
(
$data
[
'latitude'
])
?
$data
[
'latitude'
]
:
null
;
if
(
empty
(
$this
->
latitude
))
{
throw
new
TelegramException
(
'latitude is empty!'
);
}
$this
->
longitude
isset
(
$data
[
'longitude'
])
?
$data
[
'longitude'
]
:
null
;
if
(
empty
(
$this
->
longitude
))
{
throw
new
TelegramException
(
'longitude is empty!'
);
}
}
}
src/Entities/InputMessageContent.php
0 → 100644
View file @
04e2d488
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Longman\TelegramBot\Entities
;
class
InputMessageContent
extends
Entity
{
}
src/Entities/InputTextMessageContent.php
0 → 100644
View file @
04e2d488
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Longman\TelegramBot\Entities
;
use
Longman\TelegramBot\Exception\TelegramException
;
class
InputTextMessageContent
extends
InputMessageContent
{
protected
$message_text
;
protected
$parse_mode
;
protected
$disable_web_page_preview
;
public
function
__construct
(
array
$data
)
{
//parent::__construct($data);
$this
->
message_text
isset
(
$data
[
'message_text'
])
?
$data
[
'message_text'
]
:
null
;
if
(
empty
(
$this
->
message_text
))
{
throw
new
TelegramException
(
'message_text is empty!'
);
}
$this
->
parse_mode
isset
(
$data
[
'parse_mode'
])
?
$data
[
'parse_mode'
]
:
null
;
$this
->
disable_web_page_preview
isset
(
$data
[
'disable_web_page_preview'
])
?
$data
[
'disable_web_page_preview'
]
:
null
;
}
}
src/Entities/InputVenueMessageContent.php
0 → 100644
View file @
04e2d488
<?php
/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Longman\TelegramBot\Entities
;
use
Longman\TelegramBot\Exception\TelegramException
;
class
InputVenueMessageContent
extends
InputMessageContent
{
protected
$latitude
;
protected
$longitude
;
protected
$title
;
protected
$address
;
protected
$foursquare_id
;
public
function
__construct
(
array
$data
)
{
//parent::__construct($data);
$this
->
latitude
isset
(
$data
[
'latitude'
])
?
$data
[
'latitude'
]
:
null
;
if
(
empty
(
$this
->
latitude
))
{
throw
new
TelegramException
(
'latitude is empty!'
);
}
$this
->
longitude
isset
(
$data
[
'longitude'
])
?
$data
[
'longitude'
]
:
null
;
if
(
empty
(
$this
->
longitude
))
{
throw
new
TelegramException
(
'longitude is empty!'
);
}
$this
->
title
isset
(
$data
[
'title'
])
?
$data
[
'title'
]
:
null
;
if
(
empty
(
$this
->
title
))
{
throw
new
TelegramException
(
'title is empty!'
);
}
$this
->
address
isset
(
$data
[
'address'
])
?
$data
[
'address'
]
:
null
;
if
(
empty
(
$this
->
address
))
{
throw
new
TelegramException
(
'address is empty!'
);
}
$this
->
foursquare_id
isset
(
$data
[
'foursquare_id'
])
?
$data
[
'foursquare_id'
]
:
null
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment