Skip to content

Commit

Permalink
The one with the MULTI
Browse files Browse the repository at this point in the history
- Replaced substr($name) '_MULTI' filthiness match for constant matching
- Added test for <AdditionalData>
- Updated composer.json
- Updates phpunit.xml
  • Loading branch information
Mark Stunnenberg committed Jan 2, 2017
1 parent a4c2639 commit d4860ca
Show file tree
Hide file tree
Showing 28 changed files with 179 additions and 128 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Marknl Iodef Library
====================
[![Build Status](https://travis-ci.org/marknl/iodef.svg?branch=master)](https://travis-ci.org/marknl/iodef)
[![Latest Stable Version](https://poser.pugx.org/marknl/iodef/v/stable)](https://packagist.org/packages/marknl/iodef)
[![Latest Unstable Version](https://poser.pugx.org/marknl/iodef/v/unstable)](https://packagist.org/packages/marknl/iodef)
[![Total Downloads](https://poser.pugx.org/marknl/iodef/downloads)](https://packagist.org/packages/marknl/iodef)
[![License](https://poser.pugx.org/marknl/iodef/license)](https://packagist.org/packages/marknl/iodef)

Expand Down
31 changes: 17 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,35 @@
"homepage": "http://e-rave.nl/iodef",
"type": "library",
"license": "GPL-2.0",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"authors": [
{
"name": "Mark Stunnenberg",
"email": "[email protected]",
"homepage": "http://e-rave.nl/",
"role": "Lead"
}
],
{
"name": "Mark Stunnenberg",
"email": "[email protected]",
"homepage": "http://e-rave.nl/",
"role": "Lead"
}
],
"support": {
"issues": "https://github.com/marknl/iodef/issues",
"source": "https://github.com/marknl/iodef"
},
"require": {
"php": ">=5.5.0",
"sabre/xml": "1.5.*",
"sabre/uri": "1.2.*",
"sabre/xml": "1.5.*",
"sabre/uri": "1.2.*",
"vlucas/valitron": "1.3.*"
},
"autoload": {
"psr-4": {
"Marknl\\Iodef\\": "src/"
},
"psr-0": {
"src/": ""
}
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
}
}
4 changes: 3 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
colors="true"
Expand Down
2 changes: 1 addition & 1 deletion src/Elements/AlternativeID.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct()
];

$this->elements = [
'IncidentID' => 'REQUIRED_MULTI',
'IncidentID' => parent::REQUIRED_MULTI,
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct()
];

$this->elements = [
'URL' => 'OPTIONAL',
'URL' => parent::OPTIONAL,
];
}

Expand Down
12 changes: 6 additions & 6 deletions src/Elements/Assessment.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public function __construct()
];

$this->elements = [
'Impact' => 'OPTIONAL_MULTI',
'TimeImpact' => 'OPTIONAL_MULTI',
'MonetaryImpact' => 'OPTIONAL_MULTI',
'Counter' => 'OPTIONAL_MULTI',
'Confidence' => 'OPTIONAL',
'AdditionalData' => 'OPTIONAL_MULTI',
'Impact' => parent::OPTIONAL_MULTI,
'TimeImpact' => parent::OPTIONAL_MULTI,
'MonetaryImpact' => parent::OPTIONAL_MULTI,
'Counter' => parent::OPTIONAL_MULTI,
'Confidence' => parent::OPTIONAL,
'AdditionalData' => parent::OPTIONAL_MULTI,
];
}

Expand Down
20 changes: 10 additions & 10 deletions src/Elements/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ public function __construct()
];

$this->elements = [
'ContactName' => 'OPTIONAL',
'Description' => 'OPTIONAL_MULTI',
'RegistryHandle' => 'OPTIONAL_MULTI',
'PostalAddress' => 'OPTIONAL',
'Email' => 'OPTIONAL_MULTI',
'Telephone' => 'OPTIONAL_MULTI',
'Fax' => 'OPTIONAL',
'Timezone' => 'OPTIONAL',
'Contact' => 'OPTIONAL_MULTI',
'AdditionalData' => 'OPTIONAL_MULTI',
'ContactName' => parent::OPTIONAL,
'Description' => parent::OPTIONAL_MULTI,
'RegistryHandle' => parent::OPTIONAL_MULTI,
'PostalAddress' => parent::OPTIONAL,
'Email' => parent::OPTIONAL_MULTI,
'Telephone' => parent::OPTIONAL_MULTI,
'Fax' => parent::OPTIONAL,
'Timezone' => parent::OPTIONAL,
'Contact' => parent::OPTIONAL_MULTI,
'AdditionalData' => parent::OPTIONAL_MULTI,
];
}

Expand Down
22 changes: 11 additions & 11 deletions src/Elements/EventData.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ public function __construct()
];

$this->elements = [
'Description' => 'OPTIONAL_MULTI',
'DetectTime' => 'OPTIONAL',
'StartTime' => 'OPTIONAL',
'Contact' => 'OPTIONAL_MULTI',
'Assessment' => 'OPTIONAL',
'Method' => 'OPTIONAL_MULTI',
'Flow' => 'OPTIONAL_MULTI',
'Expectation' => 'OPTIONAL_MULTI',
'Record' => 'OPTIONAL',
'EventData' => 'OPTIONAL_MULTI',
'AdditionalData' => 'OPTIONAL_MULTI',
'Description' => parent::OPTIONAL_MULTI,
'DetectTime' => parent::OPTIONAL,
'StartTime' => parent::OPTIONAL,
'Contact' => parent::OPTIONAL_MULTI,
'Assessment' => parent::OPTIONAL,
'Method' => parent::OPTIONAL_MULTI,
'Flow' => parent::OPTIONAL_MULTI,
'Expectation' => parent::OPTIONAL_MULTI,
'Record' => parent::OPTIONAL,
'EventData' => parent::OPTIONAL_MULTI,
'AdditionalData' => parent::OPTIONAL_MULTI,
];
}

