GraphAchievement   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
dl 0
loc 80
ccs 12
cts 14
cp 0.8571
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getFrom() 0 3 1
A getPublishTime() 0 3 1
A isNoFeedStory() 0 3 1
A getData() 0 3 1
A getId() 0 3 1
A getType() 0 3 1
A getApplication() 0 3 1
1
<?php
2
/**
3
 * Copyright 2017 Facebook, Inc.
4
 *
5
 * You are hereby granted a non-exclusive, worldwide, royalty-free license to
6
 * use, copy, modify, and distribute this software in source code or binary
7
 * form for use in connection with the web services and APIs provided by
8
 * Facebook.
9
 *
10
 * As with any software that integrates with the Facebook platform, your use
11
 * of this software is subject to the Facebook Developer Principles and
12
 * Policies [http://developers.facebook.com/policy/]. This copyright notice
13
 * shall be included in all copies or substantial portions of the software.
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
 * DEALINGS IN THE SOFTWARE.
22
 */
23
namespace Facebook\GraphNode;
24
25
/**
26
 * @package Facebook
27
 */
28
class GraphAchievement extends GraphNode
29
{
30
    /**
31
     * @var array maps object key names to Graph object types
32
     */
33
    protected static $graphNodeMap = [
34
        'from' => GraphUser::class,
35
        'application' => GraphApplication::class,
36
    ];
37
38
    /**
39
     * Returns the ID for the achievement.
40
     *
41
     * @return null|string
42
     */
43 1
    public function getId()
44
    {
45 1
        return $this->getField('id');
46
    }
47
48
    /**
49
     * Returns the user who achieved this.
50
     *
51
     * @return null|GraphUser
52
     */
53 1
    public function getFrom()
54
    {
55 1
        return $this->getField('from');
56
    }
57
58
    /**
59
     * Returns the time at which this was achieved.
60
     *
61
     * @return null|\DateTime
62
     */
63 1
    public function getPublishTime()
64
    {
65 1
        return $this->getField('publish_time');
66
    }
67
68
    /**
69
     * Returns the app in which the user achieved this.
70
     *
71
     * @return null|GraphApplication
72
     */
73 1
    public function getApplication()
74
    {
75 1
        return $this->getField('application');
76
    }
77
78
    /**
79
     * Returns information about the achievement type this instance is connected with.
80
     *
81
     * @return null|array
82
     */
83
    public function getData()
84
    {
85
        return $this->getField('data');
86
    }
87
88
    /**
89
     * Returns the type of achievement.
90
     *
91
     * @see https://developers.facebook.com/docs/graph-api/reference/achievement
92
     *
93
     * @return string
94
     */
95 1
    public function getType()
96
    {
97 1
        return 'game.achievement';
98
    }
99
100
    /**
101
     * Indicates whether gaining the achievement published a feed story for the user.
102
     *
103
     * @return null|bool
104
     */
105 1
    public function isNoFeedStory()
106
    {
107 1
        return $this->getField('no_feed_story');
108
    }
109
}
110