GraphAchievement   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 82
rs 10
c 1
b 0
f 0
wmc 7
lcom 1
cbo 1

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A getFrom() 0 4 1
A getPublishTime() 0 4 1
A getApplication() 0 4 1
A getData() 0 4 1
A getType() 0 4 1
A isNoFeedStory() 0 4 1
1
<?php
2
/**
3
 * Copyright 2016 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
 */
24
namespace Facebook\GraphNodes;
25
26
/**
27
 * Class GraphAchievement
28
 *
29
 * @package Facebook
30
 */
31
32
class GraphAchievement extends GraphNode
33
{
34
    /**
35
     * @var array Maps object key names to Graph object types.
36
     */
37
    protected static $graphObjectMap = [
38
        'from' => '\Facebook\GraphNodes\GraphUser',
39
        'application' => '\Facebook\GraphNodes\GraphApplication',
40
    ];
41
42
    /**
43
     * Returns the ID for the achievement.
44
     *
45
     * @return string|null
46
     */
47
    public function getId()
48
    {
49
        return $this->getField('id');
50
    }
51
52
    /**
53
     * Returns the user who achieved this.
54
     *
55
     * @return GraphUser|null
56
     */
57
    public function getFrom()
58
    {
59
        return $this->getField('from');
60
    }
61
62
    /**
63
     * Returns the time at which this was achieved.
64
     *
65
     * @return \DateTime|null
66
     */
67
    public function getPublishTime()
68
    {
69
        return $this->getField('publish_time');
70
    }
71
72
    /**
73
     * Returns the app in which the user achieved this.
74
     *
75
     * @return GraphApplication|null
76
     */
77
    public function getApplication()
78
    {
79
        return $this->getField('application');
80
    }
81
82
    /**
83
     * Returns information about the achievement type this instance is connected with.
84
     *
85
     * @return array|null
86
     */
87
    public function getData()
88
    {
89
        return $this->getField('data');
90
    }
91
92
    /**
93
     * Returns the type of achievement.
94
     *
95
     * @see https://developers.facebook.com/docs/graph-api/reference/achievement
96
     *
97
     * @return string
98
     */
99
    public function getType()
100
    {
101
        return 'game.achievement';
102
    }
103
104
    /**
105
     * Indicates whether gaining the achievement published a feed story for the user.
106
     *
107
     * @return boolean|null
108
     */
109
    public function isNoFeedStory()
110
    {
111
        return $this->getField('no_feed_story');
112
    }
113
}
114