-
Notifications
You must be signed in to change notification settings - Fork 1
ScripturNum ScripturNum
The ScripturNum class, which represents a single continuous passage.
- Class name: ScripturNum
- Namespace: \ScripturNum
const BOOK_MASK = 4278190080
const START_MASK = 16773120
const END_MASK = 4095
protected mixed int
- Visibility: protected
protected mixed book
- Visibility: protected
protected mixed startCh
- Visibility: protected
protected mixed startV
- Visibility: protected
protected mixed endCh
- Visibility: protected
protected mixed endV
- Visibility: protected
protected mixed bibleClass = \ScripturNum\Bible::class
- Visibility: protected
protected mixed stringSettings = ['abbrev' => ['space' => '', 'cvsep' => '.', 'range' => '-', 'names' => 1, 'plurl' => false], 'long' => ['space' => ' ', 'cvsep' => ':', 'range' => '-', 'names' => 0, 'plurl' => true]]
- Visibility: protected
mixed ScripturNum\ScripturNum::__construct(int|string intOrString)
ScripturNum constructor.
- Visibility: public
- intOrString int|string - ScripturNum int or a human-readable string.
- mixed
int ScripturNum\ScripturNum::__get(mixed what)
- Visibility: public
- what mixed
- int -
void ScripturNum\ScripturNum::setStringSettings(mixed key, array settings)
Update string settings.
- Visibility: public
- This method is static.
- key mixed* settings array
int ScripturNum\ScripturNum::getInt()
Get the ScripturNum integer.
- Visibility: public
- int - The ScripturNum integer
string ScripturNum\ScripturNum::__toString()
Generic toString. Uses the long form.
- Visibility: public
- string -
string ScripturNum\ScripturNum::getAbbrev()
Get a human-readable abbreviation for the passage. By default, these are meant for usage in short links.
- Visibility: public
- string - An abbreviation
string ScripturNum\ScripturNum::getLongString()
Get a human-readable name of the passage. By default, these are meant for humans to read.
- Visibility: public
- string - The name of the passage, as one might pronounce it.
mixed ScripturNum\ScripturNum::toString(mixed options)
Get a string. Publically-accessible.
- Visibility: public
- options mixed
- mixed
string ScripturNum\ScripturNum::getStringWithSettings(string|array options)
Returns a human-readable string with the settings defined in a given setting set.
- Visibility: protected
- options string|array - The setting set to use, or an array of options.
- string - The human-intelligible string.
bool ScripturNum\ScripturNum::isWholeChapters()
Returns true if the passage is an entire chapter.
- Visibility: public
- bool -
static ScripturNum\ScripturNum::getWholeChapters()
Returns a ScripturNum for the current range, expanded to the whole chapter.
- Visibility: public
- static -
static ScripturNum\ScripturNum::getNextChapter()
Returns a ScripturNum for the chapter after the current highest chapter.
- Visibility: public
- static -
static ScripturNum\ScripturNum::getPrevChapter()
Returns a ScripturNum for the chapter prior to the current lowest chapter.
- Visibility: public
- static -
bool ScripturNum\ScripturNum::isWholeBook()
Returns true if the passage is a whole book.
- Visibility: public
- bool -
bool ScripturNum\ScripturNum::isSingleVerse()
Returns true if the passage is just a single verse.
- Visibility: public
- bool -
bool ScripturNum\ScripturNum::bookHasSingleChapter()
Returns true if the book only has one chapter (e.g. Jude)
- Visibility: public
- bool -
int ScripturNum\ScripturNum::bookNameToBookNum(mixed bookName)
- Visibility: protected
- This method is static.
- bookName mixed
- int -
string[][] ScripturNum\ScripturNum::getBookNames()
- Visibility: protected
- This method is static.
- string[][] -
string[] ScripturNum\ScripturNum::getCommonTerms()
- Visibility: protected
- This method is static.
- string[] -
string[] ScripturNum\ScripturNum::getConjunctions()
- Visibility: protected
- This method is static.
- string[] -
string ScripturNum\ScripturNum::pluralizeBookName(string bookNameSingular)
- Visibility: protected
- This method is static.
- bookNameSingular string
- string -
\ScripturNum\ScripturNum ScripturNum\ScripturNum::newFromParsed(string bookStr, ?int startCh, ?int startV, ?int endCh, ?int endV)
- Visibility: public
- This method is static.
- bookStr string* startCh ?int* startV ?int* endCh ?int* endV ?int
- \ScripturNum\ScripturNum -
\ScripturNum\ScripturNum ScripturNum\ScripturNum::newFromInts(int book, int startCh, int|null startV, int|null endCh, int|null endV)
- Visibility: public
- This method is static.
- book int - The book of the Bible the range is within. 1-rel.
- startCh int - The chapter of the start of the range. 1-rel.
- startV int|null - The verse of the start of the range. 1-rel. Defaults to 1.
- endCh int|null - The end chapter of the range. If null or not provided, assumed to be the same as the start chapter.
- endV int|null - The end verse of the range. If null or not provided, assumed to be the end of the chapter.
- \ScripturNum\ScripturNum - The ScripturNum object that represents this range of scripture.
int ScripturNum\ScripturNum::stringToInt(string string)
Takes a string that represents a single passage and returns it as an int.
- Visibility: public
- This method is static.
- string string - A human-readable scripture reference that should be converted to an int.
- int - The int.
int[] ScripturNum\ScripturNum::stringToInts(string string, bool|array exceptions)
Takes a reference string and returns a plurality of ints for corresponding passages. This should only be passed values that are known to be references, not just any text. Use self::extractFromString for that.
- Visibility: public
- This method is static.
- string string - A human-readable scripture reference that should be converted to one or more ints. Allows for commas and semicolons.
- exceptions bool|array - Pass an array to this parameter, and it will be populated with any exceptions that occur. By passing an array, this will not throw the exception, and by not throwing the exception, execution continues and you may be apprised of multiple errors that may exist.
- int[] - The ints.
void ScripturNum\ScripturNum::validateRefNums(int book, ?int startCh, ?int startV, ?int endCh, ?int endV)
Validate that reference numbers can be matched to verses that exist.
- Visibility: protected
- This method is static.
- book int* startCh ?int* startV ?int* endCh ?int* endV ?int
int ScripturNum\ScripturNum::refNumsToInt(int book, ?int startCh, ?int startV, ?int endCh, ?int endV)
Take reference indexes and convert them to the ScripturNum int. Assumes numbers are already validated by either safely existing or being validated against self::validateRefNums()
- Visibility: protected
- This method is static.
- book int* startCh ?int* startV ?int* endCh ?int* endV ?int
- int -
mixed ScripturNum\ScripturNum::refNumStringToRefNums(string string, mixed chapterStart, mixed verseStart, mixed chapterEnd, mixed verseEnd, bool useHints)
This function reads through a single ref string (e.g. 3:5-6:9) one character at a time to parse it into a known reference.
- Visibility: protected
- This method is static.
- string string - The string to parse.
- chapterStart mixed* verseStart mixed* chapterEnd mixed* verseEnd mixed* useHints bool - If true, will consider the values provided to the chapter and verse parameters in parsing the string. Default false.
- mixed
mixed ScripturNum\ScripturNum::intToRefNums(int int, int book, int chapterStart, int verseStart, int chapterEnd, int verseEnd)
Converts a ScripturNum int into reference numbers.
- Visibility: protected
- This method is static.
- int int - The ScripturNum integer
- book int - The book number
- chapterStart int - The first Chapter
- verseStart int - The first Verse
- chapterEnd int - The last Chapter
- verseEnd int - The last Verse
- mixed
mixed ScripturNum\ScripturNum::intToConcats(int int, string|int concatStart, string|int concatEnd)
Convert a ScrupturNum int into a concatenated number. (Concatenated numbers are often used for text libraries.)
- Visibility: public
- This method is static.
- int int - The int representing the full passage
- concatStart string|int - The concatenated "number" possibly larger than an int representing the start of the passage.
- concatEnd string|int - The concatenated "number" possibly larger than an int representing the end of the passage.
- mixed
mixed ScripturNum\ScripturNum::bkIndexToSingleRef(int book, int index, int chapter, int verse)
Parse a book index number into a chapter and verse.
- Visibility: protected
- This method is static.
- book int - Book number
- index int - Verse Index Number
- chapter int - Chapter
- verse int - Verse
- mixed
\ScripturNum\ScripturNumArray ScripturNum\ScripturNum::extractFromString(string string, bool excludeAllBookOnlyRefs, null exceptions)
Given a string with any kind of text content, this method will search for any human-readable scripture references and try to parse them into discrete passages. Returns a ScripturNumArray.
- Visibility: public
- This method is static.
- string string* excludeAllBookOnlyRefs bool* exceptions null
- \ScripturNum\ScripturNumArray -
bool ScripturNum\ScripturNum::isWithinInt(int largerPassage)
Test whether a given passage is within a given larger passage. Will also return true if they are the same.
- Visibility: public
- largerPassage int
- bool -
bool ScripturNum\ScripturNum::isWithin(\ScripturNum\ScripturNum largerPassage)
Test whether a given passage is within a given larger passage. Will also return true if they are the same.
- Visibility: public
- largerPassage ScripturNum\ScripturNum
- bool -
bool ScripturNum\ScripturNum::overlapsWithInt(int otherPassage)
Test whether a given passage has any commonality with another passage.
- Visibility: public
- otherPassage int
- bool -
bool ScripturNum\ScripturNum::overlapsWith(\ScripturNum\ScripturNum otherPassage)
Test whether a given passage has any commonality with another passage.
- Visibility: public
- otherPassage ScripturNum\ScripturNum
- bool -
bool ScripturNum\ScripturNum::overlapsOrAdjacentInt(int otherPassage)
Test whether a given passage has any commonality with another passage, or is adjacent to it.
- Visibility: public
- otherPassage int
- bool -
bool ScripturNum\ScripturNum::overlapsOrAdjacent(\ScripturNum\ScripturNum otherPassage)
Test whether a given passage has any commonality with another passage, or is adjacent to it.
- Visibility: public
- otherPassage ScripturNum\ScripturNum
- bool -
int ScripturNum\ScripturNum::combineWithInt(int otherPassage)
Combines two adjacent or overlapping passages into one int.
- Visibility: public
- otherPassage int
- int -
\ScripturNum\ScripturNum ScripturNum\ScripturNum::combineWith(\ScripturNum\ScripturNum otherPassage)
Combines two adjacent or overlapping passages into one ScripturNum.
- Visibility: public
- otherPassage ScripturNum\ScripturNum
- \ScripturNum\ScripturNum -
bool ScripturNum\ScripturNum::containsInt(int smallerPassage)
Test whether a given passage contains a given smaller passage. Will also return true if they are the same.
- Visibility: public
- smallerPassage int
- bool -
bool ScripturNum\ScripturNum::contains(\ScripturNum\ScripturNum smallerPassage)
Test whether a given passage contains a given smaller passage. Will also return true if they are the same.
- Visibility: public
- smallerPassage ScripturNum\ScripturNum
- bool -
string ScripturNum\ScripturNum::toSqlExclusive(string columnRef)
Generate a query statement that can be used to search an int column in generic SQL for a passage that is entirely contained within the given ScripturNum.
- Visibility: public
- columnRef string - The name of the column or value to use in the query.
- string -
string ScripturNum\ScripturNum::toSqlInclusive(string columnRef)
Generate a query statement that can be used to search an int column in generic SQL for a passage that overlaps with the given ScripturNum.
- Visibility: public
- columnRef string - The name of the column or value to use in the query.
- string -
- ScripturNum