CreateFunction::setBody()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 3
eloc 4
c 2
b 0
f 1
nc 2
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
4
namespace Manticoresearch\Endpoints\Nodes;
5
6
use Manticoresearch\Endpoints\EmulateBySql;
7
use Manticoresearch\Exceptions\RuntimeException;
8
9
class CreateFunction extends EmulateBySql
10
{
11
    /**
12
     * @var string
13
     */
14
    protected $index;
15
16
    public function setBody($params = null)
17
    {
18
        if (isset($params['name'], $params['type']) && $params['library']) {
19
            return parent::setBody(['query' => "CREATE FUNCTION " . $params['name'] . " RETURNS " .
20
                strtoupper($params['type']) . " SONAME " . $params['library']]);
21
        }
22
        throw new RuntimeException('Incomplete request for /nodes/createplugin');
23
    }
24
}
25