Analytical form of an integral I'm trying to find the analytical form of the following integral:
$$\int_0^{2\pi}\left|\frac{(1-i\cos(\phi))}{(1+a-i\cos(\phi))}\right|^2d\phi$$
I've tried in Wolfram Alpha, which ran out of free calculation time, and in Mathematica I get the original expression for the indefinite integral and the program stays in the "Running..." state for several minutes, when evaluating the definite integral, and I stopped it.
However, I am reading a paper, which says there is an analytical expression for this integral, and also to me it seems rather straightforward. Any hints?

$$
\begin{align}
\int_0^{2\pi}\left|\frac{(1-i\cos(\phi))}{(1+a-i\cos(\phi))}\right|^2\,\mathrm{d}\phi
&=\int_0^{2\pi}\frac{1+\cos^2(\phi)}{(1+a)^2+\cos^2(\phi)}\,\mathrm{d}\phi\\
&=2\pi-\int_0^{2\pi}\frac{(1+a)^2-1}{(1+a)^2+\cos^2(\phi)}\,\mathrm{d}\phi\\
&=2\pi-2\int_0^\pi\frac{(1+a)^2-1}{2(1+a)^2+1+\cos(2\phi)}\,\mathrm{d}(2\phi)\\
&=2\pi-\oint\frac{4(1+a)^2-4}{4(1+a)^2+2+\left(z+\frac1z\right)}\frac{\mathrm{d}z}{iz}\\
&=2\pi+i\oint\frac{4(1+a)^2-4}{z^2+(4(1+a)^2+2)z+1}\,\mathrm{d}z\\
&=2\pi+i(2\pi i)\frac{(1+a)^2-1}{|1+a|\sqrt{(1+a)^2+1}}\\
&=2\pi\left(1-\frac{(1+a)^2-1}{|1+a|\sqrt{(1+a)^2+1}}\right)
\end{align}
$$
Where $z=e^{i2\phi}$, the contour of integration is the unit circle, and the integrand has one singularity inside the unit circle at $z=-2(1+a)^2-1+2|1+a|\sqrt{(1+a)^2+1}$ with residue $\frac{(1+a)^2-1}{|1+a|\sqrt{(1+a)^2+1}}$
