コード例 #1
0
 public static function fromArray($data)
 {
     $settings = new RoleSettings();
     foreach ($data as $key => $value) {
         if (property_exists(get_class($settings), $key)) {
             if (is_array($value)) {
                 if ($key == "transactions") {
                     $settings->{$key} = Transactions::fromArray($value);
                 }
                 if ($key == "reports") {
                     $settings->{$key} = Reports::fromArray($value);
                 }
                 if ($key == "help") {
                     $settings->{$key} = Help::fromArray($value);
                 }
                 if ($key == "mobileVTAccess") {
                     $settings->{$key} = MobileVTAcces::fromArray($value);
                 }
                 if ($key == "admin") {
                     $settings->{$key} = Admin::fromArray($value);
                 }
                 if ($key == "customer") {
                     $settings->{$key} = Customers::fromArray($value);
                 }
                 if ($key == "webPosAccess") {
                     $settings->{$key} = WebPosAccess::fromArray($value);
                 }
             } else {
                 $settings->{$key} = $value;
             }
         }
     }
     return $settings;
 }