Expand Down
8 changes: 4 additions & 4 deletions src/Elements/Expectation.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public function __construct()
];

$this->elements = [
'Description' => 'OPTIONAL_MULTI',
'StartTime' => 'OPTIONAL',
'EndTime' => 'OPTIONAL',
'Contact' => 'OPTIONAL',
'Description' => parent::OPTIONAL_MULTI,
'StartTime' => parent::OPTIONAL,
'EndTime' => parent::OPTIONAL,
'Contact' => parent::OPTIONAL,
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Flow.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Flow extends IodefElement
public function __construct()
{
$this->elements = [
'System' => 'REQUIRED_MULTI',
'System' => parent::REQUIRED_MULTI,
];
}
}
2 changes: 1 addition & 1 deletion src/Elements/History.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct()
];

$this->elements = [
'HistoryItem' => 'REQUIRED_MULTI',
'HistoryItem' => parent::REQUIRED_MULTI,
];
}

Expand Down
10 changes: 5 additions & 5 deletions src/Elements/HistoryItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ public function __construct()
];

$this->elements = [
'DateTime' => 'REQUIRED',
'IncidentId' => 'OPTIONAL',
'Contact' => 'OPTIONAL',
'Description' => 'OPTIONAL_MULTI',
'AdditionalData' => 'OPTIONAL_MULTI',
'DateTime' => parent::REQUIRED,
'IncidentId' => parent::OPTIONAL,
'Contact' => parent::OPTIONAL,
'Description' => parent::OPTIONAL_MULTI,
'AdditionalData' => parent::OPTIONAL_MULTI,
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/IODEFDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct()
];

$this->elements = [
'Incident' => 'REQUIRED_MULTI',
'Incident' => parent::REQUIRED_MULTI,
];
}

Expand Down
28 changes: 14 additions & 14 deletions src/Elements/Incident.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ public function __construct()
];

$this->elements = [
'IncidentID' => 'REQUIRED',
'AlternativeID' => 'OPTIONAL',
'RelatedActivity' => 'OPTIONAL',
'DetectTime' => 'OPTIONAL',
'StartTime' => 'OPTIONAL',
'EndTime' => 'OPTIONAL',
'ReportTime' => 'REQUIRED',
'Description' => 'OPTIONAL_MULTI',
'Assessment' => 'REQUIRED_MULTI',
'Method' => 'OPTIONAL_MULTI',
'Contact' => 'REQUIRED_MULTI',
'EventData' => 'OPTIONAL_MULTI',
'History' => 'OPTIONAL',
'AdditionalData' => 'OPTIONAL_MULTI',
'IncidentID' => parent::REQUIRED,
'AlternativeID' => parent::OPTIONAL,
'RelatedActivity' => parent::OPTIONAL,
'DetectTime' => parent::OPTIONAL,
'StartTime' => parent::OPTIONAL,
'EndTime' => parent::OPTIONAL,
'ReportTime' => parent::REQUIRED,
'Description' => parent::OPTIONAL_MULTI,
'Assessment' => parent::REQUIRED_MULTI,
'Method' => parent::OPTIONAL_MULTI,
'Contact' => parent::REQUIRED_MULTI,
'EventData' => parent::OPTIONAL_MULTI,
'History' => parent::OPTIONAL,
'AdditionalData' => parent::OPTIONAL_MULTI,
];
}

Expand Down
6 changes: 3 additions & 3 deletions src/Elements/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public function __construct()
];

