Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
CRAP
100.00% covered (success)
100.00%
1 / 1
Space
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
6 / 6
6
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 set
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 exist
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 notExist
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 only
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 notOnly
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * @license MIT
5 * @author hazuki3417<hazuki3417@gmail.com>
6 * @copyright 2021 hazuki3417 all rights reserved.
7 */
8
9namespace Selen\Str\Verify;
10
11class Space
12{
13    /** @var string 検証対象の文字列 */
14    private $str;
15
16    private function __construct(string $val)
17    {
18        $this->str = $val;
19    }
20
21    public static function set(string $val): Space
22    {
23        return new self($val);
24    }
25
26    public function exist(): bool
27    {
28        return \preg_match('/[\s ]+/', $this->str);
29    }
30
31    public function notExist(): bool
32    {
33        return !$this->exist();
34    }
35
36    public function only(): bool
37    {
38        return \preg_match('/^[\s ]+$/', $this->str);
39    }
40
41    public function notOnly(): bool
42    {
43        return !$this->only();
44    }
45}