CommandFormatException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 10
c 0
b 0
f 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
1
<?php
2
/**
3
 * Livia
4
 * Copyright 2017-2019 Charlotte Dunois, All Rights Reserved
5
 *
6
 * Website: https://charuru.moe
7
 * License: https://github.com/CharlotteDunois/Livia/blob/master/LICENSE
8
*/
9
10
namespace CharlotteDunois\Livia\Exceptions;
11
12
/**
13
 * Has a descriptive message for a command not having proper format.
14
 */
15
class CommandFormatException extends FriendlyException {
16
    /**
17
     * @param \CharlotteDunois\Livia\Commands\Context  $context
18
     * @internal
19
     */
20
    function __construct(\CharlotteDunois\Livia\Commands\Context $context) {
21
        $prefix = $context->client->getGuildPrefix($context->message->guild);
22
        
23
        parent::__construct('Invalid command usage. The `'.$context->command->name.'` command\'s accepted format is: '.
24
        $context->command->usage($context->command->format, $prefix).'. Use '.\CharlotteDunois\Livia\Commands\Command::anyUsage('help '.$context->command->name, $prefix).' for more information.');
25
    }
26
}
27