Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
5 / 5
HttpStack
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
5 / 5
 register
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
5 / 5
<?php
declare(strict_types=1);
namespace Korobochkin\WPKit\AlmostControllers;
/**
 * Class HttpStack
 *
 * Handle HTTP requests addressed to wp-admin/admin-post.php.
 */
class HttpStack extends Stack
{
    /**
     * @inheritdoc
     */
    public function register()
    {
        if (empty($this->actions)) {
            throw new \LogicException('You need set actions before call register method.');
        }
        add_action('admin_post_'        . $this->actionName, array($this, 'handleRequest'));
        add_action('admin_post_nopriv_' . $this->actionName, array($this, 'handleRequest'));
        return $this;
    }
}