WPCOM_VIP_Support_Role::init PHP Method

init() public static method

Initiate an instance of this class if one doesn't exist already. Return the VipSupportRole instance.
public static init ( ) : WPCOM_VIP_Support_Role
return WPCOM_VIP_Support_Role object The instance of WPCOM_VIP_Support_Role
    public static function init()
    {
        static $instance = false;
        if (!$instance) {
            $instance = new WPCOM_VIP_Support_Role();
        }
        return $instance;
    }

Usage Example

 function test_role_order()
 {
     // Arrange
     // Trigger the update method call on admin_init,
     // this sets up the role
     WPCOM_VIP_Support_Role::init()->action_admin_init();
     // Act
     $roles = get_editable_roles();
     $role_names = array_keys($roles);
     // Assert
     // To show up last, the VIP Support role will be
     // the first index in the array
     $first_role = array_shift($role_names);
     $this->assertTrue(WPCOM_VIP_Support_Role::VIP_SUPPORT_ROLE === $first_role);
 }
All Usage Examples Of WPCOM_VIP_Support_Role::init