4
0
api-powers/src/a752e4b2-9b5e-4188-8d33-3799c46d5119/code.php

80 lines
2.0 KiB
PHP
Raw Normal View History

2023-06-01 00:47:38 +00:00
<?php
/**
* @package GetBible
*
* @created 30th May, 2023
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git GetBible <https://git.vdm.dev/getBible>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\GetBible\Api;
use VDM\Joomla\GetBible\Abstraction\Api;
/**
* The GetBible Book Chapters
*
* @since 3.2.0
*/
final class Chapters extends Api
{
/**
* Get the chapters in a book in a translation
*
* @param int $book The book number.
* @param string $translation The translation.
*
* @return object|null The response object or null if an error occurs.
* @since 3.2.0
*/
public function get(int $book, string $translation = 'kjv'): ?object
{
return $this->response->get(
$this->http->get(
$this->uri->get($translation . '/' . $book . '.json')
)
);
}
/**
* List the chapters of a book in a translation
*
* @param int $book The book number.
* @param string $translation The translation.
*
* @return object|null The response object or null if an error occurs.
* @since 3.2.0
*/
public function list(int $book, string $translation = 'kjv'): ?object
{
return $this->response->get(
$this->http->get(
$this->uri->get($translation . '/' . $book . '/chapters.json')
)
);
}
/**
* List the chapters checksums of a book in a translation
*
* @param int $book The book number.
* @param string $translation The translation.
*
* @return object|null The response object or null if an error occurs.
* @since 3.2.0
*/
public function checksum(int $book, string $translation = 'kjv'): ?object
{
return $this->response->get(
$this->http->get(
$this->uri->get($translation . '/' . $book . '/checksum.json')
)
);
}
}