Passed
Pull Request — master (#31)
by
unknown
05:10
created

ContactFormExtensionsVariable   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A submissions() 0 7 2
A name() 0 3 1
A recaptcha() 0 7 2
1
<?php
2
/**
3
 * schema plugin for Craft CMS 3.x.
4
 *
5
 * A fluent builder Schema.org types and ld+json generator based on Spatie's schema-org package
6
 *
7
 * @link      https://rias.be
8
 *
9
 * @copyright Copyright (c) 2017 Rias
10
 */
11
12
namespace rias\contactformextensions\variables;
13
14
use rias\contactformextensions\ContactFormExtensions;
15
use rias\contactformextensions\elements\ContactFormSubmission;
16
use rias\contactformextensions\elements\db\ContactFormSubmissionQuery;
17
18
/**
19
 * @author    Rias
20
 *
21
 * @since     1.0.0
22
 */
23
class ContactFormExtensionsVariable
24
{
25
    public function name()
26
    {
27
        return ContactFormExtensions::$plugin->name;
28
    }
29
30
    public function recaptcha()
31
    {
32
        if (ContactFormExtensions::$plugin->settings->recaptcha) {
33
            return ContactFormExtensions::$plugin->contactFormExtensionsService->getRecaptcha()->render();
34
        }
35
36
        return '';
37
    }
38
    
39
    public function submissions($criteria = null): ContactFormSubmissionQuery
40
    {
41
        $query = ContactFormSubmission::find();
42
        if ($criteria) {
43
            Craft::configure($query, $criteria);
0 ignored issues
show
Bug introduced by
The type rias\contactformextensions\variables\Craft was not found. Did you mean Craft? If so, make sure to prefix the type with \.
Loading history...
44
        }
45
        return $query;
46
    }
47
}
48