protected function addAccessRule(Application $app, $pattern, $roles) {
        $security = $app['security.access_rules'];
        $key = is_object($pattern) ? spl_object_hash($pattern) : $pattern;
        $security[$key] = [
            $pattern,
            $roles
        ];

        $app['security.access_rules'] = $security;
    }