Completed
Push — master ( da17ac...286914 )
by George
03:50
created

ValidateVersion   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 16
ccs 2
cts 2
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateVersionNumber() 0 4 2
1
<?php
2
3
namespace Stats\Decorators;
4
5
/**
6
 * Decorator for objects which validate a version number.
7
 *
8
 * @since  1.0
9
 */
10
trait ValidateVersion
11
{
12
	/**
13
	 * Validates and filters the version number
14
	 *
15
	 * @param   string  $version  The version string to validate.
16
	 *
17
	 * @return  string|boolean  A validated version number on success or boolean false.
18
	 *
19
	 * @since   1.0
20
	 */
21 3
	protected function validateVersionNumber($version)
22
	{
23 3
		return preg_match('/\d+(?:\.\d+)+/', $version, $matches) ? $matches[0] : false;
24
	}
25
}
26