Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Acme;
- class DataTransfer
- {
- public static function forUser(
- $user_id
- ) {
- return new static($user_id);
- }
- public static function forCompany(
- $company_id
- ) {
- return new static(null, $company_id);
- }
- private $user_id;
- private $company_id;
- public function userId()
- {
- return $this->user_id;
- }
- public function companyId()
- {
- return $this->company_id;
- }
- private function __construct(
- $user_id = null,
- $company_id = null
- ) {
- if ($user_id) {
- $this->user_id = $user_id;
- }
- if ($company_id) {
- $this->company_id = $company_id;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement