Completed
Push — master ( 053e09...4ba1a0 )
by Sudar
02:24
created

License::get_download_url()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php namespace EmailLog\License;
2
3
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
4
5
/**
6
 * EmailLog License.
7
 *
8
 * @since 2.0.0
9
 */
10
class License extends BaseLicense {
11
12
	public function is_valid() {
13
		if ( ! $this->license_data instanceof \stdClass || ! isset( $this->license_data->license ) ) {
14
			return false;
15
		}
16
17
		return ( 'valid' === $this->license_data->license );
18
	}
19
20
	public function get_license_key() {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
21
		if ( empty( $this->license_data ) ) {
22
			return parent::get_license_key();
23
		}
24
25
		return $this->license_data->license_key;
26
	}
27
28
	/**
29
	 * Option name in which individual license data is stored.
30
	 * This method should be called only after setting the add-on name.
31
	 *
32
	 * @return string Option name.
33
	 */
34
	protected function get_option_name() {
35
		return 'el_license_' . md5( $this->get_addon_name() );
36
	}
37
}
38