Subversion Repositories php-qbpwcf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
<?php
2
namespace Ratchet\RFC6455\Messaging;
3
 
4
class CloseFrameChecker {
5
    private $validCloseCodes = [];
6
 
7
    public function __construct() {
8
        $this->validCloseCodes = [
9
            Frame::CLOSE_NORMAL,
10
            Frame::CLOSE_GOING_AWAY,
11
            Frame::CLOSE_PROTOCOL,
12
            Frame::CLOSE_BAD_DATA,
13
            Frame::CLOSE_BAD_PAYLOAD,
14
            Frame::CLOSE_POLICY,
15
            Frame::CLOSE_TOO_BIG,
16
            Frame::CLOSE_MAND_EXT,
17
            Frame::CLOSE_SRV_ERR,
18
        ];
19
    }
20
 
21
    public function __invoke($val) {
22
        return ($val >= 3000 && $val <= 4999) || in_array($val, $this->validCloseCodes);
23
    }
24
}