Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrycze-volk committed Mar 26, 2024
0 parents commit 8653b07
Show file tree
Hide file tree
Showing 86 changed files with 7,589 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
level: 5
paths:
- ../src/
treatPhpDocTypesAsCertain: false
25 changes: 25 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: PHPStan

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
phpstan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
uses: php-actions/composer@v6
with:
command: update
php_version: "7.4"

- name: PHPStan Static Analysis
uses: php-actions/phpstan@v3
with:
configuration: ./.github/phpstan.neon
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.buildpath
.project
.settings/
/vendor/
/composer.lock
/composer.phar
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

Empty file added README.md
Empty file.
34 changes: 34 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "slub/php-mods-reader",
"description": "Read MODS metadata into PHP objects that offer some convenient data extraction methods",
"type": "library",
"keywords": [
"mods",
"mods-reader"
],
"require": {
"php": ">=7.4"
},
"require-dev": {
"phpunit/phpunit": "~7.5"
},
"autoload": {
"psr-4": {
"Slub\\Mods\\": "src/Mods/"
}
},
"autoload-dev": {
"psr-4": {
"Slub\\Mods\\": "tests/Mods/"
}
},
"minimum-stability": "stable",
"license": "GPL-3.0-or-later",
"authors": [
{
"name": "Beatrycze Volk",
"email": "[email protected]",
"role": "Developer"
}
]
}
14 changes: 14 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="MODS Reader Test Suite">
<directory>./tests/Mods/</directory>
<directory>./tests/Mods/Context</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
69 changes: 69 additions & 0 deletions src/Mods/Attribute/Common/AuthorityAttribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

/**
* Copyright (C) 2024 Saxon State and University Library Dresden
*
* This file is part of the php-mods-reader.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/

namespace Slub\Mods\Attribute\Common;

trait AuthorityAttribute
{

/**
* @access private
* @var string
*/
private string $authority;

/**
* @access private
* @var string
*/
private string $authorityURI;

/**
* @access private
* @var string
*/
private string $valueURI;

/**
* Get the value of authority
*
* @return string
*/
public function getAuthority(): string
{
return $this->authority;
}

/**
* Get the value of authorityURI
*
* @access public
*
* @return string
*/
public function getAuthorityURI(): string
{
return $this->authorityURI;
}

/**
* Get the value of valueURI
*
* @access public
*
* @return string
*/
public function getValueURI(): string
{
return $this->valueURI;
}
}
138 changes: 138 additions & 0 deletions src/Mods/Attribute/Common/DateAttribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?php

/**
* Copyright (C) 2024 Saxon State and University Library Dresden
*
* This file is part of the php-mods-reader.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/

namespace Slub\Mods\Attribute\Common;

trait DateAttribute
{

/**
* @access private
* @var string
*/
private string $encoding;

/**
* @access private
* @var string
*/
private string $point;

/**
* @access private
* @var bool
*/
private bool $keyDate = false;

/**
* @access private
* @var string
*/
private string $qualifier;

/**
* @access private
* @var string
*/
private string $calendar;

/**
* @access private
* @var array
*/
private array $allowedEncodings = [
'w3cdtf',
'iso8601',
'marc',
'edtf',
'temper'
];

/**
* @access private
* @var array
*/
private array $allowedPoints = [
'start',
'end'
];

/**
* @access private
* @var array
*/
private array $allowedQualifiers = [
'approximate',
'inferred',
'questionable'
];

/**
* Get the value of encoding
*
* @access public
*
* @return string
*/
public function getEncoding(): string
{
return $this->encoding;
}

/**
* Get the value of point
*
* @access public
*
* @return string
*/
public function getPoint(): string
{
return $this->point;
}

/**
* Get the value of keyDate
*
* @access public
*
* @return bool
*/
public function isKeyDate(): bool
{
return $this->keyDate;
}

/**
* Get the value of qualifier
*
* @access public
*
* @return string
*/
public function getQualifier(): string
{
return $this->qualifier;
}

/**
* Get the value of calendar
*
* @access public
*
* @return string
*/
public function getCalendar(): string
{
return $this->calendar;
}
}
89 changes: 89 additions & 0 deletions src/Mods/Attribute/Common/LanguageAttribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php

/**
* Copyright (C) 2024 Saxon State and University Library Dresden
*
* This file is part of the php-mods-reader.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/

namespace Slub\Mods\Attribute\Common;

trait LanguageAttribute
{

/**
* @access private
* @var string
*/
private string $lang;

/**
* @access private
* @var string
*/
private string $xmlLang;

/**
* @access private
* @var string
*/
private string $script;

/**
* @access private
* @var string
*/
private string $transliteration;

/**
* Get the value of lang
*
* @access public
*
* @return string
*/
public function getLang(): string
{
return $this->lang;
}

/**
* Get the value of xmlLang
*
* @access public
*
* @return string
*/
public function getXmlLang(): string
{
return $this->xmlLang;
}

/**
* Get the value of script
*
* @access public
*
* @return string
*/
public function getScript(): string
{
return $this->script;
}

/**
* Get the value of transliteration
*
* @access public
*
* @return string
*/
public function getTransliteration(): string
{
return $this->transliteration;
}
}
Loading

0 comments on commit 8653b07

Please sign in to comment.