ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Php.php
Go to the documentation of this file.
1<?php
3
4class Php extends Exporter
5{
9 protected static function toStringDo($languages)
10 {
11 $lines = array();
12 $lines[] = '<?php';
13 $lines[] = 'return array(';
14 foreach ($languages as $lc) {
15 $lines[] = ' \''.$lc->id.'\' => array(';
16 $lines[] = ' \'name\' => \''.addslashes($lc->name).'\',';
17 if (isset($lc->supersededBy)) {
18 $lines[] = ' \'supersededBy\' => \''.$lc->supersededBy.'\',';
19 }
20 if (isset($lc->script)) {
21 $lines[] = ' \'script\' => \''.addslashes($lc->script).'\',';
22 }
23 if (isset($lc->territory)) {
24 $lines[] = ' \'territory\' => \''.addslashes($lc->territory).'\',';
25 }
26 if (isset($lc->baseLanguage)) {
27 $lines[] = ' \'baseLanguage\' => \''.addslashes($lc->baseLanguage).'\',';
28 }
29 $lines[] = ' \'formula\' => \''.$lc->formula.'\',';
30 $lines[] = ' \'plurals\' => '.count($lc->categories).',';
31 $catNames = array();
32 foreach ($lc->categories as $c) {
33 $catNames[] = "'{$c->id}'";
34 }
35 $lines[] = ' \'cases\' => array('.implode(', ', $catNames).'),';
36 $lines[] = ' \'examples\' => array(';
37 foreach ($lc->categories as $c) {
38 $lines[] = ' \''.$c->id.'\' => \''.$c->examples.'\',';
39 }
40 $lines[] = ' ),';
41 $lines[] = ' ),';
42 }
43 $lines[] = ');';
44 $lines[] = '';
45
46 return implode("\n", $lines);
47 }
51 public static function getDescription()
52 {
53 return 'Build a PHP array';
54 }
55}
An exception for terminatinating execution or to throw for unit testing.
Base class for all the exporters.
Definition: Exporter.php:11
static getDescription()
Return a short description of the exporter.
Definition: Exporter.php:124
static toStringDo($languages)
Definition: Php.php:9
foreach( $files as $file)
$lc
Definition: date.php:267