class-freemius-entity.php
5 months ago
class-freemius-license.php
5 months ago
class-freemius-plugin.php
5 months ago
class-freemius-scope.php
5 months ago
class-freemius-site.php
5 months ago
class-freemius-user.php
5 months ago
index.php
6 months ago
class-freemius-user.php
77 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WBCR\Factory_Freemius_Rio_600\Entities; |
| 4 | |
| 5 | if ( ! defined( 'ABSPATH' ) ) { |
| 6 | exit; |
| 7 | } |
| 8 | |
| 9 | /** |
| 10 | * @version 1.0 |
| 11 | */ |
| 12 | class User extends Scope { |
| 13 | |
| 14 | /** |
| 15 | * @var string |
| 16 | */ |
| 17 | public $email; |
| 18 | |
| 19 | /** |
| 20 | * @var string |
| 21 | */ |
| 22 | public $first; |
| 23 | |
| 24 | /** |
| 25 | * @var string |
| 26 | */ |
| 27 | public $last; |
| 28 | |
| 29 | /** |
| 30 | * @var bool |
| 31 | */ |
| 32 | public $is_verified; |
| 33 | |
| 34 | /** |
| 35 | * @var string|null |
| 36 | */ |
| 37 | public $customer_id; |
| 38 | |
| 39 | /** |
| 40 | * @var float |
| 41 | */ |
| 42 | public $gross; |
| 43 | |
| 44 | /** |
| 45 | * @param object|bool $user |
| 46 | */ |
| 47 | public function __construct( $user = false ) { |
| 48 | parent::__construct( $user ); |
| 49 | $props = get_object_vars( $this ); |
| 50 | |
| 51 | foreach ( $props as $key => $def_value ) { |
| 52 | $this->{$key} = isset( $user->{'user_' . $key} ) ? $user->{'user_' . $key} : $def_value; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * @return string |
| 58 | */ |
| 59 | public function get_name() { |
| 60 | return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) ); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * @return bool |
| 65 | */ |
| 66 | public function is_verified() { |
| 67 | return ( isset( $this->is_verified ) && true === $this->is_verified ); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * @return string |
| 72 | */ |
| 73 | static function get_type() { |
| 74 | return 'user'; |
| 75 | } |
| 76 | } |
| 77 |