1111 * Construct a data blob as an easy way of passing data around.
1212 * @return array: A data blob
1313 */
14- function makeDataBlob (){
14+ function makeDataBlob () {
1515 // Open config file and languages
1616 $ config = json_decode ( file_get_contents ( 'config.json ' ), true );
1717
@@ -70,7 +70,7 @@ function makeDataBlob(){
7070 * @param array $data data-blob of i18n and config variables
7171 * @param string $dumpDate the date of the dumpfile, null for live data
7272 */
73- function dumpDistributionExtras (XMLWriter $ xml , $ data , $ dumpDate , $ format) {
73+ function dumpDistributionExtras ( XMLWriter $ xml , $ data , $ dumpDate , $ format ) {
7474 $ url = str_replace (
7575 '$1 ' ,
7676 $ dumpDate . '/ ' . $ data ['dumps ' ][$ dumpDate ][$ format ]['filename ' ],
@@ -106,7 +106,7 @@ function dumpDistributionExtras(XMLWriter $xml, $data, $dumpDate, $format){
106106 * @param string $prefix prefix for corresponding entry in config file
107107 * @param string $dumpDate the date of the dumpfile, null for live data
108108 */
109- function writeDistribution (XMLWriter $ xml , $ data , $ distribId , $ prefix , $ dumpDate) {
109+ function writeDistribution ( XMLWriter $ xml , $ data , $ distribId , $ prefix , $ dumpDate ) {
110110 $ ids = array ();
111111
112112 foreach ( $ data ['config ' ]["$ prefix-info " ]['mediatype ' ] as $ format => $ mediatype ) {
@@ -145,7 +145,7 @@ function writeDistribution(XMLWriter $xml, $data, $distribId, $prefix, $dumpDate
145145 $ xml ->writeAttributeNS ( 'xml ' , 'lang ' , null , $ langCode );
146146 $ xml ->text (
147147 str_replace ( '$1 ' , $ format , $ langData ["distribution- $ prefix-description " ] )
148- ); //TODO add format
148+ ); // TODO add format
149149 $ xml ->endElement ();
150150 }
151151 }
@@ -167,8 +167,8 @@ function writeDistribution(XMLWriter $xml, $data, $distribId, $prefix, $dumpDate
167167 * @param string $contactPoint the nodeId of the contactPoint
168168 * @param array $distribution array of the distribution identifiers
169169 */
170- function writeDataset (XMLWriter $ xml , $ data , $ dumpDate , $ datasetId ,
171- $ publisher , $ contactPoint , $ distribution) {
170+ function writeDataset ( XMLWriter $ xml , $ data , $ dumpDate , $ datasetId ,
171+ $ publisher , $ contactPoint , $ distribution ) {
172172
173173 $ type = 'dump ' ;
174174 if ( is_null ( $ dumpDate ) ) {
@@ -254,7 +254,7 @@ function writeDataset(XMLWriter $xml, $data, $dumpDate, $datasetId,
254254 * @param array $data data-blob of i18n and config variables
255255 * @param string $publisher the nodeId of the publisher
256256 */
257- function writePublisher (XMLWriter $ xml , $ data , $ publisher) {
257+ function writePublisher ( XMLWriter $ xml , $ data , $ publisher ) {
258258 $ xml ->startElementNS ( 'rdf ' , 'Description ' , null );
259259 $ xml ->writeAttributeNS ( 'rdf ' , 'nodeID ' , null , $ publisher );
260260
@@ -290,7 +290,7 @@ function writePublisher(XMLWriter $xml, $data, $publisher){
290290 * @param array $data data-blob of i18n and config variables
291291 * @param string $contactPoint the nodeId of the contactPoint
292292 */
293- function writeContactPoint (XMLWriter $ xml , $ data , $ contactPoint) {
293+ function writeContactPoint ( XMLWriter $ xml , $ data , $ contactPoint ) {
294294 $ xml ->startElementNS ( 'rdf ' , 'Description ' , null );
295295 $ xml ->writeAttributeNS ( 'rdf ' , 'nodeID ' , null , $ contactPoint );
296296
@@ -319,7 +319,7 @@ function writeContactPoint(XMLWriter $xml, $data, $contactPoint){
319319 * @param string $publisher the nodeId of the publisher
320320 * @param array $dataset array of the dataset identifiers
321321 */
322- function writeCatalog (XMLWriter $ xml , $ data , $ publisher , $ dataset) {
322+ function writeCatalog ( XMLWriter $ xml , $ data , $ publisher , $ dataset ) {
323323 $ xml ->startElementNS ( 'rdf ' , 'Description ' , null );
324324 $ xml ->writeAttributeNS ( 'rdf ' , 'about ' , null ,
325325 $ data ['config ' ]['uri ' ] . '#catalog ' );
@@ -386,9 +386,9 @@ function writeCatalog(XMLWriter $xml, $data, $publisher, $dataset){
386386 * @param array $data data-blob of i18n and config variables
387387 * @return string: xmldata
388388 */
389- function outputXml ($ data) {
389+ function outputXml ( $ data ) {
390390 // Setting XML header
391- @header ('content-type: text/xml charset=UTF-8 ' );
391+ @header ( 'content-type: text/xml charset=UTF-8 ' );
392392
393393 // Initializing the XML Object
394394 $ xml = new XmlWriter ();
@@ -462,7 +462,7 @@ function outputXml($data){
462462 * @param string $dirname directory name
463463 * @return array: of dumpdata, or empty array
464464 */
465- function scanDump ($ dirname , $ data) {
465+ function scanDump ( $ dirname , $ data ) {
466466 $ teststrings = array ();
467467 foreach ( $ data ['config ' ]['dump-info ' ]['mediatype ' ] as $ fileEnding => $ mediatype ) {
468468 $ teststrings [$ fileEnding ] = 'all. ' . $ fileEnding . '.gz ' ;
@@ -471,11 +471,12 @@ function scanDump($dirname, $data){
471471 $ dumps = array ();
472472
473473 foreach ( scandir ( $ dirname ) as $ dirKey => $ subdir ) {
474- if ( substr ( $ subdir , 0 , 1 ) != '. ' && is_dir ( $ dirname .'/ ' .$ subdir ) ) {
474+ // get rid of files and non-relevant sub-directories
475+ if ( substr ( $ subdir , 0 , 1 ) != '. ' && is_dir ( $ dirname . '/ ' . $ subdir ) ) {
475476 // each subdir refers to a timestamp
476477 $ dumps [$ subdir ] = array ();
477- foreach ( scandir ( $ dirname. '/ ' . $ subdir ) as $ key => $ filename ) {
478- //match each file against an expected teststring
478+ foreach ( scandir ( $ dirname . '/ ' . $ subdir ) as $ key => $ filename ) {
479+ // match each file against an expected teststring
479480 foreach ( $ teststrings as $ fileEnding => $ teststring ) {
480481 if ( substr ( $ filename , -strlen ( $ teststring ) ) === $ teststring ) {
481482 $ info = stat ( "$ dirname/ $ subdir/ $ filename " );
@@ -499,7 +500,7 @@ function scanDump($dirname, $data){
499500 *
500501 * @param string $directory directory name, overrides config setting if provided
501502 */
502- function run ($ directory= null ) {
503+ function run ( $ directory = null ) {
503504 // Load config variables and i18n a data blob
504505 $ data = makeDataBlob ();
505506
0 commit comments