Apple (AAPL -0.81%) shares have risen more than 50% over the last 12 months: a particularly impressive gain for a company of Apple's size.

The Cupertino tech giant has been on fire over the last year, reporting a series of strong earnings reports that have consistently crushed analysts' expectations. In particular, demand for Apple's latest iPhones -- the iPhone 6 and iPhone 6 Plus -- has been off the charts, and Apple has pledged to return as much as $200 billion to shareholders.

But with Apple shares trading near an all-time high, is the stock still a buy?

Apple's valuation remains relatively modest
Based purely on its valuation, Apple remains relatively inexpensive. On a trailing twelve month basis, Apple's price-to-earnings ratio is around 15.5, less than the broader S&P 500, and much less than most mega cap tech firms. Microsoft is more aggressively valued -- its P/E is near 20; Google's is around 25, while Oracle's is near 18.

Admittedly, these companies have radically different business models, and Apple -- given its dependency on hardware and handsets -- may never again command an aggressive multiple. But it would be unfair to call Apple's stock expensive.

Apple is also immensely profitable and sitting on an enormous pile of cash. Last quarter, Apple's cash flow from operations was more than $19 billion, and its total cash pile swelled to $194 billion. After being criticized for sitting on so much cash for so long, Apple's management is finally putting it to work: it plans to return $200 billion to shareholders by the end of March 2017.

Upside could be limited
Apple's foundation appears strong, but its upside could be limited. With a market cap of more than $740 billion, Apple is the largest company in the world and the largest member of the S&P 500 by a sizable margin. In the past, the S&P 500's largest components have consistently underperformed the rest of the index, likely owing to their mammoth size. At some point, the size of Apple's business seems likely to catch up with it, and its growth will slow.

Last quarter, Apple's iPhone revenue rose a staggering 55% year over year, as it sold 61.2 million iPhones: the second strongest quarter in its history. Can Apple top it? There are some reasons to be optimistic. After all, there are still billions of people across the world without smartphones, some 80% of current iPhone owners have yet to upgrade to an iPhone 6 or 6 Plus, and there's always the possibility that Apple could convince millions of current Android users to switch.

Nevertheless, we may have reached peak iPhone, and with it, the peak of Apple's current business model. With the exception of Apple's Services business segment -- largely a function of people using their iPhones to purchase apps -- its other units are either not growing, or are actually contracting. The Apple Watch offers the potential for additional growth, but it's still unproven, and so long as it remains dependent on the iPhone, demand will be limited.

When I spoke with venture capitalist Peter Thiel last October, he told me that investing in Apple meant betting against innovation. That seems antithetical to Apple's business model as a tech company, but his reasoning was fairly straightforward.

Apple's business is largely dependent on one product, the iPhone. It generates roughly 70% of Apple's revenue directly, and some significant percentage indirectly through services. The iPhone is the best product in its class, almost everyone on the planet is a potential customer, and it has a stellar profit margin.

So long as it stays that way, Apple should continue to generate billions, return it to shareholders, and see its stock rise. But the risk is that another company comes along and unveils a better alternative.

Until that happens, Apple shares may be worth buying.