Пример #1
0
 foreach ($contents as $var => $content) {
     foreach ($content as $key_key => $key_value) {
         $key_type = 'undefined';
         if (is_numeric($key_value)) {
             $key_type = 'numeric';
         } elseif (is_array($key_value)) {
             $key_type = 'array';
         } elseif (is_bool($key_value)) {
             $key_type = 'bool';
         } elseif (is_string($key_value)) {
             $key_type = 'string';
         }
         $keys[$key_key][] = $key_type;
         $keys[$key_key] = array_unique($keys[$key_key]);
     }
     $node = $nodes->open($var, array());
     $new = !empty($node);
     // Handle file-level information
     if ($provides && (!is_array($node['#provides']) || !in_array($provides, $node['#provides']))) {
         $node['#provides'][] = $provides;
     }
     if (!is_array($node['#namespaces']) || !in_array($namespace, $node['#namespaces'])) {
         $node['#namespaces'][] = $namespace;
     }
     $node['#resource'][] = "{$namespace}/{$resource}";
     if (trim($content['type']) && (empty($node['type']) || $content['type'] != 'Object')) {
         $node['type'] = $content['type'];
     }
     if (!empty($content['tags'])) {
         $node['tags'] = $content['tags'];
     }
Пример #2
0
 foreach ($contents as $var => $content) {
     foreach ($content as $key_key => $key_value) {
         $key_type = 'undefined';
         if (is_numeric($key_value)) {
             $key_type = 'numeric';
         } elseif (is_array($key_value)) {
             $key_type = 'array';
         } elseif (is_bool($key_value)) {
             $key_type = 'bool';
         } elseif (is_string($key_value)) {
             $key_type = 'string';
         }
         $keys[$key_key][] = $key_type;
         $keys[$key_key] = array_unique($keys[$key_key]);
     }
     $node = $nodes->open($var, array());
     $new = !empty($node);
     // Handle file-level information
     if ($provides && (!is_array($node['#provides']) || !in_array($provides, $node['#provides']))) {
         $node['#provides'][] = $provides;
     }
     if (!is_array($node['#namespaces']) || !in_array($namespace, $node['#namespaces'])) {
         $node['#namespaces'][] = $namespace;
     }
     $node['#resource'][] = "{$namespace}/{$resource}";
     if (trim($content['type']) && (empty($node['type']) || $content['type'] != 'Object')) {
         $node['type'] = $content['type'];
     }
     if (!empty($content['tags'])) {
         $node['tags'] = $content['tags'];
     }