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 */
24namespace Facebook\GraphNodes;
25
26use Facebook\Exceptions\FacebookSDKException;
27
28/**
29 * Class GraphObjectFactory
30 *
31 * @package Facebook
32 *
33 * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
34 * @todo v6: Remove this class
35 */
36class GraphObjectFactory extends GraphNodeFactory
37{
38    /**
39     * @const string The base graph object class.
40     */
41    const BASE_GRAPH_NODE_CLASS = '\Facebook\GraphNodes\GraphObject';
42
43    /**
44     * @const string The base graph edge class.
45     */
46    const BASE_GRAPH_EDGE_CLASS = '\Facebook\GraphNodes\GraphList';
47
48    /**
49     * Tries to convert a FacebookResponse entity into a GraphNode.
50     *
51     * @param string|null $subclassName The GraphNode sub class to cast to.
52     *
53     * @return GraphNode
54     *
55     * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
56     */
57    public function makeGraphObject($subclassName = null)
58    {
59        return $this->makeGraphNode($subclassName);
60    }
61
62    /**
63     * Convenience method for creating a GraphEvent collection.
64     *
65     * @return GraphEvent
66     *
67     * @throws FacebookSDKException
68     */
69    public function makeGraphEvent()
70    {
71        return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent');
72    }
73
74    /**
75     * Tries to convert a FacebookResponse entity into a GraphEdge.
76     *
77     * @param string|null $subclassName The GraphNode sub class to cast the list items to.
78     * @param boolean     $auto_prefix  Toggle to auto-prefix the subclass name.
79     *
80     * @return GraphEdge
81     *
82     * @deprecated 5.0.0 GraphObjectFactory has been renamed to GraphNodeFactory
83     */
84    public function makeGraphList($subclassName = null, $auto_prefix = true)
85    {
86        return $this->makeGraphEdge($subclassName, $auto_prefix);
87    }
88}
89