예제 #1
0
파일: Core.php 프로젝트: robo47/mandango
 private function parseAndCheckFieldsProcess()
 {
     foreach ($this->configClass['fields'] as $name => &$field) {
         if (is_string($field)) {
             $field = array('type' => $field);
         }
         if ($this->configClass['inheritance'] && !isset($field['inherited'])) {
             $field['inherited'] = false;
         }
     }
     unset($field);
     foreach ($this->configClass['fields'] as $name => &$field) {
         if (!is_array($field)) {
             throw new \RuntimeException(sprintf('The field "%s" of the class "%s" is not a string or array.', $name, $this->class));
         }
         if (!isset($field['type'])) {
             throw new \RuntimeException(sprintf('The field "%s" of the class "%s" does not have type.', $name, $this->class));
         }
         if (!TypeContainer::has($field['type'])) {
             throw new \RuntimeException(sprintf('The type "%s" of the field "%s" of the class "%s" does not exists.', $field['type'], $name, $this->class));
         }
         if (!isset($field['dbName'])) {
             $field['dbName'] = $name;
         } elseif (!is_string($field['dbName'])) {
             throw new \RuntimeException(sprintf('The dbName of the field "%s" of the class "%s" is not an string.', $name, $this->class));
         }
     }
     unset($field);
 }
예제 #2
0
파일: ContainerTest.php 프로젝트: hybr/jpm
 public function testResetTypes()
 {
     Container::add('testing', 'Mandango\\Tests\\Type\\TestingType');
     Container::reset();
     $this->assertTrue(Container::has('string'));
     $this->assertFalse(Container::has('testing'));
 }