46 $clearingDecisionsMapped = array();
48 foreach ($clearingDecisions as $clearingDecision) {
49 if ($clearingDecision->getType() == DecisionTypes::IRRELEVANT) {
52 $itemId = $clearingDecision->getUploadTreeId();
53 $fileId = $clearingDecision->getPfileId();
54 $scope = $clearingDecision->getScope();
57 case DecisionScopes::ITEM:
58 $clearingDecisionsMapped[$fileId][$itemId] = $clearingDecision;
61 case DecisionScopes::REPO:
62 $clearingDecisionsMapped[$fileId][self::KEYREPO] = $clearingDecision;
66 throw new \InvalidArgumentException(
"unhandled clearing decision scope '" . $scope .
"'");
70 return $clearingDecisionsMapped;
83 $clearingDecisionsForLicList = array();
85 foreach ($clearingDecisions as $clearingDecision) {
87 if ($clearingDecision->getType() == DecisionTypes::IRRELEVANT) {
91 foreach ($clearingDecision->getClearingLicenses() as $clearingLicense) {
92 if ($clearingLicense->isRemoved()) {
95 $itemId = $clearingDecision->getUploadTreeId();
96 $clearingDecisionsForLicList[$itemId][] = $clearingLicense->getShortName();
99 return $clearingDecisionsForLicList;
108 public function filterCurrentReusableClearingDecisions($clearingDecisions)
111 $clearingDecisionsByItemId = array();
112 foreach ($clearingDecisions as $clearingDecision) {
113 $itemId = $clearingDecision->getUploadTreeId();
114 $clearingDecisionsByItemId[$itemId] = $clearingDecision;
116 return $clearingDecisionsByItemId;
126 if (array_key_exists($pfileId, $decisionMap)) {
127 $pfileMap = $decisionMap[$pfileId];
128 if (array_key_exists($itemId, $pfileMap)) {
129 return $pfileMap[$itemId];
131 if (array_key_exists(self::KEYREPO, $pfileMap)) {
132 return $pfileMap[self::KEYREPO];
150 $clearingDecisionsForCopyList = array();
152 foreach ($clearingDecisions as $clearingDecision) {
153 $itemId = $clearingDecision->getUploadTreeId();
154 $clearingDecisionsForCopyList[$itemId] = array();
155 if ($clearingDecision->getType() == DecisionTypes::IRRELEVANT) {
156 $clearingDecisionsForCopyList[$itemId][] =
"Void";
160 foreach ($clearingDecision->getClearingLicenses() as $clearingLicense) {
161 if ($clearingLicense->isRemoved()) {
164 $clearingDecisionsForCopyList[$itemId][] = $clearingLicense->getShortName();
166 if (empty($clearingDecisionsForCopyList[$itemId])) {
167 $clearingDecisionsForCopyList[$itemId][] =
"Void";
170 return $clearingDecisionsForCopyList;
filterCurrentClearingDecisions($clearingDecisions)
Get the clearing decisions as a map of [<pfile-id>] => [<uploadtree-id>] => decision ...
filterCurrentClearingDecisionsForCopyrightList($clearingDecisions)
Get clearing decision as map of <item-id> => <license-shortnames> for copyright list.
Contains business rules for FOSSology.
Various utility functions to filter ClearingDecision.
getDecisionOf($decisionMap, $itemId, $pfileId)
For a given decision map, get the decision of the given item or pfile id.
filterCurrentClearingDecisionsForLicenseList($clearingDecisions)
Get clearing decision as map of <item-id> => <license-shortnames>