Likewise, some manuals of style state that thousands separators should not be used in normal text for numbers from 1,000 to 9,999 inclusive where no decimal fractional part is shown (in other words, for four-digit whole numbers), whereas others use thousands separators, and others use both. For example, APA style stipulates a thousands separator for "most figures of 1,000 or more" except for page numbers, binary digits, temperatures, etc.
I myself prefer omission of a thousands separator in four-digit numbers.
$this->Number->format() is a function which takes a number like so $formattedNumber = $this->Number->format(12345);. But in this case we don't write the number literally but it is stored in $newMessages so you need to put that variable inside the function instead of 123 and assign the result back to $newMessages.