Direct phase modulation via optical injection is a newly developed method for coding the phase of a gain-switched laser, which meets high requirements placed on transmitters for quantum key distribution: compactness, low losses, compatibility with CMOS technologies, and the absence of undesirable effects leading to the side-channel information leakage. Despite the successful implementation and good prospects for the further development of this system, there is still a lack of theoretical investigations of this scheme in the literature. Here, for the first time, we perform its theoretical analysis. We study the influence of the spontaneous emission noise, examine the role of the gain non-linearity, and consider the temperature drift effect. The results obtained reveal that these phenomena significantly affect system performance. We have tried to formulate here practical instructions, which will help to take these features into account when elaborating and employing the optical-injection-based phase modulator.