src/CheckMKStaticTag.php
public function create($title, $tag = null, $group = null, $description = null) {
        $params = [
            'data' => [
                'title' => $title
            ]
        ];

        if (isset($tag)) {
            $params['data']['tag'] = $tag;
        }

        if (isset($group)) {
            $params['data']['group'] = $group;
        }

        if (isset($group)) {
            $params['data']['description'] = $description;
        }

        $result = $this->api->request(
            'checkmk.statictag.create',
            $params
        );

        if (!array_key_exists('id', $result) ||
            !is_numeric($result['id']) ||
            !array_key_exists('success', $result) ||
            $result['success'] !== true) {
            if (array_key_exists('message', $result)) {
                throw new RuntimeException(sprintf('Bad result: %s', $result['message']));
            } else {
                throw new RuntimeException('Bad result');
            }
        }

        return (int) $result['id'];
    }
public function create($title, $tag = null, $group = null, $description = null) {
        $params = [
            'data' => [
                'title' => $title
            ]
        ];

        if (isset($tag)) {
            $params['data']['tag'] = $tag;
        }

        if (isset($group)) {
            $params['data']['group'] = $group;
        }

        if (isset($group)) {
            $params['data']['description'] = $description;
        }

        $result = $this->api->request(
            'checkmk.statictag.create',
            $params
        );

        if (!array_key_exists('id', $result) ||
            !is_numeric($result['id']) ||
            !array_key_exists('success', $result) ||
            $result['success'] !== true) {
            if (array_key_exists('message', $result)) {
                throw new RuntimeException(sprintf('Bad result: %s', $result['message']));
            } else {
                throw new RuntimeException('Bad result');
            }
        }

        return (int) $result['id'];
    }
public function create ( $ title , $ tag = null , $ group = null , $ description = null ) { $ params = [ 'data' => [ 'title' => $ title ] ] ; if ( isset ( $ tag ) ) { $ params [ 'data' ] [ 'tag' ] = $ tag ; } if ( isset ( $ group ) ) { $ params [ 'data' ] [ 'group' ] = $ group ; } if ( isset ( $ group ) ) { $ params [ 'data' ] [ 'description' ] = $ description ; } $ result = $ this -> api -> request ( 'checkmk.statictag.create' , $ params ) ; if ( ! array_key_exists ( 'id' , $ result ) || ! is_numeric ( $ result [ 'id' ] ) || ! array_key_exists ( 'success' , $ result ) || $ result [ 'success' ] !== true ) { if ( array_key_exists ( 'message' , $ result ) ) { throw new RuntimeException ( sprintf ( 'Bad result: %s' , $ result [ 'message' ] ) ) ; } else { throw new RuntimeException ( 'Bad result' ) ; } } return ( int ) $ result [ 'id' ] ; }
Create a new static host tag

@param string $title Name
@param string $tag Tag ID
@param string $group Optional associated host group
@param string $description Optional description

@return int Identifier

@throws Exception on error
Create a new static host tag