TYPO3  7.6
Static Public Member Functions | List of all members
MathUtility Class Reference

Static Public Member Functions

static forceIntegerInRange ($theInt, $min, $max=2000000000, $defaultValue=0)
 
static convertToPositiveInteger ($theInt)
 
static canBeInterpretedAsInteger ($var)
 
static canBeInterpretedAsFloat ($var)
 
static calculateWithPriorityToAdditionAndSubtraction ($string)
 
static calculateWithParentheses ($string)
 
static isIntegerInRange ($value, $minimum, $maximum)
 

Detailed Description

Class with helper functions for mathematical calculations

Definition at line 20 of file MathUtility.php.

Member Function Documentation

static calculateWithParentheses (   $string)
static

Calculates the input with parenthesis levels

Parameters
string$stringInput string, eg "(123 + 456) / 789 - 4
Returns
int Calculated value. Or error string.
See Also
calculateWithPriorityToAdditionAndSubtraction(), ::stdWrap()

Definition at line 170 of file MathUtility.php.

Referenced by ContentObjectRenderer\stdWrap_prioriCalc().

static calculateWithPriorityToAdditionAndSubtraction (   $string)
static

Calculates the input by +,-,*,/,%,^ with priority to + and -

Parameters
string$stringInput string, eg "123 + 456 / 789 - 4
Returns
int Calculated value. Or error string.
See Also
::calculateWithParentheses()

Definition at line 111 of file MathUtility.php.

static canBeInterpretedAsFloat (   $var)
static

Tests if the input can be interpreted as float.

Note: Float casting from objects or arrays is considered undefined and thus will return false.

See Also
http://www.php.net/manual/en/language.types.float.php, section "Formally" for the notation
Parameters
mixed$varAny input variable to test
Returns
bool Returns TRUE if string is a float

Definition at line 90 of file MathUtility.php.

static canBeInterpretedAsInteger (   $var)
static

Tests if the input can be interpreted as integer.

Note: Integer casting from objects or arrays is considered undefined and thus will return false.

See Also
http://php.net/manual/en/language.types.integer.php#language.types.integer.casting.from-other
Parameters
mixed$varAny input variable to test
Returns
bool Returns TRUE if string is an integer

Definition at line 73 of file MathUtility.php.

Referenced by ResourceCompressor\__construct(), TcaInlineIsOnSymmetricSide\addData(), DatabaseRecordTypeValue\addData(), GeneralUtility\array2xml(), ContentObjectRenderer\calcAge(), PageLinkHandler\canHandleLink(), TableController\changeFunc(), TypoScriptFrontendController\checkAndSetAlias(), FileMetadataPermissionsAspect\checkModifyAccessList(), DataHandler\checkValueForInline(), DataHandler\clear_cacheCmd(), RelationHandler\convertPosNeg(), NormalizeCommand\convertRangeToListOfValues(), DataHandler\dbAnalysisStoreExec(), ContentObjectRenderer\detectLinkTypeFromLinkParameter(), TypoScriptFrontendController\determineIdIsHiddenPage(), DataHandler\doesRecordExist(), FrontendEditPanel\editPanelLinkWrap(), PageLinkHandler\expandPage(), ExtendedTemplateService\ext_getObjTree(), ExtendedTemplateService\ext_getTSCE_config(), ContentObjectRenderer\fillInMarkerArray(), AbstractRepository\findByUid(), FileRepository\findFileReferenceByUid(), SplitStorage\get(), EditDocumentController\getButtons(), AbstractFile\getCombinedIdentifier(), ImageManipulationElement\getFile(), BackendUtility\getFlexFormDS(), ImageService\getImageFromSourceString(), FormInlineAjaxController\getInlineExpandCollapseStateArrayForTableUid(), StagesService\getNextStage(), StagesService\getNotificationMode(), StagesService\getPrevStage(), StagesService\getPropertyOfCurrentWorkspaceStage(), LiveSearch\getRecordTitlePrep(), CleanUp\getTypo3TempStatistics(), SoftReferenceIndex\getTypoLinkParts(), ImageManipulationWizard\getWizardAction(), BackendController\handlePageEditing(), ContentObjectRenderer\imageLinkWrap(), AddController\init(), ShowImageController\initialize(), Clipboard\initializeClipboard(), RequestHandler\initializeOutputCompression(), Bootstrap\initializeOutputCompression(), ShortcutToolbarItem\initShortcuts(), DataHandler\insertUpdateDB_preprocessBasedOnFieldType(), PageGenerator\isAllowedLinkVarValue(), RelationHandler\isOnSymmetricSide(), TemplateService\linkData(), ContentObjectRenderer\listNum(), PageLayoutController\makeButtons(), LiveSearch\makeQuerySearchByTable(), AbstractDatabaseRecordList\makeSearchString(), AbstractMenuContentObject\menuTypoLink(), ElementBuilder\moveAllOtherUserdefinedPropertiesToAdditionalArguments(), NormalizeCommand\normalizeIntegerField(), ElementBuilder\overlayUserdefinedHtmlAttributeValues(), AbstractPlugin\pi_getFFvalueFromSheetArray(), AbstractPlugin\pi_isOnlyFields(), AbstractMenuContentObject\prepareMenuItemsForKeywordsMenu(), AbstractMenuContentObject\prepareMenuItemsForRootlineMenu(), AbstractMenuContentObject\prepareMenuItemsForUpdatedMenu(), AbstractItemProvider\processForeignTableClause(), SplitStorage\put(), RelationHandler\readList(), NormalizeCommand\reduceListOfValuesByStepValue(), RichTextElement\render(), InfoPageTyposcriptConfigController\renderList(), TypoScriptTemplateModuleController\renderList(), DateViewHelper\renderStatic(), ContentObjectRenderer\replacement(), ResourceFactory\retrieveFileOrFolderObject(), WorkspaceService\selectAllVersionsFromPages(), DataHandler\setTSconfigPermissions(), SoftReferenceIndex\setTypoLinkPartsElement(), TemplateService\sortedKeyList(), ContentObjectRenderer\splitObj(), RteHtmlParser\TS_links_rte(), DataHandler\updateFlexFormData(), ProcessedFile\updateProperties(), FileStorageIndexingAdditionalFieldProvider\validateAdditionalFields(), FileStorageExtractionAdditionalFieldProvider\validateAdditionalFields(), TypoScriptTemplateObjectBrowserModuleFunctionController\verify_TSobjects(), RelationHandler\writeForeignField(), and GeneralUtility\xml2arrayProcess().

