Completed
Branch master (7421d0)
by
unknown
11:25 queued 06:55
created
core/services/graphql/enums/EnumCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     private function loadCollection()
51 51
     {
52
-        if (! $this->loader instanceof CollectionLoader) {
52
+        if ( ! $this->loader instanceof CollectionLoader) {
53 53
             $this->loader = new CollectionLoader(
54 54
                 new CollectionDetails(
55 55
                     // collection name
Please login to merge, or discard this patch.
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -20,86 +20,86 @@
 block discarded – undo
20 20
  */
21 21
 class EnumCollection extends Collection
22 22
 {
23
-    const COLLECTION_NAME = 'espresso_graphql_enums';
23
+	const COLLECTION_NAME = 'espresso_graphql_enums';
24 24
 
25
-    /**
26
-     * @var CollectionLoader $loader
27
-     */
28
-    protected $loader;
25
+	/**
26
+	 * @var CollectionLoader $loader
27
+	 */
28
+	protected $loader;
29 29
 
30
-    /**
31
-     * EnumCollection constructor
32
-     *
33
-     * @throws InvalidInterfaceException
34
-     */
35
-    public function __construct()
36
-    {
37
-        parent::__construct(
38
-            'EventEspresso\core\services\graphql\enums\EnumInterface',
39
-            EnumCollection::COLLECTION_NAME
40
-        );
41
-    }
30
+	/**
31
+	 * EnumCollection constructor
32
+	 *
33
+	 * @throws InvalidInterfaceException
34
+	 */
35
+	public function __construct()
36
+	{
37
+		parent::__construct(
38
+			'EventEspresso\core\services\graphql\enums\EnumInterface',
39
+			EnumCollection::COLLECTION_NAME
40
+		);
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @throws CollectionDetailsException
46
-     * @throws CollectionLoaderException
47
-     * @since 5.0.0.p
48
-     */
49
-    private function loadCollection()
50
-    {
51
-        if (! $this->loader instanceof CollectionLoader) {
52
-            $this->loader = new CollectionLoader(
53
-                new CollectionDetails(
54
-                    // collection name
55
-                    EnumCollection::COLLECTION_NAME,
56
-                    // collection interface
57
-                    'EventEspresso\core\services\graphql\enums\EnumInterface',
58
-                    // FQCNs for classes to add (all classes within each namespace will be loaded)
59
-                    apply_filters(
60
-                        'FHEE__EventEspresso_core_services_graphql_EnumCollection__loadCollection__collection_FQCNs',
61
-                        ['EventEspresso\core\domain\services\graphql\enums']
62
-                    ),
63
-                    // filepaths to classes to add
64
-                    array(),
65
-                    // file mask to use if parsing folder for files to add
66
-                    '',
67
-                    // what to use as identifier for collection entities
68
-                    // using CLASS NAME prevents duplicates (works like a singleton)
69
-                    CollectionDetails::ID_CLASS_NAME
70
-                ),
71
-                $this
72
-            );
73
-        }
74
-    }
44
+	/**
45
+	 * @throws CollectionDetailsException
46
+	 * @throws CollectionLoaderException
47
+	 * @since 5.0.0.p
48
+	 */
49
+	private function loadCollection()
50
+	{
51
+		if (! $this->loader instanceof CollectionLoader) {
52
+			$this->loader = new CollectionLoader(
53
+				new CollectionDetails(
54
+					// collection name
55
+					EnumCollection::COLLECTION_NAME,
56
+					// collection interface
57
+					'EventEspresso\core\services\graphql\enums\EnumInterface',
58
+					// FQCNs for classes to add (all classes within each namespace will be loaded)
59
+					apply_filters(
60
+						'FHEE__EventEspresso_core_services_graphql_EnumCollection__loadCollection__collection_FQCNs',
61
+						['EventEspresso\core\domain\services\graphql\enums']
62
+					),
63
+					// filepaths to classes to add
64
+					array(),
65
+					// file mask to use if parsing folder for files to add
66
+					'',
67
+					// what to use as identifier for collection entities
68
+					// using CLASS NAME prevents duplicates (works like a singleton)
69
+					CollectionDetails::ID_CLASS_NAME
70
+				),
71
+				$this
72
+			);
73
+		}
74
+	}
75 75
 
76 76
 
77
-    /**
78
-     * @return CollectionInterface
79
-     * @throws CollectionDetailsException
80
-     * @throws CollectionLoaderException
81
-     * @since 5.0.0.p
82
-     */
83
-    public function loadEnums()
84
-    {
85
-        $this->loadCollection();
86
-        return $this->loader->getCollection();
87
-    }
77
+	/**
78
+	 * @return CollectionInterface
79
+	 * @throws CollectionDetailsException
80
+	 * @throws CollectionLoaderException
81
+	 * @since 5.0.0.p
82
+	 */
83
+	public function loadEnums()
84
+	{
85
+		$this->loadCollection();
86
+		return $this->loader->getCollection();
87
+	}
88 88
 
89 89
 
90
-    /**
91
-     * getIdentifier
92
-     * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
93
-     * If no $identifier is supplied, then the  fully qualified class name is used
94
-     *
95
-     * @param        $object
96
-     * @param mixed  $identifier
97
-     * @return bool
98
-     */
99
-    public function getIdentifier($object, $identifier = null)
100
-    {
101
-        return ! empty($identifier)
102
-            ? $identifier
103
-            : get_class($object);
104
-    }
90
+	/**
91
+	 * getIdentifier
92
+	 * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
93
+	 * If no $identifier is supplied, then the  fully qualified class name is used
94
+	 *
95
+	 * @param        $object
96
+	 * @param mixed  $identifier
97
+	 * @return bool
98
+	 */
99
+	public function getIdentifier($object, $identifier = null)
100
+	{
101
+		return ! empty($identifier)
102
+			? $identifier
103
+			: get_class($object);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
core/services/graphql/inputs/InputCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     private function loadCollection()
51 51
     {
52
-        if (! $this->loader instanceof CollectionLoader) {
52
+        if ( ! $this->loader instanceof CollectionLoader) {
53 53
             $this->loader = new CollectionLoader(
54 54
                 new CollectionDetails(
55 55
                     // collection name
Please login to merge, or discard this patch.
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -20,86 +20,86 @@
 block discarded – undo
20 20
  */
21 21
 class InputCollection extends Collection
22 22
 {
23
-    const COLLECTION_NAME = 'espresso_graphql_inputs';
23
+	const COLLECTION_NAME = 'espresso_graphql_inputs';
24 24
 
25
-    /**
26
-     * @var CollectionLoader $loader
27
-     */
28
-    protected $loader;
25
+	/**
26
+	 * @var CollectionLoader $loader
27
+	 */
28
+	protected $loader;
29 29
 
30
-    /**
31
-     * InputCollection constructor
32
-     *
33
-     * @throws InvalidInterfaceException
34
-     */
35
-    public function __construct()
36
-    {
37
-        parent::__construct(
38
-            'EventEspresso\core\services\graphql\inputs\InputInterface',
39
-            InputCollection::COLLECTION_NAME
40
-        );
41
-    }
30
+	/**
31
+	 * InputCollection constructor
32
+	 *
33
+	 * @throws InvalidInterfaceException
34
+	 */
35
+	public function __construct()
36
+	{
37
+		parent::__construct(
38
+			'EventEspresso\core\services\graphql\inputs\InputInterface',
39
+			InputCollection::COLLECTION_NAME
40
+		);
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @throws CollectionDetailsException
46
-     * @throws CollectionLoaderException
47
-     * @since 5.0.0.p
48
-     */
49
-    private function loadCollection()
50
-    {
51
-        if (! $this->loader instanceof CollectionLoader) {
52
-            $this->loader = new CollectionLoader(
53
-                new CollectionDetails(
54
-                    // collection name
55
-                    InputCollection::COLLECTION_NAME,
56
-                    // collection interface
57
-                    'EventEspresso\core\services\graphql\inputs\InputInterface',
58
-                    // FQCNs for classes to add (all classes within each namespace will be loaded)
59
-                    apply_filters(
60
-                        'FHEE__EventEspresso_core_services_graphql_InputCollection__loadCollection__collection_FQCNs',
61
-                        ['EventEspresso\core\domain\services\graphql\inputs']
62
-                    ),
63
-                    // filepaths to classes to add
64
-                    array(),
65
-                    // file mask to use if parsing folder for files to add
66
-                    '',
67
-                    // what to use as identifier for collection entities
68
-                    // using CLASS NAME prevents duplicates (works like a singleton)
69
-                    CollectionDetails::ID_CLASS_NAME
70
-                ),
71
-                $this
72
-            );
73
-        }
74
-    }
44
+	/**
45
+	 * @throws CollectionDetailsException
46
+	 * @throws CollectionLoaderException
47
+	 * @since 5.0.0.p
48
+	 */
49
+	private function loadCollection()
50
+	{
51
+		if (! $this->loader instanceof CollectionLoader) {
52
+			$this->loader = new CollectionLoader(
53
+				new CollectionDetails(
54
+					// collection name
55
+					InputCollection::COLLECTION_NAME,
56
+					// collection interface
57
+					'EventEspresso\core\services\graphql\inputs\InputInterface',
58
+					// FQCNs for classes to add (all classes within each namespace will be loaded)
59
+					apply_filters(
60
+						'FHEE__EventEspresso_core_services_graphql_InputCollection__loadCollection__collection_FQCNs',
61
+						['EventEspresso\core\domain\services\graphql\inputs']
62
+					),
63
+					// filepaths to classes to add
64
+					array(),
65
+					// file mask to use if parsing folder for files to add
66
+					'',
67
+					// what to use as identifier for collection entities
68
+					// using CLASS NAME prevents duplicates (works like a singleton)
69
+					CollectionDetails::ID_CLASS_NAME
70
+				),
71
+				$this
72
+			);
73
+		}
74
+	}
75 75
 
76 76
 
77
-    /**
78
-     * @return CollectionInterface
79
-     * @throws CollectionDetailsException
80
-     * @throws CollectionLoaderException
81
-     * @since 5.0.0.p
82
-     */
83
-    public function loadInputs()
84
-    {
85
-        $this->loadCollection();
86
-        return $this->loader->getCollection();
87
-    }
77
+	/**
78
+	 * @return CollectionInterface
79
+	 * @throws CollectionDetailsException
80
+	 * @throws CollectionLoaderException
81
+	 * @since 5.0.0.p
82
+	 */
83
+	public function loadInputs()
84
+	{
85
+		$this->loadCollection();
86
+		return $this->loader->getCollection();
87
+	}
88 88
 
89 89
 
90
-    /**
91
-     * getIdentifier
92
-     * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
93
-     * If no $identifier is supplied, then the  fully qualified class name is used
94
-     *
95
-     * @param        $object
96
-     * @param mixed  $identifier
97
-     * @return bool
98
-     */
99
-    public function getIdentifier($object, $identifier = null)
100
-    {
101
-        return ! empty($identifier)
102
-            ? $identifier
103
-            : get_class($object);
104
-    }
90
+	/**
91
+	 * getIdentifier
92
+	 * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
93
+	 * If no $identifier is supplied, then the  fully qualified class name is used
94
+	 *
95
+	 * @param        $object
96
+	 * @param mixed  $identifier
97
+	 * @return bool
98
+	 */
99
+	public function getIdentifier($object, $identifier = null)
100
+	{
101
+		return ! empty($identifier)
102
+			? $identifier
103
+			: get_class($object);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
core/services/graphql/types/TypeCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     private function loadCollection()
51 51
     {
52
-        if (! $this->loader instanceof CollectionLoader) {
52
+        if ( ! $this->loader instanceof CollectionLoader) {
53 53
             $this->loader = new CollectionLoader(
54 54
                 new CollectionDetails(
55 55
                     // collection name
Please login to merge, or discard this patch.
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -20,89 +20,89 @@
 block discarded – undo
20 20
  */
21 21
 class TypeCollection extends Collection
22 22
 {
23
-    const COLLECTION_NAME = 'espresso_graphql_types';
23
+	const COLLECTION_NAME = 'espresso_graphql_types';
24 24
 
25
-    const COLLECTION_INTERFACE = 'EventEspresso\core\services\graphql\types\TypeInterface';
25
+	const COLLECTION_INTERFACE = 'EventEspresso\core\services\graphql\types\TypeInterface';
26 26
 
27
-    /**
28
-     * @var CollectionLoader $loader
29
-     */
30
-    protected $loader;
27
+	/**
28
+	 * @var CollectionLoader $loader
29
+	 */
30
+	protected $loader;
31 31
 
32 32
 
33
-    /**
34
-     * TypeCollection constructor
35
-     *
36
-     * @throws InvalidInterfaceException
37
-     */
38
-    public function __construct()
39
-    {
40
-        parent::__construct(
41
-            TypeCollection::COLLECTION_INTERFACE,
42
-            TypeCollection::COLLECTION_NAME
43
-        );
44
-    }
33
+	/**
34
+	 * TypeCollection constructor
35
+	 *
36
+	 * @throws InvalidInterfaceException
37
+	 */
38
+	public function __construct()
39
+	{
40
+		parent::__construct(
41
+			TypeCollection::COLLECTION_INTERFACE,
42
+			TypeCollection::COLLECTION_NAME
43
+		);
44
+	}
45 45
 
46 46
 
47
-    /**
48
-     * @throws CollectionDetailsException
49
-     * @throws CollectionLoaderException
50
-     * @since 5.0.0.p
51
-     */
52
-    private function loadCollection()
53
-    {
54
-        if (! $this->loader instanceof CollectionLoader) {
55
-            $this->loader = new CollectionLoader(
56
-                new CollectionDetails(
57
-                    // collection name
58
-                    TypeCollection::COLLECTION_NAME,
59
-                    // collection interface
60
-                    TypeCollection::COLLECTION_INTERFACE,
61
-                    // FQCNs for classes to add (all classes within each namespace will be loaded)
62
-                    apply_filters(
63
-                        'FHEE__EventEspresso_core_services_graphql_TypeCollection__loadCollection__collection_FQCNs',
64
-                        ['EventEspresso\core\domain\services\graphql\types']
65
-                    ),
66
-                    // filepaths to classes to add
67
-                    array(),
68
-                    // file mask to use if parsing folder for files to add
69
-                    '',
70
-                    // what to use as identifier for collection entities
71
-                    // using CLASS NAME prevents duplicates (works like a singleton)
72
-                    CollectionDetails::ID_CLASS_NAME
73
-                ),
74
-                $this
75
-            );
76
-        }
77
-    }
47
+	/**
48
+	 * @throws CollectionDetailsException
49
+	 * @throws CollectionLoaderException
50
+	 * @since 5.0.0.p
51
+	 */
52
+	private function loadCollection()
53
+	{
54
+		if (! $this->loader instanceof CollectionLoader) {
55
+			$this->loader = new CollectionLoader(
56
+				new CollectionDetails(
57
+					// collection name
58
+					TypeCollection::COLLECTION_NAME,
59
+					// collection interface
60
+					TypeCollection::COLLECTION_INTERFACE,
61
+					// FQCNs for classes to add (all classes within each namespace will be loaded)
62
+					apply_filters(
63
+						'FHEE__EventEspresso_core_services_graphql_TypeCollection__loadCollection__collection_FQCNs',
64
+						['EventEspresso\core\domain\services\graphql\types']
65
+					),
66
+					// filepaths to classes to add
67
+					array(),
68
+					// file mask to use if parsing folder for files to add
69
+					'',
70
+					// what to use as identifier for collection entities
71
+					// using CLASS NAME prevents duplicates (works like a singleton)
72
+					CollectionDetails::ID_CLASS_NAME
73
+				),
74
+				$this
75
+			);
76
+		}
77
+	}
78 78
 
79 79
 
80
-    /**
81
-     * @return CollectionInterface
82
-     * @throws CollectionDetailsException
83
-     * @throws CollectionLoaderException
84
-     * @since 5.0.0.p
85
-     */
86
-    public function loadTypes()
87
-    {
88
-        $this->loadCollection();
89
-        return $this->loader->getCollection();
90
-    }
80
+	/**
81
+	 * @return CollectionInterface
82
+	 * @throws CollectionDetailsException
83
+	 * @throws CollectionLoaderException
84
+	 * @since 5.0.0.p
85
+	 */
86
+	public function loadTypes()
87
+	{
88
+		$this->loadCollection();
89
+		return $this->loader->getCollection();
90
+	}
91 91
 
92 92
 
93
-    /**
94
-     * getIdentifier
95
-     * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
96
-     * If no $identifier is supplied, then the  fully qualified class name is used
97
-     *
98
-     * @param        $object
99
-     * @param mixed  $identifier
100
-     * @return bool
101
-     */
102
-    public function getIdentifier($object, $identifier = null)
103
-    {
104
-        return ! empty($identifier)
105
-            ? $identifier
106
-            : get_class($object);
107
-    }
93
+	/**
94
+	 * getIdentifier
95
+	 * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
96
+	 * If no $identifier is supplied, then the  fully qualified class name is used
97
+	 *
98
+	 * @param        $object
99
+	 * @param mixed  $identifier
100
+	 * @return bool
101
+	 */
102
+	public function getIdentifier($object, $identifier = null)
103
+	{
104
+		return ! empty($identifier)
105
+			? $identifier
106
+			: get_class($object);
107
+	}
108 108
 }
Please login to merge, or discard this patch.
core/services/graphql/InputsManager.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
         $inputFields = [];
69 69
         foreach ($input->fields() as $field) {
70 70
             $fieldName = $field->name();
71
-            $inputFields[ $fieldName ] = $field->toArray();
71
+            $inputFields[$fieldName] = $field->toArray();
72 72
         }
73 73
         // Register the input type.
74 74
         register_graphql_input_type(
Please login to merge, or discard this patch.
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -17,65 +17,65 @@
 block discarded – undo
17 17
  */
18 18
 class InputsManager implements GQLManagerInterface
19 19
 {
20
-    /**
21
-     * @var InputCollection|InputInterface[] $inputs
22
-     */
23
-    private $inputs;
20
+	/**
21
+	 * @var InputCollection|InputInterface[] $inputs
22
+	 */
23
+	private $inputs;
24 24
 
25 25
 
26
-    /**
27
-     * InputsManager constructor.
28
-     *
29
-     * @param InputCollection|InputInterface[] $inputs
30
-     */
31
-    public function __construct(InputCollection $inputs)
32
-    {
33
-        $this->inputs = $inputs;
34
-    }
26
+	/**
27
+	 * InputsManager constructor.
28
+	 *
29
+	 * @param InputCollection|InputInterface[] $inputs
30
+	 */
31
+	public function __construct(InputCollection $inputs)
32
+	{
33
+		$this->inputs = $inputs;
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     * @throws CollectionDetailsException
39
-     * @throws CollectionLoaderException
40
-     * @since 5.0.0.p
41
-     */
42
-    public function init()
43
-    {
44
-        $this->inputs->loadInputs();
45
-        add_action('graphql_register_types', [$this, 'configureInputs'], 9);
46
-    }
37
+	/**
38
+	 * @throws CollectionDetailsException
39
+	 * @throws CollectionLoaderException
40
+	 * @since 5.0.0.p
41
+	 */
42
+	public function init()
43
+	{
44
+		$this->inputs->loadInputs();
45
+		add_action('graphql_register_types', [$this, 'configureInputs'], 9);
46
+	}
47 47
 
48 48
 
49
-    /**
50
-     * @since 5.0.0.p
51
-     */
52
-    public function configureInputs()
53
-    {
54
-        // loop through the collection of inputs and register their fields
55
-        foreach ($this->inputs as $input) {
56
-            $this->registerInput($input);
57
-        }
58
-    }
49
+	/**
50
+	 * @since 5.0.0.p
51
+	 */
52
+	public function configureInputs()
53
+	{
54
+		// loop through the collection of inputs and register their fields
55
+		foreach ($this->inputs as $input) {
56
+			$this->registerInput($input);
57
+		}
58
+	}
59 59
 
60 60
 
61
-    /**
62
-     * @param InputInterface $input
63
-     * @since 5.0.0.p
64
-     */
65
-    public function registerInput(InputInterface $input)
66
-    {
67
-        $inputFields = [];
68
-        foreach ($input->fields() as $field) {
69
-            $fieldName = $field->name();
70
-            $inputFields[ $fieldName ] = $field->toArray();
71
-        }
72
-        // Register the input type.
73
-        register_graphql_input_type(
74
-            $input->name(),
75
-            [
76
-                'description' => $input->description(),
77
-                'fields'      => $inputFields,
78
-            ]
79
-        );
80
-    }
61
+	/**
62
+	 * @param InputInterface $input
63
+	 * @since 5.0.0.p
64
+	 */
65
+	public function registerInput(InputInterface $input)
66
+	{
67
+		$inputFields = [];
68
+		foreach ($input->fields() as $field) {
69
+			$fieldName = $field->name();
70
+			$inputFields[ $fieldName ] = $field->toArray();
71
+		}
72
+		// Register the input type.
73
+		register_graphql_input_type(
74
+			$input->name(),
75
+			[
76
+				'description' => $input->description(),
77
+				'fields'      => $inputFields,
78
+			]
79
+		);
80
+	}
81 81
 }
Please login to merge, or discard this patch.
core/services/graphql/connections/ConnectionCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      */
50 50
     private function loadCollection()
51 51
     {
52
-        if (! $this->loader instanceof CollectionLoader) {
52
+        if ( ! $this->loader instanceof CollectionLoader) {
53 53
             $this->loader = new CollectionLoader(
54 54
                 new CollectionDetails(
55 55
                     // collection name
Please login to merge, or discard this patch.
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -20,86 +20,86 @@
 block discarded – undo
20 20
  */
21 21
 class ConnectionCollection extends Collection
22 22
 {
23
-    const COLLECTION_NAME = 'espresso_graphql_connections';
23
+	const COLLECTION_NAME = 'espresso_graphql_connections';
24 24
 
25
-    /**
26
-     * @var CollectionLoader $loader
27
-     */
28
-    protected $loader;
25
+	/**
26
+	 * @var CollectionLoader $loader
27
+	 */
28
+	protected $loader;
29 29
 
30
-    /**
31
-     * ConnectionCollection constructor
32
-     *
33
-     * @throws InvalidInterfaceException
34
-     */
35
-    public function __construct()
36
-    {
37
-        parent::__construct(
38
-            'EventEspresso\core\services\graphql\connections\ConnectionInterface',
39
-            ConnectionCollection::COLLECTION_NAME
40
-        );
41
-    }
30
+	/**
31
+	 * ConnectionCollection constructor
32
+	 *
33
+	 * @throws InvalidInterfaceException
34
+	 */
35
+	public function __construct()
36
+	{
37
+		parent::__construct(
38
+			'EventEspresso\core\services\graphql\connections\ConnectionInterface',
39
+			ConnectionCollection::COLLECTION_NAME
40
+		);
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @throws CollectionDetailsException
46
-     * @throws CollectionLoaderException
47
-     * @since 5.0.0.p
48
-     */
49
-    private function loadCollection()
50
-    {
51
-        if (! $this->loader instanceof CollectionLoader) {
52
-            $this->loader = new CollectionLoader(
53
-                new CollectionDetails(
54
-                    // collection name
55
-                    ConnectionCollection::COLLECTION_NAME,
56
-                    // collection interface
57
-                    'EventEspresso\core\services\graphql\connections\ConnectionInterface',
58
-                    // FQCNs for classes to add (all classes within each namespace will be loaded)
59
-                    apply_filters(
60
-                        'FHEE__EventEspresso_core_services_graphql_ConnectionCollection__loadCollection__collection_FQCNs',
61
-                        ['EventEspresso\core\domain\services\graphql\connections']
62
-                    ),
63
-                    // filepaths to classes to add
64
-                    array(),
65
-                    // file mask to use if parsing folder for files to add
66
-                    '',
67
-                    // what to use as identifier for collection entities
68
-                    // using CLASS NAME prevents duplicates (works like a singleton)
69
-                    CollectionDetails::ID_CLASS_NAME
70
-                ),
71
-                $this
72
-            );
73
-        }
74
-    }
44
+	/**
45
+	 * @throws CollectionDetailsException
46
+	 * @throws CollectionLoaderException
47
+	 * @since 5.0.0.p
48
+	 */
49
+	private function loadCollection()
50
+	{
51
+		if (! $this->loader instanceof CollectionLoader) {
52
+			$this->loader = new CollectionLoader(
53
+				new CollectionDetails(
54
+					// collection name
55
+					ConnectionCollection::COLLECTION_NAME,
56
+					// collection interface
57
+					'EventEspresso\core\services\graphql\connections\ConnectionInterface',
58
+					// FQCNs for classes to add (all classes within each namespace will be loaded)
59
+					apply_filters(
60
+						'FHEE__EventEspresso_core_services_graphql_ConnectionCollection__loadCollection__collection_FQCNs',
61
+						['EventEspresso\core\domain\services\graphql\connections']
62
+					),
63
+					// filepaths to classes to add
64
+					array(),
65
+					// file mask to use if parsing folder for files to add
66
+					'',
67
+					// what to use as identifier for collection entities
68
+					// using CLASS NAME prevents duplicates (works like a singleton)
69
+					CollectionDetails::ID_CLASS_NAME
70
+				),
71
+				$this
72
+			);
73
+		}
74
+	}
75 75
 
76 76
 
77
-    /**
78
-     * @return CollectionInterface
79
-     * @throws CollectionDetailsException
80
-     * @throws CollectionLoaderException
81
-     * @since 5.0.0.p
82
-     */
83
-    public function loadConnections()
84
-    {
85
-        $this->loadCollection();
86
-        return $this->loader->getCollection();
87
-    }
77
+	/**
78
+	 * @return CollectionInterface
79
+	 * @throws CollectionDetailsException
80
+	 * @throws CollectionLoaderException
81
+	 * @since 5.0.0.p
82
+	 */
83
+	public function loadConnections()
84
+	{
85
+		$this->loadCollection();
86
+		return $this->loader->getCollection();
87
+	}
88 88
 
89 89
 
90
-    /**
91
-     * getIdentifier
92
-     * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
93
-     * If no $identifier is supplied, then the  fully qualified class name is used
94
-     *
95
-     * @param        $object
96
-     * @param mixed  $identifier
97
-     * @return bool
98
-     */
99
-    public function getIdentifier($object, $identifier = null)
100
-    {
101
-        return ! empty($identifier)
102
-            ? $identifier
103
-            : get_class($object);
104
-    }
90
+	/**
91
+	 * getIdentifier
92
+	 * Overrides EventEspresso\core\services\collections\Collection::getIdentifier()
93
+	 * If no $identifier is supplied, then the  fully qualified class name is used
94
+	 *
95
+	 * @param        $object
96
+	 * @param mixed  $identifier
97
+	 * @return bool
98
+	 */
99
+	public function getIdentifier($object, $identifier = null)
100
+	{
101
+		return ! empty($identifier)
102
+			? $identifier
103
+			: get_class($object);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
core/domain/services/custom_post_types/RewriteRules.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) {
38 38
             add_action(
39 39
                 'shutdown',
40
-                static function () {
40
+                static function() {
41 41
                     flush_rewrite_rules();
42 42
                     update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false);
43 43
                 }
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -12,35 +12,35 @@
 block discarded – undo
12 12
  */
13 13
 class RewriteRules
14 14
 {
15
-    const OPTION_KEY_FLUSH_REWRITE_RULES = 'ee_flush_rewrite_rules';
15
+	const OPTION_KEY_FLUSH_REWRITE_RULES = 'ee_flush_rewrite_rules';
16 16
 
17 17
 
18
-    /**
19
-     * This will flush rewrite rules on demand.  This actually gets called around wp init priority level 100.
20
-     *
21
-     * @return void
22
-     */
23
-    public function flush()
24
-    {
25
-        update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true);
26
-    }
18
+	/**
19
+	 * This will flush rewrite rules on demand.  This actually gets called around wp init priority level 100.
20
+	 *
21
+	 * @return void
22
+	 */
23
+	public function flush()
24
+	{
25
+		update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true);
26
+	}
27 27
 
28 28
 
29
-    /**
30
-     * This will flush rewrite rules on demand.  This actually gets called around wp init priority level 100.
31
-     *
32
-     * @return void
33
-     */
34
-    public function flushRewriteRules()
35
-    {
36
-        if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) {
37
-            add_action(
38
-                'shutdown',
39
-                static function () {
40
-                    flush_rewrite_rules();
41
-                    update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false);
42
-                }
43
-            );
44
-        }
45
-    }
29
+	/**
30
+	 * This will flush rewrite rules on demand.  This actually gets called around wp init priority level 100.
31
+	 *
32
+	 * @return void
33
+	 */
34
+	public function flushRewriteRules()
35
+	{
36
+		if (get_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, true)) {
37
+			add_action(
38
+				'shutdown',
39
+				static function () {
40
+					flush_rewrite_rules();
41
+					update_option(RewriteRules::OPTION_KEY_FLUSH_REWRITE_RULES, false);
42
+				}
43
+			);
44
+		}
45
+	}
46 46
 }
Please login to merge, or discard this patch.
core/services/orm/tree_traversal/BaseNode.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
      */
69 69
     public function visit($model_objects_to_identify)
70 70
     {
71
-        if (! $this->isDiscovered()) {
71
+        if ( ! $this->isDiscovered()) {
72 72
             $this->discover();
73 73
         }
74 74
         if ($this->isComplete()) {
Please login to merge, or discard this patch.
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -31,105 +31,105 @@
 block discarded – undo
31 31
  */
32 32
 abstract class BaseNode
33 33
 {
34
-    /**
35
-     * @var boolean
36
-     */
37
-    protected $complete;
34
+	/**
35
+	 * @var boolean
36
+	 */
37
+	protected $complete;
38 38
 
39 39
 
40
-    /**
41
-     * @var array of model names we don't want to traverse
42
-     */
43
-    protected $dont_traverse_models;
40
+	/**
41
+	 * @var array of model names we don't want to traverse
42
+	 */
43
+	protected $dont_traverse_models;
44 44
 
45
-    /**
46
-     * Whether this item has already been initialized
47
-     */
48
-    abstract protected function isDiscovered();
45
+	/**
46
+	 * Whether this item has already been initialized
47
+	 */
48
+	abstract protected function isDiscovered();
49 49
 
50
-    /**
51
-     * Determines if the work is done yet or not. Requires you to have first discovered what work exists by calling
52
-     * discover().
53
-     * @since 4.10.12.p
54
-     * @return boolean
55
-     */
56
-    abstract public function isComplete();
50
+	/**
51
+	 * Determines if the work is done yet or not. Requires you to have first discovered what work exists by calling
52
+	 * discover().
53
+	 * @since 4.10.12.p
54
+	 * @return boolean
55
+	 */
56
+	abstract public function isComplete();
57 57
 
58
-    /**
59
-     * Discovers what work needs to be done to complete traversing this node and its children.
60
-     * Note that this is separate from the constructor, so we can create child nodes without
61
-     * discovering them immediately.
62
-     * @since 4.10.12.p
63
-     * @return mixed
64
-     */
65
-    abstract protected function discover();
58
+	/**
59
+	 * Discovers what work needs to be done to complete traversing this node and its children.
60
+	 * Note that this is separate from the constructor, so we can create child nodes without
61
+	 * discovering them immediately.
62
+	 * @since 4.10.12.p
63
+	 * @return mixed
64
+	 */
65
+	abstract protected function discover();
66 66
 
67
-    /**
68
-     * Identifies model objects, up to the limit $model_objects_to_identify.
69
-     * @since 4.10.12.p
70
-     * @param int $model_objects_to_identify
71
-     * @return int units of work done
72
-     */
73
-    abstract protected function work($model_objects_to_identify);
67
+	/**
68
+	 * Identifies model objects, up to the limit $model_objects_to_identify.
69
+	 * @since 4.10.12.p
70
+	 * @param int $model_objects_to_identify
71
+	 * @return int units of work done
72
+	 */
73
+	abstract protected function work($model_objects_to_identify);
74 74
 
75
-    /**
76
-     * Shows the entity/relation node as an array.
77
-     * @since 4.10.12.p
78
-     * @return array
79
-     */
80
-    abstract public function toArray();
75
+	/**
76
+	 * Shows the entity/relation node as an array.
77
+	 * @since 4.10.12.p
78
+	 * @return array
79
+	 */
80
+	abstract public function toArray();
81 81
 
82
-    /**
83
-     * Discovers how much work there is to do, double-checks the work isn't already finished, and then does the work.
84
-     * Note: do not call when site is in maintenance mode level 2.
85
-     *
86
-     * @since 4.10.12.p
87
-     * @param $model_objects_to_identify
88
-     * @return int number of model objects we want to identify during this call. On subsequent calls we'll continue
89
-     * where we left off.
90
-     */
91
-    public function visit($model_objects_to_identify)
92
-    {
93
-        if (! $this->isDiscovered()) {
94
-            $this->discover();
95
-        }
96
-        if ($this->isComplete()) {
97
-            return 0;
98
-        }
99
-        return $this->work($model_objects_to_identify);
100
-    }
82
+	/**
83
+	 * Discovers how much work there is to do, double-checks the work isn't already finished, and then does the work.
84
+	 * Note: do not call when site is in maintenance mode level 2.
85
+	 *
86
+	 * @since 4.10.12.p
87
+	 * @param $model_objects_to_identify
88
+	 * @return int number of model objects we want to identify during this call. On subsequent calls we'll continue
89
+	 * where we left off.
90
+	 */
91
+	public function visit($model_objects_to_identify)
92
+	{
93
+		if (! $this->isDiscovered()) {
94
+			$this->discover();
95
+		}
96
+		if ($this->isComplete()) {
97
+			return 0;
98
+		}
99
+		return $this->work($model_objects_to_identify);
100
+	}
101 101
 
102
-    /**
103
-     * Gets the IDs of completely identified model objects that can be deleted.
104
-     * @since 4.10.12.p
105
-     * @return mixed
106
-     */
107
-    abstract public function getIds();
102
+	/**
103
+	 * Gets the IDs of completely identified model objects that can be deleted.
104
+	 * @since 4.10.12.p
105
+	 * @return mixed
106
+	 */
107
+	abstract public function getIds();
108 108
 
109
-    /**
110
-     * Make sure we encode whether its complete or not, but don't use such a long name.
111
-     * @since 4.10.12.p
112
-     * @return array
113
-     */
114
-    public function __sleep()
115
-    {
116
-        $this->c = $this->complete;
117
-        $this->dtm = $this->dont_traverse_models;
118
-        return [
119
-            'c',
120
-            'dtm'
121
-        ];
122
-    }
109
+	/**
110
+	 * Make sure we encode whether its complete or not, but don't use such a long name.
111
+	 * @since 4.10.12.p
112
+	 * @return array
113
+	 */
114
+	public function __sleep()
115
+	{
116
+		$this->c = $this->complete;
117
+		$this->dtm = $this->dont_traverse_models;
118
+		return [
119
+			'c',
120
+			'dtm'
121
+		];
122
+	}
123 123
 
124
-    /**
125
-     * Use the dynamic property to set the "complete" property.
126
-     * @since 4.10.12.p
127
-     */
128
-    public function __wakeup()
129
-    {
130
-        $this->complete = $this->c;
131
-        $this->dont_traverse_models = $this->dtm;
132
-    }
124
+	/**
125
+	 * Use the dynamic property to set the "complete" property.
126
+	 * @since 4.10.12.p
127
+	 */
128
+	public function __wakeup()
129
+	{
130
+		$this->complete = $this->c;
131
+		$this->dont_traverse_models = $this->dtm;
132
+	}
133 133
 }
134 134
 // End of file BaseNode.php
135 135
 // Location: EventEspresso\core\services\orm\tree_traversal/BaseNode.php
Please login to merge, or discard this patch.
core/db_classes/EE_Price.class.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -419,7 +419,7 @@
 block discarded – undo
419 419
     {
420 420
         return ! $this->is_percent()
421 421
             ? $this->get_pretty('PRC_amount')
422
-            : $this->get('PRC_amount') . '%';
422
+            : $this->get('PRC_amount').'%';
423 423
     }
424 424
 
425 425
 
Please login to merge, or discard this patch.
Indentation   +369 added lines, -369 removed lines patch added patch discarded remove patch
@@ -14,373 +14,373 @@
 block discarded – undo
14 14
  */
15 15
 class EE_Price extends EE_Soft_Delete_Base_Class
16 16
 {
17
-    /**
18
-     * @param array  $props_n_values          incoming values
19
-     * @param string $timezone                incoming timezone (if not set the timezone set for the website will be
20
-     *                                        used.)
21
-     * @param array  $date_formats            incoming date_formats in an array where the first value is the
22
-     *                                        date_format and the second value is the time format
23
-     * @return EE_Price
24
-     * @throws EE_Error
25
-     * @throws ReflectionException
26
-     */
27
-    public static function new_instance($props_n_values = [], $timezone = '', $date_formats = [])
28
-    {
29
-        $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
30
-        return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
31
-    }
32
-
33
-
34
-    /**
35
-     * @param array  $props_n_values  incoming values from the database
36
-     * @param string $timezone        incoming timezone as set by the model.  If not set the timezone for
37
-     *                                the website will be used.
38
-     * @return EE_Price
39
-     * @throws EE_Error
40
-     * @throws ReflectionException
41
-     */
42
-    public static function new_instance_from_db($props_n_values = [], $timezone = '')
43
-    {
44
-        return new self($props_n_values, true, $timezone);
45
-    }
46
-
47
-
48
-    /**
49
-     * Set Price type ID
50
-     *
51
-     * @param int $PRT_ID
52
-     * @throws EE_Error
53
-     * @throws ReflectionException
54
-     */
55
-    public function set_type($PRT_ID = 0)
56
-    {
57
-        $this->set('PRT_ID', $PRT_ID);
58
-    }
59
-
60
-
61
-    /**
62
-     * Set Price Amount
63
-     *
64
-     * @param float $PRC_amount
65
-     * @throws EE_Error
66
-     * @throws ReflectionException
67
-     */
68
-    public function set_amount($PRC_amount = 0.00)
69
-    {
70
-        $this->set('PRC_amount', $PRC_amount);
71
-    }
72
-
73
-
74
-    /**
75
-     * Set Price Name
76
-     *
77
-     * @param string $PRC_name
78
-     * @throws EE_Error
79
-     * @throws ReflectionException
80
-     */
81
-    public function set_name($PRC_name = '')
82
-    {
83
-        $this->set('PRC_name', $PRC_name);
84
-    }
85
-
86
-
87
-    /**
88
-     * Set Price Description
89
-     *
90
-     * @param string $PRC_desc
91
-     * @throws EE_Error
92
-     * @throws ReflectionException
93
-     */
94
-    public function set_description($PRC_desc = '')
95
-    {
96
-        $this->Set('PRC_desc', $PRC_desc);
97
-    }
98
-
99
-
100
-    /**
101
-     * set is_default
102
-     *
103
-     * @param bool $PRC_is_default
104
-     * @throws EE_Error
105
-     * @throws ReflectionException
106
-     */
107
-    public function set_is_default($PRC_is_default = false)
108
-    {
109
-        $this->set('PRC_is_default', $PRC_is_default);
110
-    }
111
-
112
-
113
-    /**
114
-     * set deleted
115
-     *
116
-     * @param bool $PRC_deleted
117
-     * @throws EE_Error
118
-     * @throws ReflectionException
119
-     */
120
-    public function set_deleted($PRC_deleted = null)
121
-    {
122
-        $this->set('PRC_deleted', $PRC_deleted);
123
-    }
124
-
125
-
126
-    /**
127
-     * get Price type
128
-     *
129
-     * @return int
130
-     * @throws EE_Error
131
-     * @throws ReflectionException
132
-     */
133
-    public function type(): int
134
-    {
135
-        return (int) $this->get('PRT_ID');
136
-    }
137
-
138
-
139
-    /**
140
-     * get Price Amount
141
-     *
142
-     * @return float
143
-     * @throws EE_Error
144
-     * @throws ReflectionException
145
-     */
146
-    public function amount(): float
147
-    {
148
-        return (float) $this->get('PRC_amount');
149
-    }
150
-
151
-
152
-    /**
153
-     * get Price Name
154
-     *
155
-     * @return        string
156
-     * @throws EE_Error
157
-     * @throws ReflectionException
158
-     */
159
-    public function name()
160
-    {
161
-        return $this->get('PRC_name');
162
-    }
163
-
164
-
165
-    /**
166
-     * get Price description
167
-     *
168
-     * @return        string
169
-     * @throws EE_Error
170
-     * @throws ReflectionException
171
-     */
172
-    public function desc()
173
-    {
174
-        return $this->get('PRC_desc');
175
-    }
176
-
177
-
178
-    /**
179
-     * get overrides
180
-     *
181
-     * @return        int
182
-     * @throws EE_Error
183
-     * @throws ReflectionException
184
-     */
185
-    public function overrides()
186
-    {
187
-        return $this->get('PRC_overrides');
188
-    }
189
-
190
-
191
-    /**
192
-     * get order
193
-     *
194
-     * @return int
195
-     * @throws EE_Error
196
-     * @throws ReflectionException
197
-     */
198
-    public function order()
199
-    {
200
-        return $this->get('PRC_order');
201
-    }
202
-
203
-
204
-    /**
205
-     * get the author of the price
206
-     *
207
-     * @return int
208
-     * @throws EE_Error
209
-     * @throws ReflectionException
210
-     * @since 4.5.0
211
-     */
212
-    public function wp_user()
213
-    {
214
-        return $this->get('PRC_wp_user');
215
-    }
216
-
217
-
218
-    /**
219
-     * get is_default
220
-     *
221
-     * @return bool
222
-     * @throws EE_Error
223
-     * @throws ReflectionException
224
-     */
225
-    public function is_default()
226
-    {
227
-        return $this->get('PRC_is_default');
228
-    }
229
-
230
-
231
-    /**
232
-     * get deleted
233
-     *
234
-     * @return bool
235
-     * @throws EE_Error
236
-     * @throws ReflectionException
237
-     */
238
-    public function deleted()
239
-    {
240
-        return $this->get('PRC_deleted');
241
-    }
242
-
243
-
244
-    /**
245
-     * @return bool
246
-     * @throws EE_Error
247
-     * @throws ReflectionException
248
-     */
249
-    public function parent()
250
-    {
251
-        return $this->get('PRC_parent');
252
-    }
253
-
254
-
255
-    // some helper methods for getting info on the price_type for this price
256
-
257
-    /**
258
-     * @return EE_Price_Type|null
259
-     * @throws EE_Error
260
-     * @throws ReflectionException
261
-     */
262
-    public function type_obj(): ?EE_Price_Type
263
-    {
264
-        return $this->get_first_related('Price_Type');
265
-    }
266
-
267
-
268
-    /**
269
-     * @return int
270
-     * @throws EE_Error
271
-     * @throws ReflectionException
272
-     */
273
-    public function type_order(): int
274
-    {
275
-        $price_type = $this->type_obj();
276
-        return $price_type instanceof EE_Price_Type ? $price_type->order() : 0;
277
-    }
278
-
279
-
280
-    /**
281
-     * return whether the price is a base price or not
282
-     *
283
-     * @return bool
284
-     * @throws EE_Error
285
-     * @throws InvalidArgumentException
286
-     * @throws InvalidDataTypeException
287
-     * @throws InvalidInterfaceException
288
-     * @throws ReflectionException
289
-     */
290
-    public function is_base_price(): bool
291
-    {
292
-        $price_type = $this->type_obj();
293
-        return $price_type instanceof EE_Price_Type && $price_type->is_base_price();
294
-    }
295
-
296
-
297
-    /**
298
-     * Simply indicates whether this price increases or decreases the total
299
-     *
300
-     * @return bool true = discount, otherwise adds to the total
301
-     * @throws EE_Error
302
-     * @throws ReflectionException
303
-     */
304
-    public function is_discount(): bool
305
-    {
306
-        $price_type = $this->type_obj();
307
-        return $price_type instanceof EE_Price_Type && $price_type->is_discount();
308
-    }
309
-
310
-
311
-    /**
312
-     * whether the price is a percentage or not
313
-     *
314
-     * @return bool
315
-     * @throws EE_Error
316
-     * @throws InvalidArgumentException
317
-     * @throws InvalidDataTypeException
318
-     * @throws InvalidInterfaceException
319
-     * @throws ReflectionException
320
-     */
321
-    public function is_percent(): bool
322
-    {
323
-        $price_type = $this->type_obj();
324
-        return $price_type instanceof EE_Price_Type && $price_type->is_percent();
325
-    }
326
-
327
-
328
-    /**
329
-     * whether the price is a percentage or not
330
-     *
331
-     * @return bool
332
-     * @throws EE_Error
333
-     * @throws ReflectionException
334
-     */
335
-    public function is_surcharge(): bool
336
-    {
337
-        $price_type = $this->type_obj();
338
-        return $price_type instanceof EE_Price_Type && $price_type->is_surcharge();
339
-    }
340
-
341
-
342
-
343
-    /**
344
-     * whether the price is a percentage or not
345
-     *
346
-     * @return bool
347
-     * @throws EE_Error
348
-     * @throws ReflectionException
349
-     */
350
-    public function is_tax(): bool
351
-    {
352
-        $price_type = $this->type_obj();
353
-        return $price_type instanceof EE_Price_Type && $price_type->is_tax();
354
-    }
355
-
356
-
357
-    /**
358
-     * return pretty price dependant on whether its a dollar or percent.
359
-     *
360
-     * @return string
361
-     * @throws EE_Error
362
-     * @throws ReflectionException
363
-     * @since 4.4.0
364
-     */
365
-    public function pretty_price(): string
366
-    {
367
-        return ! $this->is_percent()
368
-            ? $this->get_pretty('PRC_amount')
369
-            : $this->get('PRC_amount') . '%';
370
-    }
371
-
372
-
373
-    /**
374
-     * @return mixed
375
-     * @throws EE_Error
376
-     * @throws ReflectionException
377
-     */
378
-    public function get_price_without_currency_symbol()
379
-    {
380
-        return str_replace(
381
-            EE_Registry::instance()->CFG->currency->sign,
382
-            '',
383
-            $this->get_pretty('PRC_amount')
384
-        );
385
-    }
17
+	/**
18
+	 * @param array  $props_n_values          incoming values
19
+	 * @param string $timezone                incoming timezone (if not set the timezone set for the website will be
20
+	 *                                        used.)
21
+	 * @param array  $date_formats            incoming date_formats in an array where the first value is the
22
+	 *                                        date_format and the second value is the time format
23
+	 * @return EE_Price
24
+	 * @throws EE_Error
25
+	 * @throws ReflectionException
26
+	 */
27
+	public static function new_instance($props_n_values = [], $timezone = '', $date_formats = [])
28
+	{
29
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
30
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
31
+	}
32
+
33
+
34
+	/**
35
+	 * @param array  $props_n_values  incoming values from the database
36
+	 * @param string $timezone        incoming timezone as set by the model.  If not set the timezone for
37
+	 *                                the website will be used.
38
+	 * @return EE_Price
39
+	 * @throws EE_Error
40
+	 * @throws ReflectionException
41
+	 */
42
+	public static function new_instance_from_db($props_n_values = [], $timezone = '')
43
+	{
44
+		return new self($props_n_values, true, $timezone);
45
+	}
46
+
47
+
48
+	/**
49
+	 * Set Price type ID
50
+	 *
51
+	 * @param int $PRT_ID
52
+	 * @throws EE_Error
53
+	 * @throws ReflectionException
54
+	 */
55
+	public function set_type($PRT_ID = 0)
56
+	{
57
+		$this->set('PRT_ID', $PRT_ID);
58
+	}
59
+
60
+
61
+	/**
62
+	 * Set Price Amount
63
+	 *
64
+	 * @param float $PRC_amount
65
+	 * @throws EE_Error
66
+	 * @throws ReflectionException
67
+	 */
68
+	public function set_amount($PRC_amount = 0.00)
69
+	{
70
+		$this->set('PRC_amount', $PRC_amount);
71
+	}
72
+
73
+
74
+	/**
75
+	 * Set Price Name
76
+	 *
77
+	 * @param string $PRC_name
78
+	 * @throws EE_Error
79
+	 * @throws ReflectionException
80
+	 */
81
+	public function set_name($PRC_name = '')
82
+	{
83
+		$this->set('PRC_name', $PRC_name);
84
+	}
85
+
86
+
87
+	/**
88
+	 * Set Price Description
89
+	 *
90
+	 * @param string $PRC_desc
91
+	 * @throws EE_Error
92
+	 * @throws ReflectionException
93
+	 */
94
+	public function set_description($PRC_desc = '')
95
+	{
96
+		$this->Set('PRC_desc', $PRC_desc);
97
+	}
98
+
99
+
100
+	/**
101
+	 * set is_default
102
+	 *
103
+	 * @param bool $PRC_is_default
104
+	 * @throws EE_Error
105
+	 * @throws ReflectionException
106
+	 */
107
+	public function set_is_default($PRC_is_default = false)
108
+	{
109
+		$this->set('PRC_is_default', $PRC_is_default);
110
+	}
111
+
112
+
113
+	/**
114
+	 * set deleted
115
+	 *
116
+	 * @param bool $PRC_deleted
117
+	 * @throws EE_Error
118
+	 * @throws ReflectionException
119
+	 */
120
+	public function set_deleted($PRC_deleted = null)
121
+	{
122
+		$this->set('PRC_deleted', $PRC_deleted);
123
+	}
124
+
125
+
126
+	/**
127
+	 * get Price type
128
+	 *
129
+	 * @return int
130
+	 * @throws EE_Error
131
+	 * @throws ReflectionException
132
+	 */
133
+	public function type(): int
134
+	{
135
+		return (int) $this->get('PRT_ID');
136
+	}
137
+
138
+
139
+	/**
140
+	 * get Price Amount
141
+	 *
142
+	 * @return float
143
+	 * @throws EE_Error
144
+	 * @throws ReflectionException
145
+	 */
146
+	public function amount(): float
147
+	{
148
+		return (float) $this->get('PRC_amount');
149
+	}
150
+
151
+
152
+	/**
153
+	 * get Price Name
154
+	 *
155
+	 * @return        string
156
+	 * @throws EE_Error
157
+	 * @throws ReflectionException
158
+	 */
159
+	public function name()
160
+	{
161
+		return $this->get('PRC_name');
162
+	}
163
+
164
+
165
+	/**
166
+	 * get Price description
167
+	 *
168
+	 * @return        string
169
+	 * @throws EE_Error
170
+	 * @throws ReflectionException
171
+	 */
172
+	public function desc()
173
+	{
174
+		return $this->get('PRC_desc');
175
+	}
176
+
177
+
178
+	/**
179
+	 * get overrides
180
+	 *
181
+	 * @return        int
182
+	 * @throws EE_Error
183
+	 * @throws ReflectionException
184
+	 */
185
+	public function overrides()
186
+	{
187
+		return $this->get('PRC_overrides');
188
+	}
189
+
190
+
191
+	/**
192
+	 * get order
193
+	 *
194
+	 * @return int
195
+	 * @throws EE_Error
196
+	 * @throws ReflectionException
197
+	 */
198
+	public function order()
199
+	{
200
+		return $this->get('PRC_order');
201
+	}
202
+
203
+
204
+	/**
205
+	 * get the author of the price
206
+	 *
207
+	 * @return int
208
+	 * @throws EE_Error
209
+	 * @throws ReflectionException
210
+	 * @since 4.5.0
211
+	 */
212
+	public function wp_user()
213
+	{
214
+		return $this->get('PRC_wp_user');
215
+	}
216
+
217
+
218
+	/**
219
+	 * get is_default
220
+	 *
221
+	 * @return bool
222
+	 * @throws EE_Error
223
+	 * @throws ReflectionException
224
+	 */
225
+	public function is_default()
226
+	{
227
+		return $this->get('PRC_is_default');
228
+	}
229
+
230
+
231
+	/**
232
+	 * get deleted
233
+	 *
234
+	 * @return bool
235
+	 * @throws EE_Error
236
+	 * @throws ReflectionException
237
+	 */
238
+	public function deleted()
239
+	{
240
+		return $this->get('PRC_deleted');
241
+	}
242
+
243
+
244
+	/**
245
+	 * @return bool
246
+	 * @throws EE_Error
247
+	 * @throws ReflectionException
248
+	 */
249
+	public function parent()
250
+	{
251
+		return $this->get('PRC_parent');
252
+	}
253
+
254
+
255
+	// some helper methods for getting info on the price_type for this price
256
+
257
+	/**
258
+	 * @return EE_Price_Type|null
259
+	 * @throws EE_Error
260
+	 * @throws ReflectionException
261
+	 */
262
+	public function type_obj(): ?EE_Price_Type
263
+	{
264
+		return $this->get_first_related('Price_Type');
265
+	}
266
+
267
+
268
+	/**
269
+	 * @return int
270
+	 * @throws EE_Error
271
+	 * @throws ReflectionException
272
+	 */
273
+	public function type_order(): int
274
+	{
275
+		$price_type = $this->type_obj();
276
+		return $price_type instanceof EE_Price_Type ? $price_type->order() : 0;
277
+	}
278
+
279
+
280
+	/**
281
+	 * return whether the price is a base price or not
282
+	 *
283
+	 * @return bool
284
+	 * @throws EE_Error
285
+	 * @throws InvalidArgumentException
286
+	 * @throws InvalidDataTypeException
287
+	 * @throws InvalidInterfaceException
288
+	 * @throws ReflectionException
289
+	 */
290
+	public function is_base_price(): bool
291
+	{
292
+		$price_type = $this->type_obj();
293
+		return $price_type instanceof EE_Price_Type && $price_type->is_base_price();
294
+	}
295
+
296
+
297
+	/**
298
+	 * Simply indicates whether this price increases or decreases the total
299
+	 *
300
+	 * @return bool true = discount, otherwise adds to the total
301
+	 * @throws EE_Error
302
+	 * @throws ReflectionException
303
+	 */
304
+	public function is_discount(): bool
305
+	{
306
+		$price_type = $this->type_obj();
307
+		return $price_type instanceof EE_Price_Type && $price_type->is_discount();
308
+	}
309
+
310
+
311
+	/**
312
+	 * whether the price is a percentage or not
313
+	 *
314
+	 * @return bool
315
+	 * @throws EE_Error
316
+	 * @throws InvalidArgumentException
317
+	 * @throws InvalidDataTypeException
318
+	 * @throws InvalidInterfaceException
319
+	 * @throws ReflectionException
320
+	 */
321
+	public function is_percent(): bool
322
+	{
323
+		$price_type = $this->type_obj();
324
+		return $price_type instanceof EE_Price_Type && $price_type->is_percent();
325
+	}
326
+
327
+
328
+	/**
329
+	 * whether the price is a percentage or not
330
+	 *
331
+	 * @return bool
332
+	 * @throws EE_Error
333
+	 * @throws ReflectionException
334
+	 */
335
+	public function is_surcharge(): bool
336
+	{
337
+		$price_type = $this->type_obj();
338
+		return $price_type instanceof EE_Price_Type && $price_type->is_surcharge();
339
+	}
340
+
341
+
342
+
343
+	/**
344
+	 * whether the price is a percentage or not
345
+	 *
346
+	 * @return bool
347
+	 * @throws EE_Error
348
+	 * @throws ReflectionException
349
+	 */
350
+	public function is_tax(): bool
351
+	{
352
+		$price_type = $this->type_obj();
353
+		return $price_type instanceof EE_Price_Type && $price_type->is_tax();
354
+	}
355
+
356
+
357
+	/**
358
+	 * return pretty price dependant on whether its a dollar or percent.
359
+	 *
360
+	 * @return string
361
+	 * @throws EE_Error
362
+	 * @throws ReflectionException
363
+	 * @since 4.4.0
364
+	 */
365
+	public function pretty_price(): string
366
+	{
367
+		return ! $this->is_percent()
368
+			? $this->get_pretty('PRC_amount')
369
+			: $this->get('PRC_amount') . '%';
370
+	}
371
+
372
+
373
+	/**
374
+	 * @return mixed
375
+	 * @throws EE_Error
376
+	 * @throws ReflectionException
377
+	 */
378
+	public function get_price_without_currency_symbol()
379
+	{
380
+		return str_replace(
381
+			EE_Registry::instance()->CFG->currency->sign,
382
+			'',
383
+			$this->get_pretty('PRC_amount')
384
+		);
385
+	}
386 386
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/enums/DatetimesConnectionOrderbyEnum.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
      */
21 21
     public function __construct()
22 22
     {
23
-        $this->setName($this->namespace . 'DatetimesConnectionOrderbyEnum');
23
+        $this->setName($this->namespace.'DatetimesConnectionOrderbyEnum');
24 24
         $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
25 25
         parent::__construct();
26 26
     }
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -14,31 +14,31 @@
 block discarded – undo
14 14
  */
15 15
 class DatetimesConnectionOrderbyEnum extends EnumBase
16 16
 {
17
-    /**
18
-     * DatetimesConnectionOrderbyEnum constructor.
19
-     */
20
-    public function __construct()
21
-    {
22
-        $this->setName($this->namespace . 'DatetimesConnectionOrderbyEnum');
23
-        $this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
24
-        parent::__construct();
25
-    }
17
+	/**
18
+	 * DatetimesConnectionOrderbyEnum constructor.
19
+	 */
20
+	public function __construct()
21
+	{
22
+		$this->setName($this->namespace . 'DatetimesConnectionOrderbyEnum');
23
+		$this->setDescription(esc_html__('Field to order the connection by', 'event_espresso'));
24
+		parent::__construct();
25
+	}
26 26
 
27 27
 
28
-    /**
29
-     * @return array
30
-     */
31
-    protected function getValues(): array
32
-    {
33
-        return [
34
-            'NAME'     => [
35
-                'value'       => 'DTT_name',
36
-                'description' => esc_html__('Order by name', 'event_espresso'),
37
-            ],
38
-            'START_DATE'     => [
39
-                'value'       => 'DTT_EVT_start',
40
-                'description' => esc_html__('Order by start date', 'event_espresso'),
41
-            ],
42
-        ];
43
-    }
28
+	/**
29
+	 * @return array
30
+	 */
31
+	protected function getValues(): array
32
+	{
33
+		return [
34
+			'NAME'     => [
35
+				'value'       => 'DTT_name',
36
+				'description' => esc_html__('Order by name', 'event_espresso'),
37
+			],
38
+			'START_DATE'     => [
39
+				'value'       => 'DTT_EVT_start',
40
+				'description' => esc_html__('Order by start date', 'event_espresso'),
41
+			],
42
+		];
43
+	}
44 44
 }
Please login to merge, or discard this patch.