In sheet music to put together consecutive notes the composer writes a slur. There is two kinds of slurs one whole line the other broken. My question is: When does a composer use a solid line slur, when do they use a broken line slur?
Composers may use a dashed/dotted/broken slur or phrase mark when it's optional (for example, when lyrics are irregular, as user25358 attests). It may also be used to indicate a hemiola, for example where a 3/4 bar should be treated as 6/8. That could be the case in bars 2-3 of your excerpt.
Editors may use a dashed/dotted/broken slur to indicate editorial material which has been added because the composer did not include such a phrase mark.
Beyond that, even a solid slur curve does not always indicate notes should be slurred. The same notation is often used to indicate phrasing, in which case there will be shorter curves over a subset of the notes indicating a true slur. -- Or if all notes are to be articulated, there'll be dots or bars over the notes to specify the articulation.
I have to say that in most cases (cello music) where I see a dotted slur, it means that some editor suggests the original composer might have liked a slur there even tho' the manuscript doesn't have one.
Slurs with broken lines are usually employed when there are two notes to a syllable only in some of several stanzas of singing.
I've seen dashed slurs used in wind sheet music to indicate that the player should play through the phrase instead of taking a breath.