static convertToPositiveInteger (   $theInt)
static

Returns $theInt if it is greater than zero, otherwise returns zero.

Parameters
int$theIntInteger string to process
Returns
int

Definition at line 55 of file MathUtility.php.

Referenced by EditDocumentController\generatePreviewCode(), LiveSearch\setLimitCount(), and LiveSearch\setStartCount().

static forceIntegerInRange (   $theInt,
  $min,
  $max = 2000000000,
  $defaultValue = 0 
)
static

Forces the integer $theInt into the boundaries of $min and $max. If the $theInt is FALSE then the $defaultValue is applied.

Parameters
int$theIntInput value
int$minLower limit
int$maxHigher limit
int$defaultValueDefault value if input is FALSE.
Returns
int The input value forced into the boundaries of $min and $max

Definition at line 31 of file MathUtility.php.

Referenced by AbstractItemProvider\addItemsFromFolder(), ImportExportController\addRecordsForPid(), Indexer\bodyDescription(), GraphicalFunctions\convertColor(), VersionNumberUtility\convertVersionsStringToVersionNumbers(), VersionNumberUtility\convertVersionStringToArray(), GraphicalFunctions\copyGifOntoGif(), MagicImageService\createMagicImage(), IndexSearchRepository\doSearch(), ExtendedTemplateService\ext_procesInput(), FileContentParser\fileContentParts(), NoneElement\formatValue(), SearchFormController\getDisplayResults(), VersionNumberUtility\getNumericTypo3Version(), SearchFormController\getResultRows(), GraphicalFunctions\getTextScalFactor(), GraphicalFunctions\IMparams(), GraphicalFunctions\IMreduceColors(), TableController\init(), SimpleDataHandlerController\init(), GraphicalFunctions\init(), Indexer\init(), SearchController\initialize(), SearchFormController\initialize(), Clipboard\initializeClipboard(), TcaInlineConfiguration\initializeMinMaxItems(), PageTreeNavigationController\initializeTemporaryDBmount(), FileContentParser\initParser(), GeneralUtility\initSysLog(), GraphicalFunctions\inputLevels(), SearchController\loadSettings(), SearchFormController\loadSettings(), CreateFolderController\main(), ThumbnailView\main(), GraphicalFunctions\makeBox(), GraphicalFunctions\makeOutline(), SearchController\makeRating(), GraphicalFunctions\makeShadow(), GraphicalFunctions\makeText(), SearchController\markupSWpartsOfString(), GeneralUtility\modifyHTMLColor(), TypoScriptParser\modifyHTMLColor(), GraphicalFunctions\output(), GraphicalFunctions\outputLevels(), AbstractPlugin\pi_exec_query(), AbstractPlugin\pi_getPidList(), AbstractPlugin\pi_list_browseresults(), SearchFormController\pi_list_browseresults(), AbstractMenuContentObject\prepareMenuItemsForKeywordsMenu(), AbstractMenuContentObject\prepareMenuItemsForUpdatedMenu(), LocalPreviewHelper\process(), ShowImageController\processImage(), VersionNumberUtility\raiseVersionNumber(), TcaTypesShowitem\removeFieldsByBitmaskExcludeBits(), NoneElement\render(), FilesContentObject\render(), RsaInputElement\render(), SelectMultipleSideBySideElement\render(), TextElement\render(), T3editorElement\render(), InlineControlContainer\renderPossibleRecordsSelectorTypeSelect(), SelectSingleBoxElement\renderSelectElement(), PageBrowsingViewHelper\renderStatic(), InfoboxViewHelper\renderStatic(), MailPostProcessor\setPriority(), AbstractDatabaseRecordList\start(), GraphicalFunctions\v5_blur(), GraphicalFunctions\v5_sharpen(), and JavaScriptMenuContentObject\writeMenu().

static isIntegerInRange (   $value,
  $minimum,
  $maximum 
)
static

Checks whether the given number $value is an integer in the range [$minimum;$maximum]

Parameters
int$valueInteger value to check
int$minimumLower boundary of the range
int$maximumUpper boundary of the range
Returns
bool

Definition at line 200 of file MathUtility.php.

Referenced by Typo3DependencyViewHelper\isVersionSuitable(), and FileStorageExtractionAdditionalFieldProvider\validateAdditionalFields().