$this->elements = [
'Reference' => 'OPTIONAL_MULTI',
'Description' => 'OPTIONAL_MULTI',
'AdditionalData' => 'OPTIONAL_MULTI',
'Reference' => parent::OPTIONAL_MULTI,
'Description' => parent::OPTIONAL_MULTI,
'AdditionalData' => parent::OPTIONAL_MULTI,
];
}

Expand Down
12 changes: 6 additions & 6 deletions src/Elements/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ class Node extends IodefElement
public function __construct()
{
$this->elements = [
'NodeName' => 'OPTIONAL_MULTI',
'Address' => 'OPTIONAL_MULTI',
'Location' => 'OPTIONAL',
'DateTime' => 'OPTIONAL',
'NodeRole' => 'OPTIONAL_MULTI',
'Counter' => 'OPTIONAL_MULTI',
'NodeName' => parent::OPTIONAL_MULTI,
'Address' => parent::OPTIONAL_MULTI,
'Location' => parent::OPTIONAL,
'DateTime' => parent::OPTIONAL,
'NodeRole' => parent::OPTIONAL_MULTI,
'Counter' => parent::OPTIONAL_MULTI,
];
}
}
2 changes: 1 addition & 1 deletion src/Elements/OperatingSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct()
];

$this->elements = [
'URL' => 'OPTIONAL',
'URL' => parent::OPTIONAL,
];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Elements/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct()
];

$this->elements = [
'RecordData' => 'REQUIRED_MULTI',
'RecordData' => parent::REQUIRED_MULTI,
];
}

Expand Down
12 changes: 6 additions & 6 deletions src/Elements/RecordData.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ public function __construct()
];

$this->elements = [
'DateTime' => 'OPTIONAL',
'Description' => 'OPTIONAL_MULTI',
'Application' => 'OPTIONAL',
'RecordPattern' => 'OPTIONAL_MULTI',
'RecordItem' => 'REQUIRED_MULTI',
'AdditionalData' => 'OPTIONAL_MULTI',
'DateTime' => parent::OPTIONAL,
'Description' => parent::OPTIONAL_MULTI,
'Application' => parent::OPTIONAL,
'RecordPattern' => parent::OPTIONAL_MULTI,
'RecordItem' => parent::REQUIRED_MULTI,
'AdditionalData' => parent::OPTIONAL_MULTI,
];
}

Expand Down
6 changes: 3 additions & 3 deletions src/Elements/Reference.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class Reference extends IodefElement
public function __construct()
{
$this->elements = [
'ReferenceName' => 'REQUIRED',
'URL' => 'OPTIONAL_MULTI',
'Description' => 'OPTIONAL_MULTI',
'ReferenceName' => parent::REQUIRED,
'URL' => parent::OPTIONAL_MULTI,
'Description' => parent::OPTIONAL_MULTI,
];
}
}
4 changes: 2 additions & 2 deletions src/Elements/RelatedActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function __construct()
];

$this->elements = [
'IncidentID' => 'OPTIONAL_MULTI',
'URL' => 'OPTIONAL_MULTI',
'IncidentID' => parent::OPTIONAL_MULTI,
'URL' => parent::OPTIONAL_MULTI,
];
}

Expand Down
12 changes: 6 additions & 6 deletions src/Elements/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ public function __construct()
];

$this->elements = [
'Port' => 'OPTIONAL',
'Portlist' => 'OPTIONAL',
'ProtoCode' => 'OPTIONAL',
'ProtoType' => 'OPTIONAL',
'ProtoFlags' => 'OPTIONAL',
'Application' => 'OPTIONAL',
'Port' => parent::OPTIONAL,
'Portlist' => parent::OPTIONAL,
'ProtoCode' => parent::OPTIONAL,
'ProtoType' => parent::OPTIONAL,
'ProtoFlags' => parent::OPTIONAL,
'Application' => parent::OPTIONAL,
];
}

Expand Down
12 changes: 6 additions & 6 deletions src/Elements/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public function __construct()
'spoofed' => 'unknown',
];
$this->elements = [
'Node' => 'REQUIRED',
'Service' => 'OPTIONAL_MULTI',
'OperatingSystem' => 'OPTIONAL_MULTI',
'Counter' => 'OPTIONAL_MULTI',
'Description' => 'OPTIONAL_MULTI',
'AdditionalData' => 'OPTIONAL_MULTI',
'Node' => parent::REQUIRED,
'Service' => parent::OPTIONAL_MULTI,
'OperatingSystem' => parent::OPTIONAL_MULTI,
'Counter' => parent::OPTIONAL_MULTI,
'Description' => parent::OPTIONAL_MULTI,
'AdditionalData' => parent::OPTIONAL_MULTI,
];
}

Expand Down
Loading

0 comments on commit d4860ca

Please sign in to comment.