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
dbd0ee55
Commit
dbd0ee55
authored
Apr 23, 2016
by
MBoretto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for inline keyboard
parent
a29336e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
Entity.php
src/Entities/Entity.php
+65
-0
No files found.
src/Entities/Entity.php
View file @
dbd0ee55
...
@@ -29,6 +29,71 @@ class Entity
...
@@ -29,6 +29,71 @@ class Entity
return
$json
;
return
$json
;
}
}
public
function
reflect
(
$object
=
null
)
{
if
(
$object
==
null
)
{
$object
=
$this
;
}
$reflection
=
new
\ReflectionObject
(
$object
);
$properties
=
$reflection
->
getProperties
();
$fields
=
[];
foreach
(
$properties
as
$property
)
{
$name
=
$property
->
getName
();
if
(
$name
==
'bot_name'
)
{
continue
;
}
if
(
!
$property
->
isPrivate
())
{
$array_of_obj
=
false
;
$array_of_array_obj
=
false
;
if
(
is_array
(
$object
->
$name
))
{
$array_of_obj
=
true
;
$array_of_array_obj
=
true
;
foreach
(
$object
->
$name
as
$elm
)
{
if
(
!
is_object
(
$elm
))
{
//echo $name . " not array of object \n";
$array_of_obj
=
false
;
//break;
}
if
(
is_array
(
$elm
))
{
foreach
(
$elm
as
$more_net
)
{
if
(
!
is_object
(
$more_net
))
{
$array_of_array_obj
=
false
;
}
}
}
}
}
if
(
is_object
(
$object
->
$name
))
{
$fields
[
$name
]
=
$this
->
reflect
(
$object
->
$name
);
}
elseif
(
$array_of_obj
)
{
foreach
(
$object
->
$name
as
$elm
)
{
$fields
[
$name
][]
=
$this
->
reflect
(
$elm
);
}
}
elseif
(
$array_of_array_obj
)
{
foreach
(
$object
->
$name
as
$elm
)
{
$temp
=
null
;
foreach
(
$elm
as
$obj
)
{
$temp
[]
=
$this
->
reflect
(
$obj
);
}
$fields
[
$name
][]
=
$temp
;
}
}
else
{
$property
->
setAccessible
(
true
);
$value
=
$property
->
getValue
(
$object
);
if
(
is_null
(
$value
))
{
continue
;
}
$fields
[
$name
]
=
$value
;
}
}
}
return
$fields
;
}
public
function
reflect
(
$object
=
null
)
public
function
reflect
(
$object
=
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