Steverobbins_Slack_Model_Api_Chat::postMessage()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 7
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
/**
3
 * Slack.com Integration
4
 *
5
 * PHP Version 5
6
 *
7
 * @category  Steverobbins
8
 * @package   Steverobbins_Slack
9
 * @author    Steve Robbins <[email protected]>
10
 * @copyright Copyright 2015 Steve Robbins (http://steverobbins.com)
11
 * @license   http://creativecommons.org/licenses/by/3.0/deed.en_US Creative Commons Attribution 3.0 Unported License
12
 */
13
14
/**
15
 * Chat API method
16
 */
17
class Steverobbins_Slack_Model_Api_Chat extends Steverobbins_Slack_Model_Api_Abstract
18
{
19
    /**
20
     * Set method data
21
     */
22
    public function __construct()
23
    {
24
        $this->setMethod('chat');
25
    }
26
27
    /**
28
     * Add username if not supplied
29
     *
30
     * @return Steverobbins_Slack_Model_Api_Chat
31
     */
32
    public function postMessage()
33
    {
34
        if (!$this->hasUsername()) {
35
            $this->setUsername(Mage::getSingleton('slack/config_settings')->getBotName());
36
        }
37
        return parent::postMessage();
38
    }
39
}
40