Sum Pairs

The goal of this coding kata is to come up with a solution for the following bearing in mind what this might mean for processing at scale:

Write a function f(x) that returns all distinct pairs of integers between -50 and 50 (inclusive) whose sum is X. The solution should be in PHP. Thus:

f(100) returns an empty list
f(99) returns (49,50)
f(0) returns (-50,50)(-49,49) … (-2,2)(-1,1)

I came up with a design that addresses the following:

  1. Object-oriented programming principles:
    1. Single responsibility
    2. Dependency inversion
    3. Don’t repeat yourself
  2. Test driven development (or at the very least, having functional tests)
  3. Exception handling
  4. Lazy class loading
  5. Namespacing

Please find the solution for further discussion including a section on Big-O notation.