composer.phar 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624746257462674627746287462974630746317463274633746347463574636746377463874639746407464174642746437464474645746467464774648746497465074651746527465374654746557465674657746587465974660746617466274663746647466574666746677466874669746707467174672746737467474675746767467774678746797468074681746827468374684746857468674687746887468974690746917469274693746947469574696746977469874699747007470174702747037470474705747067470774708747097471074711747127471374714747157471674717747187471974720747217472274723747247472574726747277472874729747307473174732747337473474735747367473774738747397474074741747427474374744747457474674747747487474974750747517475274753747547475574756747577475874759747607476174762747637476474765747667476774768747697477074771747727477374774747757477674777747787477974780747817478274783747847478574786747877478874789747907479174792747937479474795747967479774798747997480074801748027480374804748057480674807748087480974810748117481274813748147481574816748177481874819748207482174822748237482474825748267482774828748297483074831748327483374834748357483674837748387483974840748417484274843748447484574846748477484874849748507485174852748537485474855748567485774858748597486074861748627486374864748657486674867748687486974870748717487274873748747487574876748777487874879748807488174882748837488474885748867488774888748897489074891748927489374894748957489674897748987489974900749017490274903749047490574906749077490874909749107491174912749137491474915749167491774918749197492074921749227492374924749257492674927749287492974930749317493274933749347493574936749377493874939749407494174942749437494474945749467494774948749497495074951749527495374954749557495674957749587495974960749617496274963749647496574966749677496874969749707497174972749737497474975749767497774978749797498074981749827498374984749857498674987749887498974990749917499274993749947499574996749977499874999750007500175002750037500475005750067500775008750097501075011750127501375014750157501675017750187501975020750217502275023750247502575026750277502875029750307503175032750337503475035750367503775038750397504075041750427504375044750457504675047750487504975050750517505275053750547505575056750577505875059750607506175062750637506475065750667506775068750697507075071750727507375074750757507675077750787507975080750817508275083750847508575086750877508875089750907509175092750937509475095750967509775098750997510075101751027510375104751057510675107751087510975110751117511275113751147511575116751177511875119751207512175122751237512475125751267512775128751297513075131751327513375134751357513675137751387513975140751417514275143751447514575146751477514875149751507515175152751537515475155751567515775158751597516075161751627516375164751657516675167751687516975170751717517275173751747517575176751777517875179751807518175182751837518475185751867518775188751897519075191751927519375194751957519675197751987519975200752017520275203752047520575206752077520875209752107521175212752137521475215752167521775218752197522075221752227522375224752257522675227752287522975230752317523275233752347523575236752377523875239752407524175242752437524475245752467524775248752497525075251752527525375254752557525675257752587525975260752617526275263752647526575266752677526875269752707527175272752737527475275752767527775278752797528075281752827528375284752857528675287752887528975290752917529275293752947529575296752977529875299753007530175302753037530475305753067530775308753097531075311753127531375314753157531675317753187531975320753217532275323753247532575326753277532875329753307533175332753337533475335753367533775338753397534075341753427534375344753457534675347753487534975350753517535275353753547535575356753577535875359753607536175362753637536475365753667536775368753697537075371753727537375374753757537675377753787537975380753817538275383753847538575386753877538875389753907539175392753937539475395753967539775398753997540075401754027540375404754057540675407754087540975410754117541275413754147541575416754177541875419754207542175422754237542475425754267542775428754297543075431754327543375434754357543675437754387543975440754417544275443754447544575446754477544875449754507545175452754537545475455754567545775458754597546075461754627546375464754657546675467754687546975470754717547275473754747547575476754777547875479754807548175482754837548475485754867548775488754897549075491754927549375494754957549675497754987549975500755017550275503755047550575506755077550875509755107551175512755137551475515755167551775518755197552075521755227552375524755257552675527755287552975530755317553275533755347553575536755377553875539755407554175542755437554475545755467554775548755497555075551755527555375554755557555675557755587555975560755617556275563755647556575566755677556875569755707557175572755737557475575755767557775578755797558075581755827558375584755857558675587755887558975590755917559275593755947559575596755977559875599756007560175602756037560475605756067560775608756097561075611756127561375614756157561675617756187561975620756217562275623756247562575626756277562875629756307563175632756337563475635756367563775638756397564075641756427564375644756457564675647756487564975650756517565275653756547565575656756577565875659756607566175662756637566475665756667566775668756697567075671756727567375674756757567675677756787567975680756817568275683756847568575686756877568875689756907569175692756937569475695756967569775698756997570075701757027570375704757057570675707757087570975710757117571275713757147571575716757177571875719757207572175722757237572475725757267572775728757297573075731757327573375734757357573675737757387573975740757417574275743757447574575746757477574875749757507575175752757537575475755757567575775758757597576075761757627576375764757657576675767757687576975770757717577275773757747577575776757777577875779757807578175782757837578475785757867578775788757897579075791757927579375794757957579675797757987579975800758017580275803758047580575806758077580875809758107581175812758137581475815758167581775818758197582075821758227582375824758257582675827758287582975830758317583275833758347583575836758377583875839758407584175842758437584475845758467584775848758497585075851758527585375854758557585675857758587585975860758617586275863758647586575866758677586875869758707587175872758737587475875758767587775878758797588075881758827588375884758857588675887758887588975890758917589275893758947589575896758977589875899759007590175902759037590475905759067590775908759097591075911759127591375914759157591675917759187591975920759217592275923759247592575926759277592875929759307593175932759337593475935759367593775938759397594075941759427594375944759457594675947759487594975950759517595275953759547595575956759577595875959759607596175962759637596475965759667596775968759697597075971759727597375974759757597675977759787597975980759817598275983759847598575986759877598875989759907599175992759937599475995759967599775998759997600076001760027600376004760057600676007760087600976010760117601276013760147601576016760177601876019760207602176022760237602476025760267602776028760297603076031760327603376034760357603676037760387603976040760417604276043760447604576046760477604876049760507605176052760537605476055760567605776058760597606076061760627606376064760657606676067760687606976070760717607276073760747607576076760777607876079760807608176082760837608476085760867608776088760897609076091760927609376094760957609676097760987609976100761017610276103761047610576106761077610876109761107611176112761137611476115761167611776118761197612076121761227612376124761257612676127761287612976130761317613276133761347613576136761377613876139761407614176142761437614476145761467614776148761497615076151761527615376154761557615676157761587615976160761617616276163761647616576166761677616876169761707617176172761737617476175761767617776178761797618076181761827618376184761857618676187761887618976190761917619276193761947619576196761977619876199762007620176202762037620476205762067620776208762097621076211762127621376214762157621676217762187621976220762217622276223762247622576226762277622876229762307623176232762337623476235762367623776238762397624076241762427624376244762457624676247762487624976250762517625276253762547625576256762577625876259762607626176262762637626476265762667626776268762697627076271762727627376274762757627676277762787627976280762817628276283762847628576286762877628876289762907629176292762937629476295762967629776298762997630076301763027630376304763057630676307763087630976310763117631276313763147631576316763177631876319763207632176322763237632476325763267632776328763297633076331763327633376334763357633676337763387633976340763417634276343763447634576346763477634876349763507635176352763537635476355763567635776358763597636076361763627636376364763657636676367763687636976370763717637276373763747637576376763777637876379763807638176382763837638476385763867638776388763897639076391763927639376394763957639676397763987639976400764017640276403764047640576406764077640876409764107641176412764137641476415764167641776418764197642076421764227642376424764257642676427764287642976430764317643276433764347643576436764377643876439764407644176442764437644476445764467644776448764497645076451764527645376454764557645676457764587645976460764617646276463764647646576466764677646876469764707647176472764737647476475764767647776478764797648076481764827648376484764857648676487764887648976490764917649276493764947649576496764977649876499765007650176502765037650476505765067650776508765097651076511765127651376514765157651676517765187651976520765217652276523765247652576526765277652876529765307653176532765337653476535765367653776538765397654076541765427654376544765457654676547765487654976550765517655276553765547655576556765577655876559765607656176562765637656476565765667656776568765697657076571765727657376574765757657676577765787657976580765817658276583765847658576586765877658876589765907659176592765937659476595765967659776598765997660076601766027660376604766057660676607766087660976610766117661276613766147661576616766177661876619766207662176622766237662476625766267662776628766297663076631766327663376634766357663676637766387663976640766417664276643766447664576646766477664876649766507665176652766537665476655766567665776658766597666076661766627666376664766657666676667766687666976670766717667276673766747667576676766777667876679766807668176682766837668476685766867668776688766897669076691766927669376694766957669676697766987669976700767017670276703767047670576706767077670876709767107671176712767137671476715767167671776718767197672076721767227672376724767257672676727767287672976730767317673276733767347673576736767377673876739767407674176742767437674476745767467674776748767497675076751767527675376754767557675676757767587675976760767617676276763767647676576766767677676876769767707677176772767737677476775767767677776778767797678076781767827678376784767857678676787767887678976790767917679276793767947679576796767977679876799768007680176802768037680476805768067680776808768097681076811768127681376814768157681676817768187681976820768217682276823768247682576826768277682876829768307683176832768337683476835768367683776838768397684076841768427684376844768457684676847768487684976850768517685276853768547685576856768577685876859768607686176862768637686476865768667686776868768697687076871768727687376874768757687676877768787687976880768817688276883768847688576886768877688876889768907689176892768937689476895768967689776898768997690076901769027690376904769057690676907769087690976910769117691276913769147691576916769177691876919769207692176922769237692476925769267692776928769297693076931769327693376934769357693676937769387693976940769417694276943769447694576946769477694876949769507695176952769537695476955769567695776958769597696076961769627696376964769657696676967769687696976970769717697276973769747697576976769777697876979769807698176982769837698476985769867698776988769897699076991769927699376994769957699676997769987699977000770017700277003770047700577006770077700877009770107701177012770137701477015770167701777018770197702077021770227702377024770257702677027770287702977030770317703277033770347703577036770377703877039770407704177042770437704477045770467704777048770497705077051770527705377054770557705677057770587705977060770617706277063770647706577066770677706877069770707707177072770737707477075770767707777078770797708077081770827708377084770857708677087770887708977090770917709277093770947709577096770977709877099771007710177102771037710477105771067710777108771097711077111771127711377114771157711677117771187711977120771217712277123771247712577126771277712877129771307713177132771337713477135771367713777138771397714077141771427714377144771457714677147771487714977150771517715277153771547715577156771577715877159771607716177162771637716477165771667716777168771697717077171771727717377174771757717677177771787717977180771817718277183771847718577186771877718877189771907719177192771937719477195771967719777198771997720077201772027720377204772057720677207772087720977210772117721277213772147721577216772177721877219772207722177222772237722477225772267722777228772297723077231772327723377234772357723677237772387723977240772417724277243772447724577246772477724877249772507725177252772537725477255772567725777258772597726077261772627726377264772657726677267772687726977270772717727277273772747727577276772777727877279772807728177282772837728477285772867728777288772897729077291772927729377294772957729677297772987729977300773017730277303773047730577306773077730877309773107731177312773137731477315773167731777318773197732077321773227732377324773257732677327773287732977330773317733277333773347733577336773377733877339773407734177342773437734477345773467734777348773497735077351773527735377354773557735677357773587735977360773617736277363773647736577366773677736877369773707737177372773737737477375773767737777378773797738077381773827738377384773857738677387773887738977390773917739277393773947739577396773977739877399774007740177402774037740477405774067740777408774097741077411774127741377414774157741677417774187741977420774217742277423774247742577426774277742877429774307743177432774337743477435774367743777438774397744077441774427744377444774457744677447774487744977450774517745277453774547745577456774577745877459774607746177462774637746477465774667746777468774697747077471774727747377474774757747677477774787747977480774817748277483774847748577486774877748877489774907749177492774937749477495774967749777498774997750077501775027750377504775057750677507775087750977510775117751277513775147751577516775177751877519775207752177522775237752477525775267752777528775297753077531775327753377534775357753677537775387753977540775417754277543775447754577546775477754877549775507755177552775537755477555775567755777558775597756077561775627756377564775657756677567775687756977570775717757277573775747757577576775777757877579775807758177582775837758477585775867758777588775897759077591775927759377594775957759677597775987759977600776017760277603776047760577606776077760877609776107761177612776137761477615776167761777618776197762077621776227762377624776257762677627776287762977630776317763277633776347763577636776377763877639776407764177642776437764477645776467764777648776497765077651776527765377654776557765677657776587765977660776617766277663776647766577666776677766877669776707767177672776737767477675776767767777678776797768077681776827768377684776857768677687776887768977690776917769277693776947769577696776977769877699777007770177702777037770477705777067770777708777097771077711777127771377714777157771677717777187771977720777217772277723777247772577726777277772877729777307773177732777337773477735777367773777738777397774077741777427774377744777457774677747777487774977750777517775277753777547775577756777577775877759777607776177762777637776477765777667776777768777697777077771777727777377774777757777677777777787777977780777817778277783777847778577786777877778877789777907779177792777937779477795777967779777798777997780077801778027780377804778057780677807778087780977810778117781277813778147781577816778177781877819778207782177822778237782477825778267782777828778297783077831778327783377834778357783677837778387783977840778417784277843778447784577846778477784877849778507785177852778537785477855778567785777858778597786077861778627786377864778657786677867778687786977870778717787277873778747787577876778777787877879778807788177882778837788477885778867788777888778897789077891778927789377894778957789677897778987789977900779017790277903779047790577906779077790877909779107791177912779137791477915779167791777918779197792077921779227792377924779257792677927779287792977930779317793277933779347793577936779377793877939779407794177942779437794477945779467794777948779497795077951779527795377954779557795677957779587795977960779617796277963779647796577966779677796877969779707797177972779737797477975779767797777978779797798077981779827798377984779857798677987779887798977990779917799277993779947799577996779977799877999780007800178002780037800478005780067800778008780097801078011780127801378014780157801678017780187801978020780217802278023780247802578026780277802878029780307803178032780337803478035780367803778038780397804078041780427804378044780457804678047780487804978050780517805278053780547805578056780577805878059780607806178062780637806478065780667806778068780697807078071780727807378074780757807678077780787807978080780817808278083780847808578086780877808878089780907809178092780937809478095780967809778098780997810078101781027810378104781057810678107781087810978110781117811278113781147811578116781177811878119781207812178122781237812478125781267812778128781297813078131781327813378134781357813678137781387813978140781417814278143781447814578146781477814878149781507815178152781537815478155781567815778158781597816078161781627816378164781657816678167781687816978170781717817278173781747817578176781777817878179781807818178182781837818478185781867818778188781897819078191781927819378194781957819678197781987819978200782017820278203782047820578206782077820878209782107821178212782137821478215782167821778218782197822078221782227822378224782257822678227782287822978230782317823278233782347823578236782377823878239782407824178242782437824478245782467824778248782497825078251782527825378254782557825678257782587825978260782617826278263782647826578266782677826878269782707827178272782737827478275782767827778278782797828078281782827828378284782857828678287782887828978290782917829278293782947829578296782977829878299783007830178302783037830478305783067830778308783097831078311783127831378314783157831678317783187831978320783217832278323783247832578326783277832878329783307833178332783337833478335783367833778338783397834078341783427834378344783457834678347783487834978350783517835278353783547835578356783577835878359783607836178362783637836478365783667836778368783697837078371783727837378374783757837678377783787837978380783817838278383783847838578386783877838878389783907839178392783937839478395783967839778398783997840078401784027840378404784057840678407784087840978410784117841278413784147841578416784177841878419784207842178422784237842478425784267842778428784297843078431784327843378434784357843678437784387843978440784417844278443784447844578446784477844878449784507845178452784537845478455784567845778458784597846078461784627846378464784657846678467784687846978470784717847278473784747847578476784777847878479784807848178482784837848478485784867848778488784897849078491784927849378494784957849678497784987849978500785017850278503785047850578506785077850878509785107851178512785137851478515785167851778518785197852078521785227852378524785257852678527785287852978530785317853278533785347853578536785377853878539785407854178542785437854478545785467854778548785497855078551785527855378554785557855678557785587855978560785617856278563785647856578566785677856878569785707857178572785737857478575785767857778578785797858078581785827858378584785857858678587785887858978590785917859278593785947859578596785977859878599786007860178602786037860478605786067860778608786097861078611786127861378614786157861678617786187861978620786217862278623786247862578626786277862878629786307863178632786337863478635786367863778638786397864078641786427864378644786457864678647786487864978650786517865278653786547865578656786577865878659786607866178662786637866478665786667866778668786697867078671786727867378674786757867678677786787867978680786817868278683786847868578686786877868878689786907869178692786937869478695786967869778698786997870078701787027870378704787057870678707787087870978710787117871278713787147871578716787177871878719787207872178722787237872478725787267872778728787297873078731787327873378734787357873678737787387873978740787417874278743787447874578746787477874878749787507875178752787537875478755787567875778758787597876078761787627876378764787657876678767787687876978770787717877278773787747877578776787777877878779787807878178782787837878478785787867878778788787897879078791787927879378794787957879678797787987879978800788017880278803788047880578806788077880878809788107881178812788137881478815788167881778818788197882078821788227882378824788257882678827788287882978830788317883278833788347883578836788377883878839788407884178842788437884478845788467884778848788497885078851788527885378854788557885678857788587885978860788617886278863788647886578866788677886878869788707887178872788737887478875788767887778878788797888078881788827888378884788857888678887788887888978890788917889278893788947889578896788977889878899789007890178902789037890478905789067890778908789097891078911789127891378914789157891678917789187891978920789217892278923789247892578926789277892878929789307893178932789337893478935789367893778938789397894078941789427894378944789457894678947789487894978950789517895278953789547895578956789577895878959789607896178962789637896478965789667896778968789697897078971789727897378974789757897678977789787897978980789817898278983789847898578986789877898878989789907899178992789937899478995789967899778998789997900079001790027900379004790057900679007790087900979010790117901279013790147901579016790177901879019790207902179022790237902479025790267902779028790297903079031790327903379034790357903679037790387903979040790417904279043790447904579046790477904879049790507905179052790537905479055790567905779058790597906079061790627906379064790657906679067790687906979070790717907279073790747907579076790777907879079790807908179082790837908479085790867908779088790897909079091790927909379094790957909679097790987909979100791017910279103791047910579106791077910879109791107911179112791137911479115791167911779118791197912079121791227912379124791257912679127791287912979130791317913279133791347913579136791377913879139791407914179142791437914479145791467914779148791497915079151791527915379154791557915679157791587915979160791617916279163791647916579166791677916879169791707917179172791737917479175791767917779178791797918079181791827918379184791857918679187791887918979190791917919279193791947919579196791977919879199792007920179202792037920479205792067920779208792097921079211792127921379214792157921679217792187921979220792217922279223792247922579226792277922879229792307923179232792337923479235792367923779238792397924079241792427924379244792457924679247792487924979250792517925279253792547925579256792577925879259792607926179262792637926479265792667926779268792697927079271792727927379274792757927679277792787927979280792817928279283792847928579286792877928879289792907929179292792937929479295792967929779298792997930079301793027930379304793057930679307793087930979310793117931279313793147931579316793177931879319793207932179322793237932479325793267932779328793297933079331793327933379334793357933679337793387933979340793417934279343793447934579346793477934879349793507935179352793537935479355793567935779358793597936079361793627936379364793657936679367793687936979370793717937279373793747937579376793777937879379793807938179382793837938479385793867938779388793897939079391793927939379394793957939679397793987939979400794017940279403794047940579406794077940879409794107941179412794137941479415794167941779418794197942079421794227942379424794257942679427794287942979430794317943279433794347943579436794377943879439794407944179442794437944479445794467944779448794497945079451794527945379454794557945679457794587945979460794617946279463794647946579466794677946879469794707947179472794737947479475794767947779478794797948079481794827948379484794857948679487794887948979490794917949279493794947949579496794977949879499795007950179502795037950479505795067950779508795097951079511795127951379514795157951679517795187951979520795217952279523795247952579526795277952879529795307953179532795337953479535795367953779538795397954079541795427954379544795457954679547795487954979550795517955279553795547955579556795577955879559795607956179562795637956479565795667956779568795697957079571795727957379574795757957679577795787957979580795817958279583795847958579586795877958879589795907959179592795937959479595795967959779598795997960079601796027960379604796057960679607796087960979610796117961279613796147961579616796177961879619796207962179622796237962479625796267962779628796297963079631796327963379634796357963679637796387963979640796417964279643796447964579646796477964879649796507965179652796537965479655796567965779658796597966079661796627966379664796657966679667796687966979670796717967279673796747967579676796777967879679796807968179682796837968479685796867968779688796897969079691796927969379694796957969679697796987969979700797017970279703797047970579706797077970879709797107971179712797137971479715797167971779718797197972079721797227972379724797257972679727797287972979730797317973279733797347973579736797377973879739797407974179742797437974479745797467974779748797497975079751797527975379754797557975679757797587975979760797617976279763797647976579766797677976879769797707977179772797737977479775797767977779778797797978079781797827978379784797857978679787797887978979790797917979279793797947979579796797977979879799798007980179802798037980479805798067980779808798097981079811798127981379814798157981679817798187981979820798217982279823798247982579826798277982879829798307983179832798337983479835798367983779838798397984079841798427984379844798457984679847798487984979850798517985279853798547985579856798577985879859798607986179862798637986479865798667986779868798697987079871798727987379874798757987679877798787987979880798817988279883798847988579886798877988879889798907989179892798937989479895798967989779898798997990079901799027990379904799057990679907799087990979910799117991279913799147991579916799177991879919799207992179922799237992479925799267992779928799297993079931799327993379934799357993679937799387993979940799417994279943799447994579946799477994879949799507995179952799537995479955799567995779958799597996079961799627996379964799657996679967799687996979970799717997279973799747997579976799777997879979799807998179982799837998479985799867998779988799897999079991799927999379994799957999679997799987999980000800018000280003800048000580006800078000880009800108001180012800138001480015800168001780018800198002080021800228002380024800258002680027800288002980030800318003280033800348003580036800378003880039800408004180042800438004480045800468004780048800498005080051800528005380054800558005680057800588005980060800618006280063800648006580066800678006880069800708007180072800738007480075800768007780078800798008080081800828008380084800858008680087800888008980090800918009280093800948009580096800978009880099801008010180102801038010480105801068010780108801098011080111801128011380114801158011680117801188011980120801218012280123801248012580126801278012880129801308013180132801338013480135801368013780138801398014080141801428014380144801458014680147801488014980150801518015280153801548015580156801578015880159801608016180162801638016480165801668016780168801698017080171801728017380174801758017680177801788017980180801818018280183801848018580186801878018880189801908019180192801938019480195801968019780198801998020080201802028020380204802058020680207802088020980210802118021280213802148021580216802178021880219802208022180222802238022480225802268022780228802298023080231802328023380234802358023680237802388023980240802418024280243802448024580246802478024880249802508025180252802538025480255802568025780258802598026080261802628026380264802658026680267802688026980270802718027280273802748027580276802778027880279802808028180282802838028480285802868028780288802898029080291802928029380294802958029680297802988029980300803018030280303803048030580306803078030880309803108031180312803138031480315803168031780318803198032080321803228032380324803258032680327803288032980330803318033280333803348033580336803378033880339803408034180342803438034480345803468034780348803498035080351803528035380354803558035680357803588035980360803618036280363803648036580366803678036880369803708037180372803738037480375803768037780378803798038080381803828038380384803858038680387803888038980390803918039280393803948039580396803978039880399804008040180402804038040480405804068040780408804098041080411804128041380414804158041680417804188041980420804218042280423804248042580426804278042880429804308043180432804338043480435804368043780438804398044080441804428044380444804458044680447804488044980450804518045280453804548045580456804578045880459804608046180462804638046480465804668046780468804698047080471804728047380474804758047680477804788047980480804818048280483804848048580486804878048880489804908049180492804938049480495804968049780498804998050080501805028050380504805058050680507805088050980510805118051280513805148051580516805178051880519805208052180522805238052480525805268052780528805298053080531805328053380534805358053680537805388053980540805418054280543805448054580546805478054880549805508055180552805538055480555805568055780558805598056080561805628056380564805658056680567805688056980570805718057280573805748057580576805778057880579805808058180582805838058480585805868058780588805898059080591805928059380594805958059680597805988059980600806018060280603806048060580606806078060880609806108061180612806138061480615806168061780618806198062080621806228062380624806258062680627806288062980630806318063280633806348063580636806378063880639806408064180642806438064480645806468064780648806498065080651806528065380654806558065680657806588065980660806618066280663806648066580666806678066880669806708067180672806738067480675806768067780678806798068080681806828068380684806858068680687806888068980690806918069280693806948069580696806978069880699807008070180702807038070480705807068070780708807098071080711807128071380714807158071680717807188071980720807218072280723807248072580726807278072880729807308073180732807338073480735807368073780738807398074080741807428074380744807458074680747807488074980750807518075280753807548075580756807578075880759807608076180762807638076480765807668076780768807698077080771807728077380774807758077680777807788077980780807818078280783807848078580786807878078880789807908079180792807938079480795807968079780798807998080080801808028080380804808058080680807808088080980810808118081280813808148081580816808178081880819808208082180822808238082480825808268082780828808298083080831808328083380834808358083680837808388083980840808418084280843808448084580846808478084880849808508085180852808538085480855808568085780858808598086080861808628086380864808658086680867808688086980870808718087280873808748087580876808778087880879808808088180882808838088480885808868088780888808898089080891808928089380894808958089680897808988089980900809018090280903809048090580906809078090880909809108091180912809138091480915809168091780918809198092080921809228092380924809258092680927809288092980930809318093280933809348093580936809378093880939809408094180942809438094480945809468094780948809498095080951809528095380954809558095680957809588095980960809618096280963809648096580966809678096880969809708097180972809738097480975809768097780978809798098080981809828098380984809858098680987809888098980990809918099280993809948099580996809978099880999810008100181002810038100481005810068100781008810098101081011810128101381014810158101681017810188101981020810218102281023810248102581026810278102881029810308103181032810338103481035810368103781038810398104081041810428104381044810458104681047810488104981050810518105281053810548105581056810578105881059810608106181062810638106481065810668106781068810698107081071810728107381074810758107681077810788107981080810818108281083810848108581086810878108881089810908109181092810938109481095810968109781098810998110081101811028110381104811058110681107811088110981110811118111281113811148111581116811178111881119811208112181122811238112481125811268112781128811298113081131811328113381134811358113681137811388113981140811418114281143811448114581146811478114881149811508115181152811538115481155811568115781158811598116081161811628116381164811658116681167811688116981170811718117281173811748117581176811778117881179811808118181182811838118481185811868118781188811898119081191811928119381194811958119681197811988119981200812018120281203812048120581206812078120881209812108121181212812138121481215812168121781218812198122081221812228122381224812258122681227812288122981230812318123281233812348123581236812378123881239812408124181242812438124481245812468124781248812498125081251812528125381254812558125681257812588125981260812618126281263812648126581266812678126881269812708127181272812738127481275812768127781278812798128081281812828128381284812858128681287812888128981290812918129281293812948129581296812978129881299813008130181302813038130481305813068130781308813098131081311813128131381314813158131681317813188131981320813218132281323813248132581326813278132881329813308133181332813338133481335813368133781338813398134081341813428134381344813458134681347813488134981350813518135281353813548135581356813578135881359813608136181362813638136481365813668136781368813698137081371813728137381374813758137681377813788137981380813818138281383813848138581386813878138881389813908139181392813938139481395813968139781398813998140081401814028140381404814058140681407814088140981410814118141281413814148141581416814178141881419814208142181422814238142481425814268142781428814298143081431814328143381434814358143681437814388143981440814418144281443814448144581446814478144881449814508145181452814538145481455814568145781458814598146081461814628146381464814658146681467814688146981470814718147281473814748147581476814778147881479814808148181482814838148481485814868148781488814898149081491814928149381494814958149681497814988149981500815018150281503815048150581506815078150881509815108151181512815138151481515815168151781518815198152081521815228152381524815258152681527815288152981530815318153281533815348153581536815378153881539815408154181542815438154481545815468154781548815498155081551815528155381554815558155681557815588155981560815618156281563815648156581566815678156881569815708157181572815738157481575815768157781578815798158081581815828158381584815858158681587815888158981590815918159281593815948159581596815978159881599816008160181602816038160481605816068160781608816098161081611816128161381614816158161681617816188161981620816218162281623816248162581626816278162881629816308163181632816338163481635816368163781638816398164081641816428164381644816458164681647816488164981650816518165281653816548165581656816578165881659816608166181662816638166481665816668166781668816698167081671816728167381674816758167681677816788167981680816818168281683816848168581686816878168881689816908169181692816938169481695816968169781698816998170081701817028170381704817058170681707817088170981710817118171281713817148171581716817178171881719817208172181722817238172481725817268172781728817298173081731817328173381734817358173681737817388173981740817418174281743817448174581746817478174881749817508175181752817538175481755817568175781758817598176081761817628176381764817658176681767817688176981770817718177281773817748177581776817778177881779817808178181782817838178481785817868178781788817898179081791817928179381794817958179681797817988179981800818018180281803818048180581806818078180881809818108181181812818138181481815818168181781818818198182081821818228182381824818258182681827818288182981830818318183281833818348183581836818378183881839818408184181842818438184481845818468184781848818498185081851818528185381854818558185681857818588185981860818618186281863818648186581866818678186881869818708187181872818738187481875818768187781878818798188081881818828188381884818858188681887818888188981890818918189281893818948189581896818978189881899819008190181902819038190481905819068190781908819098191081911819128191381914819158191681917819188191981920819218192281923819248192581926819278192881929819308193181932819338193481935819368193781938819398194081941819428194381944819458194681947819488194981950819518195281953819548195581956819578195881959819608196181962819638196481965819668196781968819698197081971819728197381974819758197681977819788197981980819818198281983819848198581986819878198881989819908199181992819938199481995819968199781998819998200082001820028200382004820058200682007820088200982010820118201282013820148201582016820178201882019820208202182022820238202482025820268202782028820298203082031820328203382034820358203682037820388203982040820418204282043820448204582046820478204882049820508205182052820538205482055820568205782058820598206082061820628206382064820658206682067820688206982070820718207282073820748207582076820778207882079820808208182082820838208482085820868208782088820898209082091820928209382094820958209682097820988209982100821018210282103821048210582106821078210882109821108211182112821138211482115821168211782118821198212082121821228212382124821258212682127821288212982130821318213282133821348213582136821378213882139821408214182142821438214482145821468214782148821498215082151821528215382154821558215682157821588215982160821618216282163821648216582166821678216882169821708217182172821738217482175821768217782178821798218082181821828218382184821858218682187821888218982190821918219282193821948219582196821978219882199822008220182202822038220482205822068220782208822098221082211822128221382214822158221682217822188221982220822218222282223822248222582226822278222882229822308223182232822338223482235822368223782238822398224082241822428224382244822458224682247822488224982250822518225282253822548225582256822578225882259822608226182262822638226482265822668226782268822698227082271822728227382274822758227682277822788227982280822818228282283822848228582286822878228882289822908229182292822938229482295822968229782298822998230082301823028230382304823058230682307823088230982310823118231282313823148231582316823178231882319823208232182322823238232482325823268232782328823298233082331823328233382334823358233682337823388233982340823418234282343823448234582346823478234882349823508235182352823538235482355823568235782358823598236082361823628236382364823658236682367823688236982370823718237282373823748237582376823778237882379823808238182382823838238482385823868238782388823898239082391823928239382394823958239682397823988239982400824018240282403824048240582406824078240882409824108241182412824138241482415824168241782418824198242082421824228242382424824258242682427824288242982430824318243282433824348243582436824378243882439824408244182442824438244482445824468244782448824498245082451824528245382454824558245682457824588245982460824618246282463824648246582466824678246882469824708247182472824738247482475824768247782478824798248082481824828248382484824858248682487824888248982490824918249282493824948249582496824978249882499825008250182502825038250482505825068250782508825098251082511825128251382514825158251682517825188251982520825218252282523825248252582526825278252882529825308253182532825338253482535825368253782538825398254082541825428254382544825458254682547825488254982550825518255282553825548255582556825578255882559825608256182562825638256482565825668256782568825698257082571825728257382574825758257682577825788257982580825818258282583825848258582586825878258882589825908259182592825938259482595825968259782598825998260082601826028260382604826058260682607826088260982610826118261282613826148261582616826178261882619826208262182622826238262482625826268262782628826298263082631826328263382634826358263682637826388263982640826418264282643826448264582646826478264882649826508265182652826538265482655826568265782658826598266082661826628266382664826658266682667826688266982670826718267282673826748267582676826778267882679826808268182682826838268482685826868268782688826898269082691826928269382694826958269682697826988269982700827018270282703827048270582706827078270882709827108271182712827138271482715827168271782718827198272082721827228272382724827258272682727827288272982730827318273282733827348273582736827378273882739827408274182742827438274482745827468274782748827498275082751827528275382754827558275682757827588275982760827618276282763827648276582766827678276882769827708277182772827738277482775827768277782778827798278082781827828278382784827858278682787827888278982790827918279282793827948279582796827978279882799828008280182802828038280482805828068280782808828098281082811828128281382814828158281682817828188281982820828218282282823828248282582826828278282882829828308283182832828338283482835828368283782838828398284082841828428284382844828458284682847828488284982850828518285282853828548285582856828578285882859828608286182862828638286482865828668286782868828698287082871828728287382874828758287682877828788287982880828818288282883828848288582886828878288882889828908289182892828938289482895828968289782898828998290082901829028290382904829058290682907829088290982910829118291282913829148291582916829178291882919829208292182922829238292482925829268292782928829298293082931829328293382934829358293682937829388293982940829418294282943829448294582946829478294882949829508295182952829538295482955829568295782958829598296082961829628296382964829658296682967829688296982970829718297282973829748297582976829778297882979829808298182982829838298482985829868298782988829898299082991829928299382994829958299682997829988299983000830018300283003830048300583006830078300883009830108301183012830138301483015830168301783018830198302083021830228302383024830258302683027830288302983030830318303283033830348303583036830378303883039830408304183042830438304483045830468304783048830498305083051830528305383054830558305683057830588305983060830618306283063830648306583066830678306883069830708307183072830738307483075830768307783078830798308083081830828308383084830858308683087830888308983090830918309283093830948309583096830978309883099831008310183102831038310483105831068310783108831098311083111831128311383114831158311683117831188311983120831218312283123831248312583126831278312883129831308313183132831338313483135831368313783138831398314083141831428314383144831458314683147831488314983150831518315283153831548315583156831578315883159831608316183162831638316483165831668316783168831698317083171831728317383174831758317683177831788317983180831818318283183831848318583186831878318883189831908319183192831938319483195831968319783198831998320083201832028320383204832058320683207832088320983210832118321283213832148321583216832178321883219832208322183222832238322483225832268322783228832298323083231832328323383234832358323683237832388323983240832418324283243832448324583246832478324883249832508325183252832538325483255832568325783258832598326083261832628326383264832658326683267832688326983270832718327283273832748327583276832778327883279832808328183282832838328483285832868328783288832898329083291832928329383294832958329683297832988329983300833018330283303833048330583306833078330883309833108331183312833138331483315833168331783318833198332083321833228332383324833258332683327833288332983330833318333283333833348333583336833378333883339833408334183342833438334483345833468334783348833498335083351833528335383354833558335683357833588335983360833618336283363833648336583366833678336883369833708337183372833738337483375833768337783378833798338083381833828338383384833858338683387833888338983390833918339283393833948339583396833978339883399834008340183402834038340483405834068340783408834098341083411834128341383414834158341683417834188341983420834218342283423834248342583426834278342883429834308343183432834338343483435834368343783438834398344083441834428344383444834458344683447834488344983450834518345283453834548345583456834578345883459834608346183462834638346483465834668346783468834698347083471834728347383474834758347683477834788347983480834818348283483834848348583486834878348883489834908349183492834938349483495834968349783498834998350083501835028350383504835058350683507835088350983510835118351283513835148351583516835178351883519835208352183522835238352483525835268352783528835298353083531835328353383534835358353683537835388353983540835418354283543835448354583546835478354883549835508355183552835538355483555835568355783558835598356083561835628356383564835658356683567835688356983570835718357283573835748357583576835778357883579835808358183582835838358483585835868358783588835898359083591835928359383594835958359683597835988359983600836018360283603836048360583606836078360883609836108361183612836138361483615836168361783618836198362083621836228362383624836258362683627836288362983630836318363283633836348363583636836378363883639836408364183642836438364483645836468364783648836498365083651836528365383654836558365683657836588365983660836618366283663836648366583666836678366883669836708367183672836738367483675836768367783678836798368083681836828368383684836858368683687836888368983690836918369283693836948369583696836978369883699837008370183702837038370483705837068370783708837098371083711837128371383714837158371683717837188371983720837218372283723837248372583726837278372883729837308373183732837338373483735837368373783738837398374083741837428374383744837458374683747837488374983750837518375283753837548375583756837578375883759837608376183762837638376483765837668376783768837698377083771837728377383774837758377683777837788377983780837818378283783837848378583786837878378883789837908379183792837938379483795837968379783798837998380083801838028380383804838058380683807838088380983810838118381283813838148381583816838178381883819838208382183822838238382483825838268382783828838298383083831838328383383834838358383683837838388383983840838418384283843838448384583846838478384883849838508385183852838538385483855838568385783858838598386083861838628386383864838658386683867838688386983870838718387283873838748387583876838778387883879838808388183882838838388483885838868388783888838898389083891838928389383894838958389683897838988389983900839018390283903839048390583906839078390883909839108391183912839138391483915839168391783918839198392083921839228392383924839258392683927839288392983930839318393283933839348393583936839378393883939839408394183942839438394483945839468394783948839498395083951839528395383954839558395683957839588395983960839618396283963839648396583966839678396883969839708397183972839738397483975839768397783978839798398083981839828398383984839858398683987839888398983990839918399283993839948399583996839978399883999840008400184002840038400484005840068400784008840098401084011840128401384014840158401684017840188401984020840218402284023840248402584026840278402884029840308403184032840338403484035840368403784038840398404084041840428404384044840458404684047840488404984050840518405284053840548405584056840578405884059840608406184062840638406484065840668406784068840698407084071840728407384074840758407684077840788407984080840818408284083840848408584086840878408884089840908409184092840938409484095840968409784098840998410084101841028410384104841058410684107841088410984110841118411284113841148411584116841178411884119841208412184122841238412484125841268412784128841298413084131841328413384134841358413684137841388413984140841418414284143841448414584146841478414884149841508415184152841538415484155841568415784158841598416084161841628416384164841658416684167841688416984170841718417284173841748417584176841778417884179841808418184182841838418484185841868418784188841898419084191841928419384194841958419684197841988419984200842018420284203842048420584206842078420884209842108421184212842138421484215842168421784218842198422084221842228422384224842258422684227842288422984230842318423284233842348423584236842378423884239842408424184242842438424484245842468424784248842498425084251842528425384254842558425684257842588425984260842618426284263842648426584266842678426884269842708427184272842738427484275842768427784278842798428084281842828428384284842858428684287842888428984290842918429284293842948429584296842978429884299843008430184302843038430484305843068430784308843098431084311843128431384314843158431684317843188431984320843218432284323843248432584326843278432884329843308433184332843338433484335843368433784338843398434084341843428434384344843458434684347843488434984350843518435284353843548435584356843578435884359843608436184362843638436484365843668436784368843698437084371843728437384374843758437684377843788437984380843818438284383843848438584386843878438884389843908439184392843938439484395843968439784398843998440084401844028440384404844058440684407844088440984410844118441284413844148441584416844178441884419844208442184422844238442484425844268442784428844298443084431844328443384434844358443684437844388443984440844418444284443844448444584446844478444884449844508445184452844538445484455844568445784458844598446084461844628446384464844658446684467844688446984470844718447284473844748447584476844778447884479844808448184482844838448484485844868448784488844898449084491844928449384494844958449684497844988449984500845018450284503845048450584506845078450884509845108451184512845138451484515845168451784518845198452084521845228452384524845258452684527845288452984530845318453284533845348453584536845378453884539845408454184542845438454484545845468454784548845498455084551845528455384554845558455684557845588455984560845618456284563845648456584566845678456884569845708457184572845738457484575845768457784578845798458084581845828458384584845858458684587845888458984590845918459284593845948459584596845978459884599846008460184602846038460484605846068460784608846098461084611846128461384614846158461684617846188461984620846218462284623846248462584626846278462884629846308463184632846338463484635846368463784638846398464084641846428464384644846458464684647846488464984650846518465284653846548465584656846578465884659846608466184662846638466484665846668466784668846698467084671846728467384674846758467684677846788467984680846818468284683846848468584686846878468884689846908469184692846938469484695846968469784698846998470084701847028470384704847058470684707847088470984710847118471284713847148471584716847178471884719847208472184722847238472484725847268472784728847298473084731847328473384734847358473684737847388473984740847418474284743847448474584746847478474884749847508475184752847538475484755847568475784758847598476084761847628476384764847658476684767847688476984770847718477284773847748477584776847778477884779847808478184782847838478484785847868478784788847898479084791847928479384794847958479684797847988479984800848018480284803848048480584806848078480884809848108481184812848138481484815848168481784818848198482084821848228482384824848258482684827848288482984830848318483284833848348483584836848378483884839848408484184842848438484484845848468484784848848498485084851848528485384854848558485684857848588485984860848618486284863848648486584866848678486884869848708487184872848738487484875848768487784878848798488084881848828488384884848858488684887848888488984890848918489284893848948489584896848978489884899849008490184902849038490484905849068490784908849098491084911849128491384914849158491684917849188491984920849218492284923849248492584926849278492884929849308493184932849338493484935849368493784938849398494084941849428494384944849458494684947849488494984950849518495284953849548495584956849578495884959849608496184962849638496484965849668496784968849698497084971849728497384974849758497684977849788497984980849818498284983849848498584986849878498884989849908499184992849938499484995849968499784998849998500085001850028500385004850058500685007850088500985010850118501285013850148501585016850178501885019850208502185022850238502485025850268502785028850298503085031850328503385034850358503685037850388503985040850418504285043850448504585046850478504885049850508505185052850538505485055850568505785058850598506085061850628506385064850658506685067850688506985070850718507285073850748507585076850778507885079850808508185082850838508485085850868508785088850898509085091850928509385094850958509685097850988509985100851018510285103851048510585106851078510885109851108511185112851138511485115851168511785118851198512085121851228512385124851258512685127851288512985130851318513285133851348513585136851378513885139851408514185142851438514485145851468514785148851498515085151851528515385154851558515685157851588515985160851618516285163851648516585166851678516885169851708517185172851738517485175851768517785178851798518085181851828518385184851858518685187851888518985190851918519285193851948519585196851978519885199852008520185202852038520485205852068520785208852098521085211852128521385214852158521685217852188521985220852218522285223852248522585226852278522885229852308523185232852338523485235852368523785238852398524085241852428524385244852458524685247852488524985250852518525285253852548525585256852578525885259852608526185262852638526485265852668526785268852698527085271852728527385274852758527685277852788527985280852818528285283852848528585286852878528885289852908529185292852938529485295852968529785298852998530085301853028530385304853058530685307853088530985310853118531285313853148531585316853178531885319853208532185322853238532485325853268532785328853298533085331853328533385334853358533685337853388533985340853418534285343853448534585346853478534885349853508535185352853538535485355853568535785358853598536085361853628536385364853658536685367853688536985370853718537285373853748537585376853778537885379853808538185382853838538485385853868538785388853898539085391853928539385394853958539685397853988539985400854018540285403854048540585406854078540885409854108541185412854138541485415854168541785418854198542085421854228542385424854258542685427854288542985430854318543285433854348543585436854378543885439854408544185442854438544485445854468544785448854498545085451854528545385454854558545685457854588545985460854618546285463854648546585466854678546885469854708547185472854738547485475854768547785478854798548085481854828548385484854858548685487854888548985490854918549285493854948549585496854978549885499855008550185502855038550485505855068550785508855098551085511855128551385514855158551685517855188551985520855218552285523855248552585526855278552885529855308553185532855338553485535855368553785538855398554085541855428554385544855458554685547855488554985550855518555285553855548555585556855578555885559855608556185562855638556485565855668556785568855698557085571855728557385574855758557685577855788557985580855818558285583855848558585586855878558885589855908559185592855938559485595855968559785598855998560085601856028560385604856058560685607856088560985610856118561285613856148561585616856178561885619856208562185622856238562485625856268562785628856298563085631856328563385634856358563685637856388563985640856418564285643856448564585646856478564885649856508565185652856538565485655856568565785658856598566085661856628566385664856658566685667856688566985670856718567285673856748567585676856778567885679856808568185682856838568485685856868568785688856898569085691856928569385694856958569685697856988569985700857018570285703857048570585706857078570885709857108571185712857138571485715857168571785718857198572085721857228572385724857258572685727857288572985730857318573285733857348573585736857378573885739857408574185742857438574485745857468574785748857498575085751857528575385754857558575685757857588575985760857618576285763857648576585766857678576885769857708577185772857738577485775857768577785778857798578085781857828578385784857858578685787857888578985790857918579285793857948579585796857978579885799858008580185802858038580485805858068580785808858098581085811858128581385814858158581685817858188581985820858218582285823858248582585826858278582885829858308583185832858338583485835858368583785838858398584085841858428584385844858458584685847858488584985850858518585285853858548585585856858578585885859858608586185862858638586485865858668586785868858698587085871858728587385874858758587685877858788587985880858818588285883858848588585886858878588885889858908589185892858938589485895858968589785898858998590085901859028590385904859058590685907859088590985910859118591285913859148591585916859178591885919859208592185922859238592485925859268592785928859298593085931859328593385934859358593685937859388593985940859418594285943859448594585946859478594885949859508595185952859538595485955859568595785958859598596085961859628596385964859658596685967859688596985970859718597285973859748597585976859778597885979859808598185982859838598485985859868598785988859898599085991859928599385994859958599685997859988599986000860018600286003860048600586006860078600886009860108601186012860138601486015860168601786018860198602086021860228602386024860258602686027860288602986030860318603286033860348603586036860378603886039860408604186042860438604486045860468604786048860498605086051860528605386054860558605686057860588605986060860618606286063860648606586066860678606886069860708607186072860738607486075860768607786078860798608086081860828608386084860858608686087860888608986090860918609286093860948609586096860978609886099861008610186102861038610486105861068610786108861098611086111861128611386114861158611686117861188611986120861218612286123861248612586126861278612886129861308613186132861338613486135861368613786138861398614086141861428614386144861458614686147861488614986150861518615286153861548615586156861578615886159861608616186162861638616486165861668616786168861698617086171861728617386174861758617686177861788617986180861818618286183861848618586186861878618886189861908619186192861938619486195861968619786198861998620086201862028620386204862058620686207862088620986210862118621286213862148621586216862178621886219862208622186222862238622486225862268622786228862298623086231862328623386234862358623686237862388623986240862418624286243862448624586246862478624886249862508625186252862538625486255862568625786258862598626086261862628626386264862658626686267862688626986270862718627286273862748627586276862778627886279862808628186282862838628486285862868628786288862898629086291862928629386294862958629686297862988629986300863018630286303863048630586306863078630886309863108631186312863138631486315863168631786318863198632086321863228632386324863258632686327863288632986330863318633286333863348633586336863378633886339863408634186342863438634486345863468634786348863498635086351863528635386354863558635686357863588635986360863618636286363863648636586366863678636886369863708637186372863738637486375863768637786378863798638086381863828638386384863858638686387863888638986390863918639286393863948639586396863978639886399864008640186402864038640486405864068640786408864098641086411864128641386414864158641686417864188641986420864218642286423864248642586426864278642886429864308643186432864338643486435864368643786438864398644086441864428644386444864458644686447864488644986450864518645286453864548645586456864578645886459864608646186462864638646486465864668646786468864698647086471864728647386474864758647686477864788647986480864818648286483864848648586486864878648886489864908649186492864938649486495864968649786498864998650086501865028650386504865058650686507865088650986510865118651286513865148651586516865178651886519865208652186522865238652486525865268652786528865298653086531865328653386534865358653686537865388653986540865418654286543865448654586546865478654886549865508655186552865538655486555865568655786558865598656086561865628656386564865658656686567865688656986570865718657286573865748657586576865778657886579865808658186582865838658486585865868658786588865898659086591865928659386594865958659686597865988659986600866018660286603866048660586606866078660886609866108661186612866138661486615866168661786618866198662086621866228662386624866258662686627866288662986630866318663286633866348663586636866378663886639866408664186642866438664486645866468664786648866498665086651866528665386654866558665686657866588665986660866618666286663866648666586666866678666886669866708667186672866738667486675866768667786678866798668086681866828668386684866858668686687866888668986690866918669286693866948669586696866978669886699867008670186702867038670486705867068670786708867098671086711867128671386714867158671686717867188671986720867218672286723867248672586726867278672886729867308673186732867338673486735867368673786738867398674086741867428674386744867458674686747867488674986750867518675286753867548675586756867578675886759867608676186762867638676486765867668676786768867698677086771867728677386774867758677686777867788677986780867818678286783867848678586786867878678886789867908679186792867938679486795867968679786798867998680086801868028680386804868058680686807868088680986810868118681286813868148681586816868178681886819868208682186822868238682486825868268682786828868298683086831868328683386834868358683686837868388683986840868418684286843868448684586846868478684886849868508685186852868538685486855868568685786858868598686086861868628686386864868658686686867868688686986870868718687286873868748687586876868778687886879868808688186882868838688486885868868688786888868898689086891868928689386894868958689686897868988689986900869018690286903869048690586906869078690886909869108691186912869138691486915869168691786918869198692086921869228692386924869258692686927869288692986930869318693286933869348693586936869378693886939869408694186942869438694486945869468694786948869498695086951869528695386954869558695686957869588695986960869618696286963869648696586966869678696886969869708697186972869738697486975869768697786978869798698086981869828698386984869858698686987869888698986990869918699286993869948699586996869978699886999870008700187002870038700487005870068700787008870098701087011870128701387014870158701687017870188701987020870218702287023870248702587026870278702887029870308703187032870338703487035870368703787038870398704087041870428704387044870458704687047870488704987050870518705287053870548705587056870578705887059870608706187062870638706487065870668706787068870698707087071870728707387074870758707687077870788707987080870818708287083870848708587086870878708887089870908709187092870938709487095870968709787098870998710087101871028710387104871058710687107871088710987110871118711287113871148711587116871178711887119871208712187122871238712487125871268712787128871298713087131871328713387134871358713687137871388713987140871418714287143871448714587146871478714887149871508715187152871538715487155871568715787158871598716087161871628716387164871658716687167871688716987170871718717287173871748717587176871778717887179871808718187182871838718487185871868718787188871898719087191871928719387194871958719687197871988719987200872018720287203872048720587206872078720887209872108721187212872138721487215872168721787218872198722087221872228722387224872258722687227872288722987230872318723287233872348723587236
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <naderman@naderman.de>
  7. * Jordi Boggiano <j.boggiano@seld.be>
  8. *
  9. * For the full copyright and license information, please view
  10. * the license that is located at the bottom of this file.
  11. */
  12. // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
  13. if (extension_loaded('apc') && ini_get('apc.enable_cli') && ini_get('apc.cache_by_default')) {
  14. if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
  15. ini_set('apc.cache_by_default', 0);
  16. } else {
  17. fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
  18. fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
  19. }
  20. }
  21. Phar::mapPhar('composer.phar');
  22. require 'phar://composer.phar/bin/composer';
  23. __HALT_COMPILER(); ?>
  24. ù‘��ë������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.phpþa��’àqZþa��tG�”¶������+���src/Composer/Autoload/ClassMapGenerator.php«��’àqZ«��ëÊš¶���������src/Composer/Cache.phpt��’àqZt���&#¶������%���src/Composer/Command/AboutCommand.phpË��’àqZË��º¡Ãh¶������'���src/Composer/Command/ArchiveCommand.phpL��’àqZL��… ;V¶������$���src/Composer/Command/BaseCommand.phpÉ ��’àqZÉ ��—P!£¶������.���src/Composer/Command/BaseDependencyCommand.phpÉ��’àqZÉ��D{²Ð¶������1���src/Composer/Command/CheckPlatformReqsCommand.php‚ ��’àqZ‚ ��ˆD†¶������*���src/Composer/Command/ClearCacheCommand.php]��’àqZ]��‚ß´¶������&���src/Composer/Command/ConfigCommand.php‡H��’àqZ‡H��Ä×Ö¶������-���src/Composer/Command/CreateProjectCommand.php;6��’àqZ;6��ü€y¶������'���src/Composer/Command/DependsCommand.php·��’àqZ·��o±¹ú¶������(���src/Composer/Command/DiagnoseCommand.phpÕG��’àqZÕG��ðõü ¶������,���src/Composer/Command/DumpAutoloadCommand.php
  25. ��’àqZ
  26. ��'K¬ž¶������$���src/Composer/Command/ExecCommand.phpi��’àqZi��Eþ€¶������&���src/Composer/Command/GlobalCommand.phpü��’àqZü��ÝH�\¶������$���src/Composer/Command/HomeCommand.phpÃ��’àqZÃ��¯àyB¶������$���src/Composer/Command/InitCommand.phpºJ��’àqZºJ��"T¼–¶������'���src/Composer/Command/InstallCommand.phpý��’àqZý��0ö:‰¶������(���src/Composer/Command/LicensesCommand.php&��’àqZ&��Óvƒ¶������(���src/Composer/Command/OutdatedCommand.php°
  27. ��’àqZ°
  28. ��7àzk¶������)���src/Composer/Command/ProhibitsCommand.phpË��’àqZË��g�ð¶������&���src/Composer/Command/RemoveCommand.php›��’àqZ›��>Sþ˜¶������'���src/Composer/Command/RequireCommand.phpÖ ��’àqZÖ ��B÷õE¶������)���src/Composer/Command/RunScriptCommand.phpq��’àqZq��p@­†¶������+���src/Composer/Command/ScriptAliasCommand.phpo��’àqZo�� 5Þl¶������&���src/Composer/Command/SearchCommand.phpã��’àqZã��ñ ¼w¶������*���src/Composer/Command/SelfUpdateCommand.phpÈ2��’àqZÈ2��+}”¶������$���src/Composer/Command/ShowCommand.phpug��’àqZug��ÀÕé¶������&���src/Composer/Command/StatusCommand.php/��’àqZ/��ôE_¶������(���src/Composer/Command/SuggestsCommand.php¨ ��’àqZ¨ ��¼Ñc¶������&���src/Composer/Command/UpdateCommand.php¯#��’àqZ¯#��—ú�T¶������(���src/Composer/Command/ValidateCommand.php#��’àqZ#��‰��~¶���������src/Composer/Composer.phpù ��’àqZù ��†ƒR¶���������src/Composer/Config.phpÅ"��’àqZÅ"��FÅ�¡¶������-���src/Composer/Config/ConfigSourceInterface.php��’àqZ��³ [/¶������(���src/Composer/Config/JsonConfigSource.php!��’àqZ!��¾S N¶������$���src/Composer/Console/Application.php§3��’àqZ§3��‰D;q¶������,���src/Composer/Console/HtmlOutputFormatter.php3��’àqZ3��Ú�Eu¶������-���src/Composer/DependencyResolver/Decisions.phpQ��’àqZQ��?˜¬$¶������1���src/Composer/DependencyResolver/DefaultPolicy.php��’àqZ��õÝv¶������/���src/Composer/DependencyResolver/GenericRule.php·��’àqZ·��Ì~¯³¶������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��’àqZC��´\õ*¶������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��’àqZ÷��ïÎà÷¶������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��’àqZý��3#†¶������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���’àqZÓ���Ùâ&ä¶������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��’àqZ¹��&¢e
  29. ¶������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��’àqZI��FûÂɶ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phph��’àqZh��öSÕ]¶������3���src/Composer/DependencyResolver/PolicyInterface.php­��’àqZ­��Ÿ‹R¶������(���src/Composer/DependencyResolver/Pool.php°"��’àqZ°"�� Ž%¶������+���src/Composer/DependencyResolver/Problem.php¥��’àqZ¥��@ˆ<4¶������+���src/Composer/DependencyResolver/Request.phpƒ��’àqZƒ��åVP„¶������(���src/Composer/DependencyResolver/Rule.php¶��’àqZ¶��Ú{��¶������1���src/Composer/DependencyResolver/Rule2Literals.php§��’àqZ§��~Ð'ò¶������+���src/Composer/DependencyResolver/RuleSet.phpª
  30. ��’àqZª
  31. ��_΂¶������4���src/Composer/DependencyResolver/RuleSetGenerator.phpL��’àqZL��¡³`¶������3���src/Composer/DependencyResolver/RuleSetIterator.php��’àqZ��›Cü$¶������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��’àqZi��hïš,¶������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��’àqZá��‰rôv¶������1���src/Composer/DependencyResolver/RuleWatchNode.phpé��’àqZé��hØÑ´¶������*���src/Composer/DependencyResolver/Solver.phpŸ8��’àqZŸ8��pöb¶������6���src/Composer/DependencyResolver/SolverBugException.php˜��’àqZ˜��"qN¶������;���src/Composer/DependencyResolver/SolverProblemsException.phpô��’àqZô��×|Ŧ¶������/���src/Composer/DependencyResolver/Transaction.phpÙ��’àqZÙ��5ÖHÀ¶������-���src/Composer/Downloader/ArchiveDownloader.php³ ��’àqZ³ ��ÖðÞŸ¶������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���’àqZÌ���¯à¨¿¶������+���src/Composer/Downloader/DownloadManager.php`��’àqZ`��†ë�¾¶������/���src/Composer/Downloader/DownloaderInterface.phpÊ��’àqZÊ��gs!l¶������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���’àqZÑ���&Áœ¿¶������*���src/Composer/Downloader/FileDownloader.php���’àqZ���1‚ã¶������/���src/Composer/Downloader/FilesystemException.php
  32. ��’àqZ
  33. ��.-‹¶������,���src/Composer/Downloader/FossilDownloader.php` ��’àqZ` ��ÿI©u¶������)���src/Composer/Downloader/GitDownloader.php?4��’àqZ?4��e�'¶������*���src/Composer/Downloader/GzipDownloader.phpó��’àqZó��}Úo¶������(���src/Composer/Downloader/HgDownloader.php8 ��’àqZ8 ��ëyàn¶������*���src/Composer/Downloader/PathDownloader.phpK��’àqZK��9•&c¶������0���src/Composer/Downloader/PearPackageExtractor.phpu��’àqZu��z„‡¶������.���src/Composer/Downloader/PerforceDownloader.php§��’àqZ§��⃨¶������*���src/Composer/Downloader/PharDownloader.phpå���’àqZå���ÞÉç¶������)���src/Composer/Downloader/RarDownloader.phpž��’àqZž��6 3U¶������)���src/Composer/Downloader/SvnDownloader.phpH��’àqZH��ùÀF¶������)���src/Composer/Downloader/TarDownloader.phpã���’àqZã���Í’X?¶������.���src/Composer/Downloader/TransportException.php=��’àqZ=��ZÎÈÞ¶������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���’àqZÔ���`§ôö¶������)���src/Composer/Downloader/VcsDownloader.php"��’àqZ"��œŸp¶������(���src/Composer/Downloader/XzDownloader.php§��’àqZ§��W$;á¶������)���src/Composer/Downloader/ZipDownloader.php˜��’àqZ˜��›@ü¶������&���src/Composer/EventDispatcher/Event.php ��’àqZ ��±™jï¶������0���src/Composer/EventDispatcher/EventDispatcher.phpß0��’àqZß0��}f¶������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���’àqZ©���h·0¶������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���’àqZv���wZ8S¶������)���src/Composer/Exception/NoSslException.phpf���’àqZf���ËíM�¶���������src/Composer/Factory.phpU=��’àqZU=��%êÿí¶���������src/Composer/IO/BaseIO.phpŒ��’àqZŒ��(‚l‘¶���������src/Composer/IO/BufferIO.php*��’àqZ*��¢®hT¶���������src/Composer/IO/ConsoleIO.php‡��’àqZ‡��h—tH¶���������src/Composer/IO/IOInterface.phpì��’àqZì���Õ�¶���������src/Composer/IO/NullIO.phpÀ��’àqZÀ��F`sʶ���������src/Composer/Installer.phpXœ��’àqZXœ��éå*¶������*���src/Composer/Installer/BinaryInstaller.phpÛ��’àqZÛ��<x> ¶������2���src/Composer/Installer/BinaryPresenceInterface.phpË���’àqZË���À5š¨¶������.���src/Composer/Installer/InstallationManager.php-��’àqZ-��¾}Œ7¶������)���src/Composer/Installer/InstallerEvent.php��’àqZ��lÔzi¶������*���src/Composer/Installer/InstallerEvents.phpÞ���’àqZÞ���ìŸ@G¶������-���src/Composer/Installer/InstallerInterface.phpã��’àqZã��^ƒ“ʶ������+���src/Composer/Installer/LibraryInstaller.php^��’àqZ^��Ír¶������/���src/Composer/Installer/MetapackageInstaller.phpœ��’àqZœ��ÆÅ!¶������(���src/Composer/Installer/NoopInstaller.php+��’àqZ+��À·M}¶������'���src/Composer/Installer/PackageEvent.phpe��’àqZe��;° ¶������(���src/Composer/Installer/PackageEvents.php¸��’àqZ¸��dbØs¶������.���src/Composer/Installer/PearBinaryInstaller.phpâ ��’àqZâ ��;øiU¶������(���src/Composer/Installer/PearInstaller.php¢��’àqZ¢��È‚¶Ñ¶������*���src/Composer/Installer/PluginInstaller.phpŸ��’àqZŸ��<tú,¶������+���src/Composer/Installer/ProjectInstaller.php��’àqZ��*0@P¶������4���src/Composer/Installer/SuggestedPackagesReporter.php��’àqZ��+±]Ķ���������src/Composer/Json/JsonFile.phpï��’àqZï��_( ¶������#���src/Composer/Json/JsonFormatter.php��’àqZ��Ðqu¶������%���src/Composer/Json/JsonManipulator.php°2��’àqZ°2��Žèζ������-���src/Composer/Json/JsonValidationException.php\��’àqZ\��.Xóܶ������%���src/Composer/Package/AliasPackage.php��’àqZ��¹—~š¶������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��’àqZ ��yY+¦¶������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��’àqZÞ�� ²²¹¶������0���src/Composer/Package/Archiver/ArchiveManager.php° ��’àqZ° ��gþÒ)¶������3���src/Composer/Package/Archiver/ArchiverInterface.php��’àqZ��ñ´> ¶������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��’àqZ–��y¶=ƶ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��’àqZ��‹SZ0¶������2���src/Composer/Package/Archiver/GitExcludeFilter.phpq��’àqZq��5¾i&¶������1���src/Composer/Package/Archiver/HgExcludeFilter.php ��’àqZ �� •¦S¶������.���src/Composer/Package/Archiver/PharArchiver.php>��’àqZ>�� 5‰í¶������-���src/Composer/Package/Archiver/ZipArchiver.php¼��’àqZ¼��‘XÝë¶������$���src/Composer/Package/BasePackage.php& ��’àqZ& ��'ݶ������(���src/Composer/Package/CompletePackage.phpü��’àqZü��þM˶¶������1���src/Composer/Package/CompletePackageInterface.phpõ��’àqZõ��¦Ê�ò¶������+���src/Composer/Package/Dumper/ArrayDumper.phpë ��’àqZë ��Ó8WE¶���������src/Composer/Package/Link.phpˆ��’àqZˆ��å¶Y«¶������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��’àqZ‚��é~‹¶������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��’àqZd��¤ôLn¶������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��’àqZ‚��ób`ý¶������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��’àqZi��Þ”š%¶������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��’àqZX��}`y¶������+���src/Composer/Package/Loader/ArrayLoader.php��’àqZ��n~œ›¶������7���src/Composer/Package/Loader/InvalidPackageException.phpE��’àqZE��xb¾¶������*���src/Composer/Package/Loader/JsonLoader.phpù��’àqZù��!~ˆ{¶������/���src/Composer/Package/Loader/LoaderInterface.php²���’àqZ²���¦}úζ������1���src/Composer/Package/Loader/RootPackageLoader.php$��’àqZ$��Ârü°¶������5���src/Composer/Package/Loader/ValidatingArrayLoader.phpT:��’àqZT:��AôX϶���������src/Composer/Package/Locker.php©!��’àqZ©!��AŠõë¶������ ���src/Composer/Package/Package.phpÉ��’àqZÉ��cÃ�h¶������)���src/Composer/Package/PackageInterface.php ��’àqZ ��ûÇ^ƶ������)���src/Composer/Package/RootAliasPackage.php ��’àqZ �� _€ø¶������$���src/Composer/Package/RootPackage.php��’àqZ��ŽÎ_¶������-���src/Composer/Package/RootPackageInterface.php¹��’àqZ¹��"maV¶������/���src/Composer/Package/Version/VersionGuesser.phpO��’àqZO��ˆSœ¶������.���src/Composer/Package/Version/VersionParser.phpo��’àqZo��m€;¶������0���src/Composer/Package/Version/VersionSelector.phpK ��’àqZK ��²<ȶ������-���src/Composer/Plugin/Capability/Capability.phpW���’àqZW���æ_¨1¶������2���src/Composer/Plugin/Capability/CommandProvider.php—���’àqZ—���ûOâ>¶���������src/Composer/Plugin/Capable.php���’àqZ���Æq+¶������$���src/Composer/Plugin/CommandEvent.phpâ��’àqZâ��³ÆÇW¶������$���src/Composer/Plugin/PluginEvents.phpÂ���’àqZÂ���^Íþ¶������'���src/Composer/Plugin/PluginInterface.phpô���’àqZô���)'*ض������%���src/Composer/Plugin/PluginManager.php$��’àqZ$��ëŽ"»¶������,���src/Composer/Plugin/PreFileDownloadEvent.php`��’àqZ`���9-ζ������4���src/Composer/Question/StrictConfirmationQuestion.php��’àqZ��'.³è¶������+���src/Composer/Repository/ArrayRepository.php��’àqZ��éÌt�¶������.���src/Composer/Repository/ArtifactRepository.php» ��’àqZ» ��ˆÝ÷<¶������*���src/Composer/Repository/BaseRepository.php] ��’àqZ] ��ä&3‡¶������.���src/Composer/Repository/ComposerRepository.php‡T��’àqZ‡T��Ç“×{¶������/���src/Composer/Repository/CompositeRepository.php;��’àqZ;��¤¯S¶������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���’àqZ…���±Ÿ_¶������0���src/Composer/Repository/FilesystemRepository.php$��’àqZ$��¾Ãá…¶������4���src/Composer/Repository/InstalledArrayRepository.php£���’àqZ£���/ö~>¶������9���src/Composer/Repository/InstalledFilesystemRepository.php£���’àqZ£���V
  34. •_¶������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���’àqZ‡���£9p¶������6���src/Composer/Repository/InvalidRepositoryException.phpn���’àqZn���à“똶������-���src/Composer/Repository/PackageRepository.phpj��’àqZj��¥ôò̶������*���src/Composer/Repository/PathRepository.phpw
  35. ��’àqZw
  36. ���~õ³¶������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��’àqZI��c6³¶������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��’àqZÄ��:T*ɶ������.���src/Composer/Repository/Pear/ChannelReader.phpí��’àqZí��?ÈYT¶������4���src/Composer/Repository/Pear/ChannelRest10Reader.php® ��’àqZ® ��™ÖÛú¶������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��’àqZ& ��òUb¶������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��’àqZq��9=¶������/���src/Composer/Repository/Pear/DependencyInfo.phpq��’àqZq��fºTò¶������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��’àqZ…��÷$Li¶������,���src/Composer/Repository/Pear/PackageInfo.php°��’àqZ°��Ÿ ¸ ¶������,���src/Composer/Repository/Pear/ReleaseInfo.php’��’àqZ’��o“ŠÃ¶������*���src/Composer/Repository/PearRepository.phpª��’àqZª��)Ÿƒ}¶������.���src/Composer/Repository/PlatformRepository.php��’àqZ��fVÉ¢¶������-���src/Composer/Repository/RepositoryFactory.php2��’àqZ2��t>¶������/���src/Composer/Repository/RepositoryInterface.phpÛ��’àqZÛ��’âÁ¶������-���src/Composer/Repository/RepositoryManager.php,
  37. ��’àqZ,
  38. ��¾…\•¶������7���src/Composer/Repository/RepositorySecurityException.phpo���’àqZo���pÕ«ª¶������/���src/Composer/Repository/Vcs/BitbucketDriver.phpô��’àqZô��x¤ü¶������,���src/Composer/Repository/Vcs/FossilDriver.php���’àqZ���À]µ¶������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpê��’àqZê��ÃŽ»¶������)���src/Composer/Repository/Vcs/GitDriver.php¼��’àqZ¼��Š©Ðê¶������,���src/Composer/Repository/Vcs/GitHubDriver.php¡+��’àqZ¡+��ýYû
  39. ¶������,���src/Composer/Repository/Vcs/GitLabDriver.phpÍ#��’àqZÍ#��ßNìʶ������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpä��’àqZä��i›üà¶������(���src/Composer/Repository/Vcs/HgDriver.phpe��’àqZe��O!O¶������.���src/Composer/Repository/Vcs/PerforceDriver.php' ��’àqZ' ��ÙóH¶������)���src/Composer/Repository/Vcs/SvnDriver.php��’àqZ��Õzï¶������)���src/Composer/Repository/Vcs/VcsDriver.phpæ
  40. ��’àqZæ
  41. ��eׯ-¶������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��’àqZ÷��ÇX[‰¶������)���src/Composer/Repository/VcsRepository.php´��’àqZ´��ªÖG¶������3���src/Composer/Repository/WritableArrayRepository.php��’àqZ��¾G*¶������7���src/Composer/Repository/WritableRepositoryInterface.php‰��’àqZ‰��‘/sï¶������$���src/Composer/Script/CommandEvent.phpW���’àqZW���£VZt¶���������src/Composer/Script/Event.phpµ��’àqZµ��lt¦M¶������$���src/Composer/Script/PackageEvent.phpœ���’àqZœ���§ÿÉ ¶������$���src/Composer/Script/ScriptEvents.phpP��’àqZP��‡�¶¶������ ���src/Composer/SelfUpdate/Keys.php���’àqZ��� îÊN¶������$���src/Composer/SelfUpdate/Versions.phpì��’àqZì��͵‘ƒ¶������ ���src/Composer/Util/AuthHelper.phpË��’àqZË��>zx–¶���������src/Composer/Util/Bitbucket.php%��’àqZ%��n=gÓ¶������$���src/Composer/Util/ComposerMirror.php±��’àqZ±��­½øض������%���src/Composer/Util/ConfigValidator.php¥��’àqZ¥��8ñžê¶������"���src/Composer/Util/ErrorHandler.php‡��’àqZ‡��He"¶������ ���src/Composer/Util/Filesystem.php3/��’àqZ3/��m44ô¶���������src/Composer/Util/Git.php!&��’àqZ!&��lsý׶���������src/Composer/Util/GitHub.phpÏ
  42. ��’àqZÏ
  43. ��ÁØ\å¶���������src/Composer/Util/GitLab.php™ ��’àqZ™ ��BLF¶���������src/Composer/Util/IniHelper.php]��’àqZ]��®äéä¶������$���src/Composer/Util/NoProxyPattern.php¾��’àqZ¾��Z+°m¶���������src/Composer/Util/Perforce.php‚1��’àqZ‚1��,œbx¶���������src/Composer/Util/Platform.phpü��’àqZü��s­fç¶������%���src/Composer/Util/ProcessExecutor.phpÚ ��’àqZÚ ��£ÒÙ¶������&���src/Composer/Util/RemoteFilesystem.phpýb��’àqZýb��Mùjж���������src/Composer/Util/Silencer.phpé��’àqZé��“Vjf¶������!���src/Composer/Util/SpdxLicense.php��’àqZ��¾7
  44. ñ¶������*���src/Composer/Util/StreamContextFactory.php��’àqZ��ËH*v¶���������src/Composer/Util/Svn.php‚��’àqZ‚�� Vr¶���������src/Composer/Util/TlsHelper.phpp
  45. ��’àqZp
  46. ��¤eÞæ¶���������src/Composer/Util/Url.phpÀ��’àqZÀ��lqh¶���������src/Composer/XdebugHandler.php“��’àqZ“��ÕWÖ>¶���������src/bootstrap.php¹��’àqZ¹��I}œ¶������%���src/Composer/Autoload/ClassLoader.phpl4��’àqZl4��’ø[÷¶������#���res/composer-repository-schema.jsonð��’àqZð���GÐà¶���������res/composer-schema.jsony•��’àqZy•��³Ì¶`¶������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json}��’àqZ}��/Yž¶������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonàŒ��’àqZàŒ��£O¶������*���vendor/seld/cli-prompt/res/hiddeninput.exe�$��’àqZ�$��•�¥v¶������&���vendor/symfony/console/Application.php#W��’àqZ#W��èðz¶������*���vendor/symfony/console/Command/Command.phpò"��’àqZò"��ÊRÑç¶������.���vendor/symfony/console/Command/HelpCommand.phpØ��’àqZØ��$Y«¶������.���vendor/symfony/console/Command/ListCommand.phpZ��’àqZZ��É£ ¶������(���vendor/symfony/console/ConsoleEvents.phpé���’àqZé���RÛÔe¶������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÐ��’àqZÐ��™Ž5°¶������0���vendor/symfony/console/Descriptor/Descriptor.phpŽ��’àqZŽ��éð8Ÿ¶������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���’àqZü���±Qµ¶������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpá ��’àqZá ��‡ àƶ������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¹��’àqZ¹��kŸ.a¶������4���vendor/symfony/console/Descriptor/TextDescriptor.php²��’àqZ²���­ùâ¶������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��’àqZ��
  47. ]…ζ������4���vendor/symfony/console/Event/ConsoleCommandEvent.php°��’àqZ°��!�ȶ������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��’àqZÅ��ÒxÛ\¶������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��’àqZ��á2é¶������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��’àqZz��³,îL¶������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��’àqZÔ��È÷ L¶������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���’àqZf���¡ABª¶������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���’àqZ¦���Ö̽Z¶������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���’àqZ¦���Ë×H¶������3���vendor/symfony/console/Exception/LogicException.php’���’àqZ’���ÍO\e¶������5���vendor/symfony/console/Exception/RuntimeException.php–���’àqZ–���Ùí,6¶������4���vendor/symfony/console/Formatter/OutputFormatter.php2��’àqZ2��RÌYh¶������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒ��’àqZŒ��òññÀ¶������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpJ��’àqZJ��ÏDSȶ������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„��’àqZ„��÷½G¶������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php>��’àqZ>��[†¿–¶������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpx��’àqZx��N©Ø¼¶������2���vendor/symfony/console/Helper/DescriptorHelper.phpw��’àqZw��ÅHð.¶������.���vendor/symfony/console/Helper/DialogHelper.phpú��’àqZú��¼ O�¶������1���vendor/symfony/console/Helper/FormatterHelper.phpc��’àqZc��“ý«N¶������(���vendor/symfony/console/Helper/Helper.php¨��’àqZ¨��œoû3¶������1���vendor/symfony/console/Helper/HelperInterface.phpå���’àqZå���Š ¶������+���vendor/symfony/console/Helper/HelperSet.phpÉ��’àqZÉ��œf5¶������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��’àqZc��ñø�|¶������/���vendor/symfony/console/Helper/ProcessHelper.phpÑ ��’àqZÑ ��@±ã�¶������-���vendor/symfony/console/Helper/ProgressBar.phpk%��’àqZk%��ìîa¶������0���vendor/symfony/console/Helper/ProgressHelper.php\��’àqZ\��‘ÃYÓ¶������3���vendor/symfony/console/Helper/ProgressIndicator.phpK��’àqZK��íÍ°¶������0���vendor/symfony/console/Helper/QuestionHelper.php ��’àqZ ��Lú4¶������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.phpl
  48. ��’àqZl
  49. ��÷ÞL¶������'���vendor/symfony/console/Helper/Table.php¨*��’àqZ¨*��e{))¶������+���vendor/symfony/console/Helper/TableCell.php€��’àqZ€��Ìî*Û¶������-���vendor/symfony/console/Helper/TableHelper.php ��’àqZ ��QRº¶������0���vendor/symfony/console/Helper/TableSeparator.phpÊ���’àqZÊ���az¶������,���vendor/symfony/console/Helper/TableStyle.php
  50. ��’àqZ
  51. ��PÞµ¦¶������*���vendor/symfony/console/Input/ArgvInput.php7��’àqZ7��ØQ|ʶ������+���vendor/symfony/console/Input/ArrayInput.php ��’àqZ ��ʹóþ¶������&���vendor/symfony/console/Input/Input.php¢ ��’àqZ¢ ��”‡B"¶������.���vendor/symfony/console/Input/InputArgument.php��’àqZ��&<¦¯¶������4���vendor/symfony/console/Input/InputAwareInterface.phpš���’àqZš���‡jTŸ¶������0���vendor/symfony/console/Input/InputDefinition.phpŠ��’àqZŠ��émáP¶������/���vendor/symfony/console/Input/InputInterface.php���’àqZ���®#£¶������,���vendor/symfony/console/Input/InputOption.php ��’àqZ ��ùýN4¶������,���vendor/symfony/console/Input/StringInput.php–��’àqZ–��cì\(¶���������vendor/symfony/console/LICENSE)��’àqZ)��·)E`¶������/���vendor/symfony/console/Logger/ConsoleLogger.php. ��’àqZ. ��¤Œ…ζ������0���vendor/symfony/console/Output/BufferedOutput.php_��’àqZ_��‹ >P¶������/���vendor/symfony/console/Output/ConsoleOutput.php°��’àqZ°��]k~o¶������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpà���’àqZà���‡†Æʶ������,���vendor/symfony/console/Output/NullOutput.phpÏ��’àqZÏ��®˜‹Z¶������(���vendor/symfony/console/Output/Output.php˜ ��’àqZ˜ ��pf\¶������1���vendor/symfony/console/Output/OutputInterface.php��’àqZ���ì&¶������.���vendor/symfony/console/Output/StreamOutput.phpÂ��’àqZÂ��¥<I¶������2���vendor/symfony/console/Question/ChoiceQuestion.phpw
  52. ��’àqZw
  53. ��2t¶������8���vendor/symfony/console/Question/ConfirmationQuestion.phpç��’àqZç�� ­òf¶������,���vendor/symfony/console/Question/Question.phpË ��’àqZË ��ÒqµR¶������ ���vendor/symfony/console/Shell.phpå��’àqZå��•šxS¶������,���vendor/symfony/console/Style/OutputStyle.php\��’àqZ\��wפ¶������/���vendor/symfony/console/Style/StyleInterface.phpÏ��’àqZÏ��&nÅѶ������-���vendor/symfony/console/Style/SymfonyStyle.php¶��’àqZ¶��ª×ì¶������3���vendor/symfony/console/Tester/ApplicationTester.phpÏ��’àqZÏ��sž9i¶������/���vendor/symfony/console/Tester/CommandTester.phpª��’àqZª��µ.âr¶������(���vendor/symfony/debug/BufferingLogger.phpt��’àqZt��=�hܶ���������vendor/symfony/debug/Debug.phpé��’àqZé��Àxa?¶������)���vendor/symfony/debug/DebugClassLoader.php¡��’àqZ¡��ó€v‡¶������%���vendor/symfony/debug/ErrorHandler.php€C��’àqZ€C��¥æõ¾¶������9���vendor/symfony/debug/Exception/ClassNotFoundException.php„��’àqZ„��n�¡…¶������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��’àqZ˜��-
  54. d2¶������1���vendor/symfony/debug/Exception/DummyException.php��’àqZ��-"ûd¶������6���vendor/symfony/debug/Exception/FatalErrorException.phpï��’àqZï��æ fz¶������6���vendor/symfony/debug/Exception/FatalThrowableError.phpD��’àqZD��¡ Âí¶������3���vendor/symfony/debug/Exception/FlattenException.php²��’àqZ²��HòѶ������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���’àqZ~���ë¨oâ¶������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpˆ��’àqZˆ��¢G‚n¶������;���vendor/symfony/debug/Exception/UndefinedMethodException.php†��’àqZ†��¨LÚ:¶������)���vendor/symfony/debug/ExceptionHandler.php3��’àqZ3��ièŠ4¶������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php7��’àqZ7��Ñj/=¶������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��’àqZ��ĹBV¶������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpu��’àqZu��éj¶������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpN��’àqZN��Ço-ç¶���������vendor/symfony/debug/LICENSE)��’àqZ)��·)E`¶������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���’àqZi���$ ÿ›¶������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��’àqZ¼��pí\¶¶������3���vendor/symfony/filesystem/Exception/IOException.php‡��’àqZ‡��€ü#Ѷ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���’àqZ¦���jÙwM¶������(���vendor/symfony/filesystem/Filesystem.phpö2��’àqZö2��ëP�ò¶������!���vendor/symfony/filesystem/LICENSE)��’àqZ)��·)E`¶������)���vendor/symfony/filesystem/LockHandler.php¢��’àqZ¢��D‘;i¶������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��’àqZ\ ��Æ“É€¶������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php‹��’àqZ‹��]vk1¶������2���vendor/symfony/finder/Adapter/AdapterInterface.php›��’àqZ›��Mþ¶������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php2��’àqZ2��Q/ÇC¶������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��’àqZ��( í?¶������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��’àqZô��:?¶������/���vendor/symfony/finder/Comparator/Comparator.phpŒ��’àqZŒ��wþT¶������3���vendor/symfony/finder/Comparator/DateComparator.php#��’àqZ#��°ζ������5���vendor/symfony/finder/Comparator/NumberComparator.php|��’àqZ|��ITÇͶ������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���’àqZ„���½¾sœ¶������;���vendor/symfony/finder/Exception/AdapterFailureException.php¬��’àqZ¬��Xå‘ž¶������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���’àqZ„���Gz-¶������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��’àqZ)��ìcj=¶������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpº��’àqZº��Êø¶������/���vendor/symfony/finder/Expression/Expression.php��’àqZ��µoÔ¶������)���vendor/symfony/finder/Expression/Glob.phpf��’àqZf��lïÜP¶������*���vendor/symfony/finder/Expression/Regex.php��’àqZ��Qr“¡¶������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��’àqZÍ��²~øb¶������ ���vendor/symfony/finder/Finder.php¹-��’àqZ¹-��Qÿ2¶���������vendor/symfony/finder/Glob.phpK��’àqZK��já±n¶������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php[��’àqZ[��­åW¶������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpx��’àqZx��ôP¶������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpî��’àqZî��üÍ�q¶������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpí��’àqZí��nõH¶������4���vendor/symfony/finder/Iterator/FilePathsIterator.php ��’àqZ ��fQCe¶������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZ��’àqZZ��(&ø¶������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��’àqZ5��ší¶������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��’àqZr��tu¶������1���vendor/symfony/finder/Iterator/FilterIterator.phpÃ��’àqZÃ��š+µÞ¶������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-��’àqZ-��ºÎÒ_¶������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÏ��’àqZÏ��ºªÇ¶������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��’àqZ �� ÿ¶������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpe��’àqZe��Ÿ’áé¶������3���vendor/symfony/finder/Iterator/SortableIterator.php*��’àqZ*��€õ´^¶���������vendor/symfony/finder/LICENSE)��’àqZ)��·)E`¶������'���vendor/symfony/finder/Shell/Command.php? ��’àqZ? ��šPw‰¶������%���vendor/symfony/finder/Shell/Shell.phpp��’àqZp��Ó}g¶������%���vendor/symfony/finder/SplFileInfo.phpý��’àqZý��`ØÓ¶������(���vendor/symfony/polyfill-mbstring/LICENSE)��’àqZ)��î*L¶������-���vendor/symfony/polyfill-mbstring/Mbstring.phpÄ6��’àqZÄ6��U.ݶ������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php2A��’àqZ2A��½=¨¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php¡A��’àqZ¡A��Ú Í¶������.���vendor/symfony/polyfill-mbstring/bootstrap.php±��’àqZ±��|Š©Ò¶������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���’àqZf���]ö>T¶������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���’àqZ¨���ÐÀ+_¶������3���vendor/symfony/process/Exception/LogicException.php”���’àqZ”��� ³ãñ¶������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��’àqZx��¨Ìzy¶������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��’àqZ��﫶������5���vendor/symfony/process/Exception/RuntimeException.php˜���’àqZ˜���¢Ø:¶������+���vendor/symfony/process/ExecutableFinder.php™��’àqZ™��|O¿é¶���������vendor/symfony/process/LICENSE)��’àqZ)��·)E`¶������.���vendor/symfony/process/PhpExecutableFinder.phpg��’àqZg���絶������%���vendor/symfony/process/PhpProcess.phpú��’àqZú��¯“Õ�¶������.���vendor/symfony/process/Pipes/AbstractPipes.php]��’àqZ]��g`¶������/���vendor/symfony/process/Pipes/PipesInterface.phpD��’àqZD��vØ������*���vendor/symfony/process/Pipes/UnixPipes.phpâ��’àqZâ��ßŶ������-���vendor/symfony/process/Pipes/WindowsPipes.php‰ ��’àqZ‰ ��À"¢¶������"���vendor/symfony/process/Process.php£R��’àqZ£R��‹„&E¶������)���vendor/symfony/process/ProcessBuilder.phpß
  55. ��’àqZß
  56. ��^ƒ8¶������'���vendor/symfony/process/ProcessUtils.phpK��’àqZK��µ½~ò¶���������vendor/seld/jsonlint/LICENSE"��’àqZ"��aƒsy¶������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��’àqZ*��•pñ¶������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php/2��’àqZ/2��­ß˜ö¶������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php��’àqZ��%ÿ3N¶������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��’àqZ��‰²ñ¶������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���’àqZ>���ÿqŸŸ¶���������vendor/seld/cli-prompt/LICENSE"��’àqZ"��ˆñ?e¶������&���vendor/seld/cli-prompt/res/example.php'��’àqZ'��I£¶������(���vendor/seld/cli-prompt/src/CliPrompt.phpC��’àqZC��Ð}�p¶������(���vendor/justinrainbow/json-schema/LICENSE ��’àqZ ��ºç©¶������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��’àqZñ��fC¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��’àqZ¡ ��†wÌl¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php) ��’àqZ) ��#©¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php ��’àqZ ��Òé`¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��’àqZ¼��ÿ Qœ¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��’àqZ]��VŽU<¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php; ��’àqZ; ��!/)¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…��’àqZ…��“TœÚ¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpš
  57. ��’àqZš
  58. ��z&¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃ��’àqZÃ��©Å¼x¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.phpN ��’àqZN ��QÓmV¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php��’àqZ��¥wš‡¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��’àqZa�� qö������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.phpp��’àqZp��rë¶������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��’àqZ‰��“µ+j¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��’àqZ&��4˜©T¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpr!��’àqZr!��‰Ö‘¶������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��’àqZè��{N–¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���’àqZI���%|°¶������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���’àqZ•���‹àG¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���’àqZl���A!L׶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���’àqZl���è2÷þ¶������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���’àqZu���=hç¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���’àqZw���N-ò[¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��’àqZÞ��\¸
  59. ¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���’àqZo���píÛù¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���’àqZ…���%…—¶������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���’àqZ€���u-#1¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���’àqZj���å>�¶������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���’àqZf���¬¤„þ¶������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��’àqZþ��M�„õ¶������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��’àqZ ��f4÷³¶������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ��’àqZœ ��åfO¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��’àqZ��oŠ+}¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���’àqZá���[þA�¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥��’àqZ¥��Ô§Lb¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%��’àqZ%��5" ¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��’àqZ,��1•5þ¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���’àqZ®���ÿ‹Áå¶������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��’àqZ ��£Ÿ)à¶������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php&��’àqZ&��¼î‚¢¶������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���’àqZƒ���J€¶������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���’àqZ…���íæe¶������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpÇ��’àqZÇ��ù…oÞ¶������%���vendor/composer/spdx-licenses/LICENSE��’àqZ��Bhí¶������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpH��’àqZH��͉T¶���������vendor/composer/semver/LICENSE��’àqZ��Bhí¶������)���vendor/composer/semver/src/Comparator.php��’àqZ��wlƒï¶������<���vendor/composer/semver/src/Constraint/AbstractConstraint.php×��’àqZ×��õî>Ž¶������4���vendor/composer/semver/src/Constraint/Constraint.phpª ��’àqZª ��ÇO7²¶������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���’àqZß���0C,‡¶������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpé��’àqZé��!-Ø™¶������9���vendor/composer/semver/src/Constraint/MultiConstraint.php1��’àqZ1��í xU¶������%���vendor/composer/semver/src/Semver.phpv��’àqZv��‹×È›¶������,���vendor/composer/semver/src/VersionParser.php¿*��’àqZ¿*��)mƶ������!���vendor/composer/ca-bundle/LICENSE��’àqZ��*!^`¶������*���vendor/composer/ca-bundle/src/CaBundle.php��’àqZ��Ê ~Ķ���������vendor/psr/log/LICENSE=��’àqZ=��p±ŽO¶������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��’àqZ;��ñ>3[¶������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���’àqZ`��� ˆX1¶������#���vendor/psr/log/Psr/Log/LogLevel.phpû���’àqZû���jðñ8¶������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���’àqZ|���$£ˆ¶������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���’àqZ§���T½úB¶������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÆ��’àqZÆ��»sg¶������&���vendor/psr/log/Psr/Log/LoggerTrait.phpi��’àqZi��35§Þ¶������%���vendor/psr/log/Psr/Log/NullLogger.phpž���’àqZž���Çö������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpü ��’àqZü ��iq0ض���������vendor/autoload.php‚���’àqZ‚���£û}ä¶������'���vendor/composer/autoload_namespaces.phpd���’àqZd���Z¡¦H¶������!���vendor/composer/autoload_psr4.php˜��’àqZ˜��ž{¢¶������%���vendor/composer/autoload_classmap.phpd���’àqZd���Z¡¦H¶������"���vendor/composer/autoload_files.phpÃ���’àqZÃ���ÒÂür¶������!���vendor/composer/autoload_real.phpI��’àqZI��çÝP¶������#���vendor/composer/autoload_static.php¬ ��’àqZ¬ ��bU“è¶���������vendor/composer/ClassLoader.php���’àqZ���‚Aãd¶������(���vendor/composer/ca-bundle/res/cacert.pemš�’àqZš�Û¾§¶������ ���bin/composer ��’àqZ ��О=¶���������LICENSE.��’àqZ.�� Õ¶������<?php
  60. namespace Composer\Autoload;
  61. use Composer\Config;
  62. use Composer\EventDispatcher\EventDispatcher;
  63. use Composer\Installer\InstallationManager;
  64. use Composer\IO\IOInterface;
  65. use Composer\Package\AliasPackage;
  66. use Composer\Package\PackageInterface;
  67. use Composer\Repository\InstalledRepositoryInterface;
  68. use Composer\Util\Filesystem;
  69. use Composer\Script\ScriptEvents;
  70. class AutoloadGenerator
  71. {
  72. private $eventDispatcher;
  73. private $io;
  74. private $devMode = false;
  75. private $classMapAuthoritative = false;
  76. private $apcu = false;
  77. private $runScripts = false;
  78. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  79. {
  80. $this->eventDispatcher = $eventDispatcher;
  81. $this->io = $io;
  82. }
  83. public function setDevMode($devMode = true)
  84. {
  85. $this->devMode = (bool) $devMode;
  86. }
  87. public function setClassMapAuthoritative($classMapAuthoritative)
  88. {
  89. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  90. }
  91. public function setApcu($apcu)
  92. {
  93. $this->apcu = (bool) $apcu;
  94. }
  95. public function setRunScripts($runScripts = true)
  96. {
  97. $this->runScripts = (bool) $runScripts;
  98. }
  99. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  100. {
  101. if ($this->classMapAuthoritative) {
  102. $scanPsr0Packages = true;
  103. }
  104. if ($this->runScripts) {
  105. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  106. 'optimize' => (bool) $scanPsr0Packages,
  107. ));
  108. }
  109. $filesystem = new Filesystem();
  110. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  111. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  112. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  113. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  114. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  115. $targetDir = $vendorPath.'/'.$targetDir;
  116. $filesystem->ensureDirectoryExists($targetDir);
  117. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  118. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  119. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  120. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  121. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  122. $namespacesFile = <<<EOF
  123. <?php
  124. // autoload_namespaces.php @generated by Composer
  125. \$vendorDir = $vendorPathCode52;
  126. \$baseDir = $appBaseDirCode;
  127. return array(
  128. EOF;
  129. $psr4File = <<<EOF
  130. <?php
  131. // autoload_psr4.php @generated by Composer
  132. \$vendorDir = $vendorPathCode52;
  133. \$baseDir = $appBaseDirCode;
  134. return array(
  135. EOF;
  136. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  137. $autoloads = $this->parseAutoloads($packageMap, $mainPackage);
  138. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  139. $exportedPaths = array();
  140. foreach ($paths as $path) {
  141. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  142. }
  143. $exportedPrefix = var_export($namespace, true);
  144. $namespacesFile .= " $exportedPrefix => ";
  145. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  146. }
  147. $namespacesFile .= ");\n";
  148. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  149. $exportedPaths = array();
  150. foreach ($paths as $path) {
  151. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  152. }
  153. $exportedPrefix = var_export($namespace, true);
  154. $psr4File .= " $exportedPrefix => ";
  155. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  156. }
  157. $psr4File .= ");\n";
  158. $classmapFile = <<<EOF
  159. <?php
  160. // autoload_classmap.php @generated by Composer
  161. \$vendorDir = $vendorPathCode52;
  162. \$baseDir = $appBaseDirCode;
  163. return array(
  164. EOF;
  165. $targetDirLoader = null;
  166. $mainAutoload = $mainPackage->getAutoload();
  167. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  168. $levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
  169. $prefixes = implode(', ', array_map(function ($prefix) {
  170. return var_export($prefix, true);
  171. }, array_keys($mainAutoload['psr-0'])));
  172. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  173. $targetDirLoader = <<<EOF
  174. public static function autoload(\$class)
  175. {
  176. \$dir = $baseDirFromTargetDirCode . '/';
  177. \$prefixes = array($prefixes);
  178. foreach (\$prefixes as \$prefix) {
  179. if (0 !== strpos(\$class, \$prefix)) {
  180. continue;
  181. }
  182. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  183. if (!\$path = stream_resolve_include_path(\$path)) {
  184. return false;
  185. }
  186. require \$path;
  187. return true;
  188. }
  189. }
  190. EOF;
  191. }
  192. $blacklist = null;
  193. if (!empty($autoloads['exclude-from-classmap'])) {
  194. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  195. }
  196. $classMap = array();
  197. if ($scanPsr0Packages) {
  198. $namespacesToScan = array();
  199. foreach (array('psr-0', 'psr-4') as $psrType) {
  200. foreach ($autoloads[$psrType] as $namespace => $paths) {
  201. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  202. }
  203. }
  204. krsort($namespacesToScan);
  205. foreach ($namespacesToScan as $namespace => $groups) {
  206. foreach ($groups as $group) {
  207. foreach ($group['paths'] as $dir) {
  208. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  209. if (!is_dir($dir)) {
  210. continue;
  211. }
  212. $namespaceFilter = $namespace === '' ? null : $namespace;
  213. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  214. }
  215. }
  216. }
  217. }
  218. foreach ($autoloads['classmap'] as $dir) {
  219. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  220. }
  221. ksort($classMap);
  222. foreach ($classMap as $class => $code) {
  223. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  224. }
  225. $classmapFile .= ");\n";
  226. if (!$suffix) {
  227. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  228. $content = file_get_contents($vendorPath.'/autoload.php');
  229. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  230. $suffix = $match[1];
  231. }
  232. }
  233. if (!$suffix) {
  234. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  235. }
  236. }
  237. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  238. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  239. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  240. $includePathFilePath = $targetDir.'/include_paths.php';
  241. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  242. file_put_contents($includePathFilePath, $includePathFileContents);
  243. } elseif (file_exists($includePathFilePath)) {
  244. unlink($includePathFilePath);
  245. }
  246. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  247. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  248. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  249. } elseif (file_exists($includeFilesFilePath)) {
  250. unlink($includeFilesFilePath);
  251. }
  252. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  253. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  254. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  255. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  256. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  257. if ($this->runScripts) {
  258. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  259. 'optimize' => (bool) $scanPsr0Packages,
  260. ));
  261. }
  262. }
  263. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
  264. {
  265. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
  266. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  267. if (!isset($classMap[$class])) {
  268. $classMap[$class] = $pathCode;
  269. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  270. $this->io->writeError(
  271. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  272. ' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
  273. );
  274. }
  275. }
  276. return $classMap;
  277. }
  278. private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
  279. {
  280. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
  281. }
  282. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  283. {
  284. $packageMap = array(array($mainPackage, ''));
  285. foreach ($packages as $package) {
  286. if ($package instanceof AliasPackage) {
  287. continue;
  288. }
  289. $this->validatePackage($package);
  290. $packageMap[] = array(
  291. $package,
  292. $installationManager->getInstallPath($package),
  293. );
  294. }
  295. return $packageMap;
  296. }
  297. protected function validatePackage(PackageInterface $package)
  298. {
  299. $autoload = $package->getAutoload();
  300. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  301. $name = $package->getName();
  302. $package->getTargetDir();
  303. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  304. }
  305. if (!empty($autoload['psr-4'])) {
  306. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  307. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  308. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  309. }
  310. }
  311. }
  312. }
  313. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage)
  314. {
  315. $mainPackageMap = array_shift($packageMap);
  316. $sortedPackageMap = $this->sortPackageMap($packageMap);
  317. $sortedPackageMap[] = $mainPackageMap;
  318. array_unshift($packageMap, $mainPackageMap);
  319. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  320. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  321. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  322. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  323. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  324. krsort($psr0);
  325. krsort($psr4);
  326. return array(
  327. 'psr-0' => $psr0,
  328. 'psr-4' => $psr4,
  329. 'classmap' => $classmap,
  330. 'files' => $files,
  331. 'exclude-from-classmap' => $exclude,
  332. );
  333. }
  334. public function createLoader(array $autoloads)
  335. {
  336. $loader = new ClassLoader();
  337. if (isset($autoloads['psr-0'])) {
  338. foreach ($autoloads['psr-0'] as $namespace => $path) {
  339. $loader->add($namespace, $path);
  340. }
  341. }
  342. if (isset($autoloads['psr-4'])) {
  343. foreach ($autoloads['psr-4'] as $namespace => $path) {
  344. $loader->addPsr4($namespace, $path);
  345. }
  346. }
  347. if (isset($autoloads['classmap'])) {
  348. $blacklist = null;
  349. if (!empty($autoloads['exclude-from-classmap'])) {
  350. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  351. }
  352. foreach ($autoloads['classmap'] as $dir) {
  353. try {
  354. $loader->addClassMap($this->generateClassMap($dir, $blacklist, null, false));
  355. } catch (\RuntimeException $e) {
  356. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  357. }
  358. }
  359. }
  360. return $loader;
  361. }
  362. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  363. {
  364. $includePaths = array();
  365. foreach ($packageMap as $item) {
  366. list($package, $installPath) = $item;
  367. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  368. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  369. }
  370. foreach ($package->getIncludePaths() as $includePath) {
  371. $includePath = trim($includePath, '/');
  372. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  373. }
  374. }
  375. if (!$includePaths) {
  376. return;
  377. }
  378. $includePathsCode = '';
  379. foreach ($includePaths as $path) {
  380. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  381. }
  382. return <<<EOF
  383. <?php
  384. // include_paths.php @generated by Composer
  385. \$vendorDir = $vendorPathCode;
  386. \$baseDir = $appBaseDirCode;
  387. return array(
  388. $includePathsCode);
  389. EOF;
  390. }
  391. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  392. {
  393. $filesCode = '';
  394. foreach ($files as $fileIdentifier => $functionFile) {
  395. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  396. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  397. }
  398. if (!$filesCode) {
  399. return false;
  400. }
  401. return <<<EOF
  402. <?php
  403. // autoload_files.php @generated by Composer
  404. \$vendorDir = $vendorPathCode;
  405. \$baseDir = $appBaseDirCode;
  406. return array(
  407. $filesCode);
  408. EOF;
  409. }
  410. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  411. {
  412. if (!$filesystem->isAbsolutePath($path)) {
  413. $path = $basePath . '/' . $path;
  414. }
  415. $path = $filesystem->normalizePath($path);
  416. $baseDir = '';
  417. if (strpos($path.'/', $vendorPath.'/') === 0) {
  418. $path = substr($path, strlen($vendorPath));
  419. $baseDir = '$vendorDir';
  420. if ($path !== false) {
  421. $baseDir .= " . ";
  422. }
  423. } else {
  424. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  425. if (!$filesystem->isAbsolutePath($path)) {
  426. $baseDir = '$baseDir . ';
  427. $path = '/' . $path;
  428. }
  429. }
  430. if (preg_match('/\.phar.+$/', $path)) {
  431. $baseDir = "'phar://' . " . $baseDir;
  432. }
  433. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  434. }
  435. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  436. {
  437. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  438. if ("'" === $lastChar || '"' === $lastChar) {
  439. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  440. } else {
  441. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  442. }
  443. return <<<AUTOLOAD
  444. <?php
  445. // autoload.php @generated by Composer
  446. require_once $vendorPathToTargetDirCode;
  447. return ComposerAutoloaderInit$suffix::getLoader();
  448. AUTOLOAD;
  449. }
  450. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  451. {
  452. $file = <<<HEADER
  453. <?php
  454. // autoload_real.php @generated by Composer
  455. class ComposerAutoloaderInit$suffix
  456. {
  457. private static \$loader;
  458. public static function loadClassLoader(\$class)
  459. {
  460. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  461. require __DIR__ . '/ClassLoader.php';
  462. }
  463. }
  464. public static function getLoader()
  465. {
  466. if (null !== self::\$loader) {
  467. return self::\$loader;
  468. }
  469. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  470. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  471. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  472. HEADER;
  473. if ($useIncludePath) {
  474. $file .= <<<'INCLUDE_PATH'
  475. $includePaths = require __DIR__ . '/include_paths.php';
  476. $includePaths[] = get_include_path();
  477. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  478. INCLUDE_PATH;
  479. }
  480. $file .= <<<STATIC_INIT
  481. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  482. if (\$useStaticLoader) {
  483. require_once __DIR__ . '/autoload_static.php';
  484. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  485. } else {
  486. STATIC_INIT;
  487. if (!$this->classMapAuthoritative) {
  488. $file .= <<<'PSR04'
  489. $map = require __DIR__ . '/autoload_namespaces.php';
  490. foreach ($map as $namespace => $path) {
  491. $loader->set($namespace, $path);
  492. }
  493. $map = require __DIR__ . '/autoload_psr4.php';
  494. foreach ($map as $namespace => $path) {
  495. $loader->setPsr4($namespace, $path);
  496. }
  497. PSR04;
  498. }
  499. if ($useClassMap) {
  500. $file .= <<<'CLASSMAP'
  501. $classMap = require __DIR__ . '/autoload_classmap.php';
  502. if ($classMap) {
  503. $loader->addClassMap($classMap);
  504. }
  505. CLASSMAP;
  506. }
  507. $file .= " }\n\n";
  508. if ($this->classMapAuthoritative) {
  509. $file .= <<<'CLASSMAPAUTHORITATIVE'
  510. $loader->setClassMapAuthoritative(true);
  511. CLASSMAPAUTHORITATIVE;
  512. }
  513. if ($this->apcu) {
  514. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  515. $file .= <<<APCU
  516. \$loader->setApcuPrefix('$apcuPrefix');
  517. APCU;
  518. }
  519. if ($useGlobalIncludePath) {
  520. $file .= <<<'INCLUDEPATH'
  521. $loader->setUseIncludePath(true);
  522. INCLUDEPATH;
  523. }
  524. if ($targetDirLoader) {
  525. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  526. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  527. REGISTER_TARGET_DIR_AUTOLOAD;
  528. }
  529. $file .= <<<REGISTER_LOADER
  530. \$loader->register($prependAutoloader);
  531. REGISTER_LOADER;
  532. if ($useIncludeFiles) {
  533. $file .= <<<INCLUDE_FILES
  534. if (\$useStaticLoader) {
  535. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  536. } else {
  537. \$includeFiles = require __DIR__ . '/autoload_files.php';
  538. }
  539. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  540. composerRequire$suffix(\$fileIdentifier, \$file);
  541. }
  542. INCLUDE_FILES;
  543. }
  544. $file .= <<<METHOD_FOOTER
  545. return \$loader;
  546. }
  547. METHOD_FOOTER;
  548. $file .= $targetDirLoader;
  549. if ($useIncludeFiles) {
  550. return $file . <<<FOOTER
  551. }
  552. function composerRequire$suffix(\$fileIdentifier, \$file)
  553. {
  554. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  555. require \$file;
  556. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  557. }
  558. }
  559. FOOTER;
  560. }
  561. return $file . <<<FOOTER
  562. }
  563. FOOTER;
  564. }
  565. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  566. {
  567. $staticPhpVersion = 50600;
  568. $file = <<<HEADER
  569. <?php
  570. // autoload_static.php @generated by Composer
  571. namespace Composer\Autoload;
  572. class ComposerStaticInit$suffix
  573. {
  574. HEADER;
  575. $loader = new ClassLoader();
  576. $map = require $targetDir . '/autoload_namespaces.php';
  577. foreach ($map as $namespace => $path) {
  578. $loader->set($namespace, $path);
  579. }
  580. $map = require $targetDir . '/autoload_psr4.php';
  581. foreach ($map as $namespace => $path) {
  582. $loader->setPsr4($namespace, $path);
  583. }
  584. $classMap = require $targetDir . '/autoload_classmap.php';
  585. if ($classMap) {
  586. $loader->addClassMap($classMap);
  587. }
  588. $filesystem = new Filesystem();
  589. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  590. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  591. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  592. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  593. $initializer = '';
  594. $prefix = "\0Composer\Autoload\ClassLoader\0";
  595. $prefixLen = strlen($prefix);
  596. if (file_exists($targetDir . '/autoload_files.php')) {
  597. $maps = array('files' => require $targetDir . '/autoload_files.php');
  598. } else {
  599. $maps = array();
  600. }
  601. foreach ((array) $loader as $prop => $value) {
  602. if ($value && 0 === strpos($prop, $prefix)) {
  603. $maps[substr($prop, $prefixLen)] = $value;
  604. }
  605. }
  606. foreach ($maps as $prop => $value) {
  607. if (count($value) > 32767) {
  608. $staticPhpVersion = 70000;
  609. }
  610. $value = var_export($value, true);
  611. $value = str_replace($absoluteVendorPathCode, $vendorPathCode, $value);
  612. $value = str_replace($absoluteAppBaseDirCode, $appBaseDirCode, $value);
  613. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  614. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  615. if ('files' !== $prop) {
  616. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  617. }
  618. }
  619. return $file . <<<INITIALIZER
  620. public static function getInitializer(ClassLoader \$loader)
  621. {
  622. return \Closure::bind(function () use (\$loader) {
  623. $initializer
  624. }, null, ClassLoader::class);
  625. }
  626. }
  627. INITIALIZER;
  628. }
  629. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  630. {
  631. $autoloads = array();
  632. foreach ($packageMap as $item) {
  633. list($package, $installPath) = $item;
  634. $autoload = $package->getAutoload();
  635. if ($this->devMode && $package === $mainPackage) {
  636. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  637. }
  638. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  639. continue;
  640. }
  641. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  642. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  643. }
  644. foreach ($autoload[$type] as $namespace => $paths) {
  645. foreach ((array) $paths as $path) {
  646. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  647. if ($package === $mainPackage) {
  648. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  649. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  650. } else {
  651. $path = $package->getTargetDir() . '/' . $path;
  652. }
  653. }
  654. if ($type === 'exclude-from-classmap') {
  655. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  656. $path = str_replace('\\*\\*', '.+?', $path);
  657. $path = str_replace('\\*', '[^/]+?', $path);
  658. $updir = null;
  659. $path = preg_replace_callback(
  660. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  661. function ($matches) use (&$updir) {
  662. if (isset($matches[1])) {
  663. $updir = str_replace('\\.', '.', $matches[1]);
  664. }
  665. return '';
  666. },
  667. $path
  668. );
  669. if (empty($installPath)) {
  670. $installPath = strtr(getcwd(), '\\', '/');
  671. }
  672. $resolvedPath = realpath($installPath . '/' . $updir);
  673. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  674. continue;
  675. }
  676. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  677. if ($type === 'files') {
  678. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  679. continue;
  680. } elseif ($type === 'classmap') {
  681. $autoloads[] = $relativePath;
  682. continue;
  683. }
  684. $autoloads[$namespace][] = $relativePath;
  685. }
  686. }
  687. }
  688. return $autoloads;
  689. }
  690. protected function getFileIdentifier(PackageInterface $package, $path)
  691. {
  692. return md5($package->getName() . ':' . $path);
  693. }
  694. protected function sortPackageMap(array $packageMap)
  695. {
  696. $packages = array();
  697. $paths = array();
  698. $usageList = array();
  699. foreach ($packageMap as $item) {
  700. list($package, $path) = $item;
  701. $name = $package->getName();
  702. $packages[$name] = $package;
  703. $paths[$name] = $path;
  704. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  705. $target = $link->getTarget();
  706. $usageList[$target][] = $name;
  707. }
  708. }
  709. $computing = array();
  710. $computed = array();
  711. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  712. if (isset($computed[$name])) {
  713. return $computed[$name];
  714. }
  715. if (isset($computing[$name])) {
  716. return 0;
  717. }
  718. $computing[$name] = true;
  719. $weight = 0;
  720. if (isset($usageList[$name])) {
  721. foreach ($usageList[$name] as $user) {
  722. $weight -= 1 - $computeImportance($user);
  723. }
  724. }
  725. unset($computing[$name]);
  726. $computed[$name] = $weight;
  727. return $weight;
  728. };
  729. $weightList = array();
  730. foreach ($packages as $name => $package) {
  731. $weight = $computeImportance($name);
  732. $weightList[$name] = $weight;
  733. }
  734. $stable_sort = function (&$array) {
  735. static $transform, $restore;
  736. $i = 0;
  737. if (!$transform) {
  738. $transform = function (&$v, $k) use (&$i) {
  739. $v = array($v, ++$i, $k, $v);
  740. };
  741. $restore = function (&$v, $k) {
  742. $v = $v[3];
  743. };
  744. }
  745. array_walk($array, $transform);
  746. asort($array);
  747. array_walk($array, $restore);
  748. };
  749. $stable_sort($weightList);
  750. $sortedPackageMap = array();
  751. foreach (array_keys($weightList) as $name) {
  752. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  753. }
  754. return $sortedPackageMap;
  755. }
  756. protected function safeCopy($source, $target)
  757. {
  758. $source = fopen($source, 'r');
  759. $target = fopen($target, 'w+');
  760. stream_copy_to_stream($source, $target);
  761. fclose($source);
  762. fclose($target);
  763. }
  764. }
  765. <?php
  766. namespace Composer\Autoload;
  767. use Symfony\Component\Finder\Finder;
  768. use Composer\IO\IOInterface;
  769. use Composer\Util\Filesystem;
  770. class ClassMapGenerator
  771. {
  772. public static function dump($dirs, $file)
  773. {
  774. $maps = array();
  775. foreach ($dirs as $dir) {
  776. $maps = array_merge($maps, static::createMap($dir));
  777. }
  778. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  779. }
  780. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  781. {
  782. if (is_string($path)) {
  783. if (is_file($path)) {
  784. $path = array(new \SplFileInfo($path));
  785. } elseif (is_dir($path)) {
  786. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  787. } else {
  788. throw new \RuntimeException(
  789. 'Could not scan for classes inside "'.$path.
  790. '" which does not appear to be a file nor a folder'
  791. );
  792. }
  793. }
  794. $map = array();
  795. $filesystem = new Filesystem();
  796. $cwd = realpath(getcwd());
  797. foreach ($path as $file) {
  798. $filePath = $file->getPathname();
  799. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  800. continue;
  801. }
  802. if (!$filesystem->isAbsolutePath($filePath)) {
  803. $filePath = $cwd . '/' . $filePath;
  804. $filePath = $filesystem->normalizePath($filePath);
  805. } else {
  806. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  807. }
  808. if ($blacklist && preg_match($blacklist, strtr(realpath($filePath), '\\', '/'))) {
  809. continue;
  810. }
  811. $classes = self::findClasses($filePath);
  812. foreach ($classes as $class) {
  813. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  814. continue;
  815. }
  816. if (!isset($map[$class])) {
  817. $map[$class] = $filePath;
  818. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  819. $io->writeError(
  820. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  821. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  822. );
  823. }
  824. }
  825. }
  826. return $map;
  827. }
  828. private static function findClasses($path)
  829. {
  830. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  831. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  832. $extraTypes .= '|enum';
  833. }
  834. $contents = @php_strip_whitespace($path);
  835. if (!$contents) {
  836. if (!file_exists($path)) {
  837. $message = 'File at "%s" does not exist, check your classmap definitions';
  838. } elseif (!is_readable($path)) {
  839. $message = 'File at "%s" is not readable, check its permissions';
  840. } elseif ('' === trim(file_get_contents($path))) {
  841. return array();
  842. } else {
  843. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  844. }
  845. $error = error_get_last();
  846. if (isset($error['message'])) {
  847. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  848. }
  849. throw new \RuntimeException(sprintf($message, $path));
  850. }
  851. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  852. return array();
  853. }
  854. $contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
  855. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  856. if (substr($contents, 0, 2) !== '<?') {
  857. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  858. if ($replacements === 0) {
  859. return array();
  860. }
  861. }
  862. $contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
  863. $pos = strrpos($contents, '?>');
  864. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  865. $contents = substr($contents, 0, $pos);
  866. }
  867. preg_match_all('{
  868. (?:
  869. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  870. | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
  871. )
  872. }ix', $contents, $matches);
  873. $classes = array();
  874. $namespace = '';
  875. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  876. if (!empty($matches['ns'][$i])) {
  877. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  878. } else {
  879. $name = $matches['name'][$i];
  880. if ($name === 'extends' || $name === 'implements') {
  881. continue;
  882. }
  883. if ($name[0] === ':') {
  884. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  885. } elseif ($matches['type'][$i] === 'enum') {
  886. $name = rtrim($name, ':');
  887. }
  888. $classes[] = ltrim($namespace . $name, '\\');
  889. }
  890. }
  891. return $classes;
  892. }
  893. }
  894. <?php
  895. namespace Composer;
  896. use Composer\IO\IOInterface;
  897. use Composer\Util\Filesystem;
  898. use Composer\Util\Silencer;
  899. use Symfony\Component\Finder\Finder;
  900. class Cache
  901. {
  902. private static $cacheCollected = false;
  903. private $io;
  904. private $root;
  905. private $enabled = true;
  906. private $whitelist;
  907. private $filesystem;
  908. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  909. {
  910. $this->io = $io;
  911. $this->root = rtrim($cacheDir, '/\\') . '/';
  912. $this->whitelist = $whitelist;
  913. $this->filesystem = $filesystem ?: new Filesystem();
  914. if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
  915. $this->enabled = false;
  916. return;
  917. }
  918. if (
  919. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  920. || !is_writable($this->root)
  921. ) {
  922. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  923. $this->enabled = false;
  924. }
  925. }
  926. public function isEnabled()
  927. {
  928. return $this->enabled;
  929. }
  930. public function getRoot()
  931. {
  932. return $this->root;
  933. }
  934. public function read($file)
  935. {
  936. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  937. if ($this->enabled && file_exists($this->root . $file)) {
  938. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  939. return file_get_contents($this->root . $file);
  940. }
  941. return false;
  942. }
  943. public function write($file, $contents)
  944. {
  945. if ($this->enabled) {
  946. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  947. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  948. try {
  949. return file_put_contents($this->root . $file, $contents);
  950. } catch (\ErrorException $e) {
  951. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  952. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  953. unlink($this->root . $file);
  954. $message = sprintf(
  955. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  956. $this->root . $file,
  957. $m[1],
  958. $m[2],
  959. @disk_free_space($this->root . dirname($file))
  960. );
  961. $this->io->writeError($message);
  962. return false;
  963. }
  964. throw $e;
  965. }
  966. }
  967. return false;
  968. }
  969. public function copyFrom($file, $source)
  970. {
  971. if ($this->enabled) {
  972. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  973. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  974. if (!file_exists($source)) {
  975. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  976. } elseif ($this->io->isDebug()) {
  977. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  978. }
  979. return copy($source, $this->root . $file);
  980. }
  981. return false;
  982. }
  983. public function copyTo($file, $target)
  984. {
  985. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  986. if ($this->enabled && file_exists($this->root . $file)) {
  987. try {
  988. touch($this->root . $file, filemtime($this->root . $file), time());
  989. } catch (\ErrorException $e) {
  990. Silencer::call('touch', $this->root . $file);
  991. }
  992. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  993. return copy($this->root . $file, $target);
  994. }
  995. return false;
  996. }
  997. public function gcIsNecessary()
  998. {
  999. return (!self::$cacheCollected && !mt_rand(0, 50));
  1000. }
  1001. public function remove($file)
  1002. {
  1003. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1004. if ($this->enabled && file_exists($this->root . $file)) {
  1005. return $this->filesystem->unlink($this->root . $file);
  1006. }
  1007. return false;
  1008. }
  1009. public function clear()
  1010. {
  1011. if ($this->enabled) {
  1012. return $this->filesystem->removeDirectory($this->root);
  1013. }
  1014. return false;
  1015. }
  1016. public function gc($ttl, $maxSize)
  1017. {
  1018. if ($this->enabled) {
  1019. $expire = new \DateTime();
  1020. $expire->modify('-'.$ttl.' seconds');
  1021. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1022. foreach ($finder as $file) {
  1023. $this->filesystem->unlink($file->getPathname());
  1024. }
  1025. $totalSize = $this->filesystem->size($this->root);
  1026. if ($totalSize > $maxSize) {
  1027. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1028. while ($totalSize > $maxSize && $iterator->valid()) {
  1029. $filepath = $iterator->current()->getPathname();
  1030. $totalSize -= $this->filesystem->size($filepath);
  1031. $this->filesystem->unlink($filepath);
  1032. $iterator->next();
  1033. }
  1034. }
  1035. self::$cacheCollected = true;
  1036. return true;
  1037. }
  1038. return false;
  1039. }
  1040. public function sha1($file)
  1041. {
  1042. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1043. if ($this->enabled && file_exists($this->root . $file)) {
  1044. return sha1_file($this->root . $file);
  1045. }
  1046. return false;
  1047. }
  1048. public function sha256($file)
  1049. {
  1050. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1051. if ($this->enabled && file_exists($this->root . $file)) {
  1052. return hash_file('sha256', $this->root . $file);
  1053. }
  1054. return false;
  1055. }
  1056. protected function getFinder()
  1057. {
  1058. return Finder::create()->in($this->root)->files();
  1059. }
  1060. }
  1061. <?php
  1062. namespace Composer\Command;
  1063. use Symfony\Component\Console\Input\InputInterface;
  1064. use Symfony\Component\Console\Output\OutputInterface;
  1065. class AboutCommand extends BaseCommand
  1066. {
  1067. protected function configure()
  1068. {
  1069. $this
  1070. ->setName('about')
  1071. ->setDescription('Shows the short information about Composer.')
  1072. ->setHelp(<<<EOT
  1073. <info>php composer.phar about</info>
  1074. EOT
  1075. )
  1076. ;
  1077. }
  1078. protected function execute(InputInterface $input, OutputInterface $output)
  1079. {
  1080. $this->getIO()->write(<<<EOT
  1081. <info>Composer - Package Management for PHP</info>
  1082. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1083. See https://getcomposer.org/ for more information.</comment>
  1084. EOT
  1085. );
  1086. }
  1087. }
  1088. <?php
  1089. namespace Composer\Command;
  1090. use Composer\Factory;
  1091. use Composer\IO\IOInterface;
  1092. use Composer\Config;
  1093. use Composer\Composer;
  1094. use Composer\Repository\CompositeRepository;
  1095. use Composer\Repository\RepositoryFactory;
  1096. use Composer\Script\ScriptEvents;
  1097. use Composer\Plugin\CommandEvent;
  1098. use Composer\Plugin\PluginEvents;
  1099. use Composer\Util\Filesystem;
  1100. use Symfony\Component\Console\Input\InputArgument;
  1101. use Symfony\Component\Console\Input\InputInterface;
  1102. use Symfony\Component\Console\Input\InputOption;
  1103. use Symfony\Component\Console\Output\OutputInterface;
  1104. class ArchiveCommand extends BaseCommand
  1105. {
  1106. protected function configure()
  1107. {
  1108. $this
  1109. ->setName('archive')
  1110. ->setDescription('Creates an archive of this composer package.')
  1111. ->setDefinition(array(
  1112. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1113. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1114. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1115. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1116. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1117. .' Note that the format will be appended.'),
  1118. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1119. ))
  1120. ->setHelp(<<<EOT
  1121. The <info>archive</info> command creates an archive of the specified format
  1122. containing the files and directories of the Composer project or the specified
  1123. package in the specified version and writes it to the specified directory.
  1124. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1125. EOT
  1126. )
  1127. ;
  1128. }
  1129. protected function execute(InputInterface $input, OutputInterface $output)
  1130. {
  1131. $config = Factory::createConfig();
  1132. $composer = $this->getComposer(false);
  1133. if ($composer) {
  1134. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1135. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1136. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1137. }
  1138. if (null === $input->getOption('format')) {
  1139. $input->setOption('format', $config->get('archive-format'));
  1140. }
  1141. if (null === $input->getOption('dir')) {
  1142. $input->setOption('dir', $config->get('archive-dir'));
  1143. }
  1144. $returnCode = $this->archive(
  1145. $this->getIO(),
  1146. $config,
  1147. $input->getArgument('package'),
  1148. $input->getArgument('version'),
  1149. $input->getOption('format'),
  1150. $input->getOption('dir'),
  1151. $input->getOption('file'),
  1152. $input->getOption('ignore-filters'),
  1153. $composer
  1154. );
  1155. if (0 === $returnCode && $composer) {
  1156. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1157. }
  1158. return $returnCode;
  1159. }
  1160. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1161. {
  1162. if ($composer) {
  1163. $archiveManager = $composer->getArchiveManager();
  1164. } else {
  1165. $factory = new Factory;
  1166. $downloadManager = $factory->createDownloadManager($io, $config);
  1167. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1168. }
  1169. if ($packageName) {
  1170. $package = $this->selectPackage($io, $packageName, $version);
  1171. if (!$package) {
  1172. return 1;
  1173. }
  1174. } else {
  1175. $package = $this->getComposer()->getPackage();
  1176. }
  1177. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1178. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1179. $fs = new Filesystem;
  1180. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1181. $io->writeError('Created: ', false);
  1182. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1183. return 0;
  1184. }
  1185. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1186. {
  1187. $io->writeError('<info>Searching for the specified package.</info>');
  1188. if ($composer = $this->getComposer(false)) {
  1189. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1190. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1191. } else {
  1192. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1193. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1194. $repo = new CompositeRepository($defaultRepos);
  1195. }
  1196. $packages = $repo->findPackages($packageName, $version);
  1197. if (count($packages) > 1) {
  1198. $package = reset($packages);
  1199. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1200. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1201. return $p->getPrettyString();
  1202. }, $packages)).'.');
  1203. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1204. } elseif ($packages) {
  1205. $package = reset($packages);
  1206. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1207. } else {
  1208. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1209. return false;
  1210. }
  1211. return $package;
  1212. }
  1213. }
  1214. <?php
  1215. namespace Composer\Command;
  1216. use Composer\Composer;
  1217. use Composer\Config;
  1218. use Composer\Console\Application;
  1219. use Composer\IO\IOInterface;
  1220. use Composer\IO\NullIO;
  1221. use Symfony\Component\Console\Input\InputInterface;
  1222. use Symfony\Component\Console\Output\OutputInterface;
  1223. use Symfony\Component\Console\Command\Command;
  1224. abstract class BaseCommand extends Command
  1225. {
  1226. private $composer;
  1227. private $io;
  1228. public function getComposer($required = true, $disablePlugins = null)
  1229. {
  1230. if (null === $this->composer) {
  1231. $application = $this->getApplication();
  1232. if ($application instanceof Application) {
  1233. $this->composer = $application->getComposer($required, $disablePlugins);
  1234. } elseif ($required) {
  1235. throw new \RuntimeException(
  1236. 'Could not create a Composer\Composer instance, you must inject '.
  1237. 'one if this command is not used with a Composer\Console\Application instance'
  1238. );
  1239. }
  1240. }
  1241. return $this->composer;
  1242. }
  1243. public function setComposer(Composer $composer)
  1244. {
  1245. $this->composer = $composer;
  1246. }
  1247. public function resetComposer()
  1248. {
  1249. $this->composer = null;
  1250. $this->getApplication()->resetComposer();
  1251. }
  1252. public function isProxyCommand()
  1253. {
  1254. return false;
  1255. }
  1256. public function getIO()
  1257. {
  1258. if (null === $this->io) {
  1259. $application = $this->getApplication();
  1260. if ($application instanceof Application) {
  1261. $this->io = $application->getIO();
  1262. } else {
  1263. $this->io = new NullIO();
  1264. }
  1265. }
  1266. return $this->io;
  1267. }
  1268. public function setIO(IOInterface $io)
  1269. {
  1270. $this->io = $io;
  1271. }
  1272. protected function initialize(InputInterface $input, OutputInterface $output)
  1273. {
  1274. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1275. $input->setOption('no-progress', true);
  1276. }
  1277. parent::initialize($input, $output);
  1278. }
  1279. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1280. {
  1281. $preferSource = false;
  1282. $preferDist = false;
  1283. switch ($config->get('preferred-install')) {
  1284. case 'source':
  1285. $preferSource = true;
  1286. break;
  1287. case 'dist':
  1288. $preferDist = true;
  1289. break;
  1290. case 'auto':
  1291. default:
  1292. break;
  1293. }
  1294. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1295. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1296. $preferDist = $input->getOption('prefer-dist');
  1297. }
  1298. return array($preferSource, $preferDist);
  1299. }
  1300. }
  1301. <?php
  1302. namespace Composer\Command;
  1303. use Composer\DependencyResolver\Pool;
  1304. use Composer\Package\Link;
  1305. use Composer\Package\PackageInterface;
  1306. use Composer\Repository\ArrayRepository;
  1307. use Composer\Repository\CompositeRepository;
  1308. use Composer\Repository\PlatformRepository;
  1309. use Composer\Repository\RepositoryFactory;
  1310. use Composer\Plugin\CommandEvent;
  1311. use Composer\Plugin\PluginEvents;
  1312. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1313. use Composer\Package\Version\VersionParser;
  1314. use Symfony\Component\Console\Helper\Table;
  1315. use Symfony\Component\Console\Input\InputArgument;
  1316. use Symfony\Component\Console\Input\InputInterface;
  1317. use Symfony\Component\Console\Input\InputOption;
  1318. use Symfony\Component\Console\Output\OutputInterface;
  1319. class BaseDependencyCommand extends BaseCommand
  1320. {
  1321. const ARGUMENT_PACKAGE = 'package';
  1322. const ARGUMENT_CONSTRAINT = 'constraint';
  1323. const OPTION_RECURSIVE = 'recursive';
  1324. const OPTION_TREE = 'tree';
  1325. protected $colors;
  1326. protected function configure()
  1327. {
  1328. $this->setDefinition(array(
  1329. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1330. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1331. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1332. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1333. ));
  1334. }
  1335. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1336. {
  1337. $composer = $this->getComposer();
  1338. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1339. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1340. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1341. $repository = new CompositeRepository(array(
  1342. new ArrayRepository(array($composer->getPackage())),
  1343. $composer->getRepositoryManager()->getLocalRepository(),
  1344. new PlatformRepository(array(), $platformOverrides),
  1345. ));
  1346. $pool = new Pool();
  1347. $pool->addRepository($repository);
  1348. list($needle, $textConstraint) = array_pad(
  1349. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1350. 2,
  1351. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1352. );
  1353. $packages = $pool->whatProvides($needle);
  1354. if (empty($packages)) {
  1355. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1356. }
  1357. if (!$repository->findPackage($needle, $textConstraint)) {
  1358. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1359. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1360. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1361. }
  1362. }
  1363. $needles = array($needle);
  1364. if ($inverted) {
  1365. foreach ($packages as $package) {
  1366. $needles = array_merge($needles, array_map(function (Link $link) {
  1367. return $link->getTarget();
  1368. }, $package->getReplaces()));
  1369. }
  1370. }
  1371. if ('*' !== $textConstraint) {
  1372. $versionParser = new VersionParser();
  1373. $constraint = $versionParser->parseConstraints($textConstraint);
  1374. } else {
  1375. $constraint = null;
  1376. }
  1377. $renderTree = $input->getOption(self::OPTION_TREE);
  1378. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1379. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1380. if (empty($results)) {
  1381. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1382. $this->getIO()->writeError(sprintf('<info>There is no installed package depending on "%s"%s</info>',
  1383. $needle, $extra));
  1384. } elseif ($renderTree) {
  1385. $this->initStyles($output);
  1386. $root = $packages[0];
  1387. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1388. $this->printTree($results);
  1389. } else {
  1390. $this->printTable($output, $results);
  1391. }
  1392. return 0;
  1393. }
  1394. protected function printTable(OutputInterface $output, $results)
  1395. {
  1396. $table = array();
  1397. $doubles = array();
  1398. do {
  1399. $queue = array();
  1400. $rows = array();
  1401. foreach ($results as $result) {
  1402. list($package, $link, $children) = $result;
  1403. $unique = (string) $link;
  1404. if (isset($doubles[$unique])) {
  1405. continue;
  1406. }
  1407. $doubles[$unique] = true;
  1408. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1409. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1410. if ($children) {
  1411. $queue = array_merge($queue, $children);
  1412. }
  1413. }
  1414. $results = $queue;
  1415. $table = array_merge($rows, $table);
  1416. } while (!empty($results));
  1417. $renderer = new Table($output);
  1418. $renderer->setStyle('compact');
  1419. $renderer->getStyle()->setVerticalBorderChar('');
  1420. $renderer->getStyle()->setCellRowContentFormat('%s ');
  1421. $renderer->setRows($table)->render();
  1422. }
  1423. protected function initStyles(OutputInterface $output)
  1424. {
  1425. $this->colors = array(
  1426. 'green',
  1427. 'yellow',
  1428. 'cyan',
  1429. 'magenta',
  1430. 'blue',
  1431. );
  1432. foreach ($this->colors as $color) {
  1433. $style = new OutputFormatterStyle($color);
  1434. $output->getFormatter()->setStyle($color, $style);
  1435. }
  1436. }
  1437. protected function printTree($results, $prefix = '', $level = 1)
  1438. {
  1439. $count = count($results);
  1440. $idx = 0;
  1441. foreach ($results as $result) {
  1442. list($package, $link, $children) = $result;
  1443. $color = $this->colors[$level % count($this->colors)];
  1444. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1445. $isLast = (++$idx == $count);
  1446. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1447. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1448. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1449. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1450. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1451. if ($children) {
  1452. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1453. }
  1454. }
  1455. }
  1456. private function writeTreeLine($line)
  1457. {
  1458. $io = $this->getIO();
  1459. if (!$io->isDecorated()) {
  1460. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1461. }
  1462. $io->write($line);
  1463. }
  1464. }
  1465. <?php
  1466. namespace Composer\Command;
  1467. use Composer\Package\Link;
  1468. use Composer\Package\PackageInterface;
  1469. use Composer\Semver\Constraint\Constraint;
  1470. use Symfony\Component\Console\Helper\Table;
  1471. use Symfony\Component\Console\Input\InputInterface;
  1472. use Symfony\Component\Console\Output\OutputInterface;
  1473. use Composer\Repository\PlatformRepository;
  1474. class CheckPlatformReqsCommand extends BaseCommand
  1475. {
  1476. protected function configure()
  1477. {
  1478. $this->setName('check-platform-reqs')
  1479. ->setDescription('Check that platform requirements are satisfied.')
  1480. ->setHelp(<<<EOT
  1481. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1482. <info>php composer.phar check-platform-reqs</info>
  1483. EOT
  1484. );
  1485. }
  1486. protected function execute(InputInterface $input, OutputInterface $output)
  1487. {
  1488. $composer = $this->getComposer();
  1489. $repos = $composer->getRepositoryManager()->getLocalRepository();
  1490. $allPackages = array_merge(array($composer->getPackage()), $repos->getPackages());
  1491. $requires = $composer->getPackage()->getDevRequires();
  1492. foreach ($requires as $require => $link) {
  1493. $requires[$require] = array($link);
  1494. }
  1495. foreach ($allPackages as $package) {
  1496. foreach ($package->getRequires() as $require => $link) {
  1497. $requires[$require][] = $link;
  1498. }
  1499. }
  1500. ksort($requires);
  1501. $platformRepo = new PlatformRepository(array(), array());
  1502. $currentPlatformPackages = $platformRepo->getPackages();
  1503. $currentPlatformPackageMap = array();
  1504. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1505. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1506. }
  1507. $results = array();
  1508. $exitCode = 0;
  1509. foreach ($requires as $require => $links) {
  1510. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1511. if (isset($currentPlatformPackageMap[$require])) {
  1512. $pass = true;
  1513. $version = $currentPlatformPackageMap[$require]->getVersion();
  1514. foreach ($links as $link) {
  1515. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1516. $results[] = array(
  1517. $currentPlatformPackageMap[$require]->getPrettyName(),
  1518. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1519. $link,
  1520. '<error>failed</error>',
  1521. );
  1522. $pass = false;
  1523. $exitCode = max($exitCode, 1);
  1524. }
  1525. }
  1526. if ($pass) {
  1527. $results[] = array(
  1528. $currentPlatformPackageMap[$require]->getPrettyName(),
  1529. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1530. null,
  1531. '<info>success</info>',
  1532. );
  1533. }
  1534. } else {
  1535. $results[] = array(
  1536. $require,
  1537. 'n/a',
  1538. $links[0],
  1539. '<error>missing</error>',
  1540. );
  1541. $exitCode = max($exitCode, 2);
  1542. }
  1543. }
  1544. }
  1545. $this->printTable($output, $results);
  1546. return $exitCode;
  1547. }
  1548. protected function printTable(OutputInterface $output, $results)
  1549. {
  1550. $table = array();
  1551. $rows = array();
  1552. foreach ($results as $result) {
  1553. list($platformPackage, $version, $link, $status) = $result;
  1554. $rows[] = array(
  1555. $platformPackage,
  1556. $version,
  1557. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1558. $status,
  1559. );
  1560. }
  1561. $table = array_merge($rows, $table);
  1562. $renderer = new Table($output);
  1563. $renderer->setStyle('compact');
  1564. $renderer->getStyle()->setVerticalBorderChar('');
  1565. $renderer->getStyle()->setCellRowContentFormat('%s ');
  1566. $renderer->setRows($table)->render();
  1567. }
  1568. }
  1569. <?php
  1570. namespace Composer\Command;
  1571. use Composer\Cache;
  1572. use Composer\Factory;
  1573. use Symfony\Component\Console\Input\InputInterface;
  1574. use Symfony\Component\Console\Output\OutputInterface;
  1575. class ClearCacheCommand extends BaseCommand
  1576. {
  1577. protected function configure()
  1578. {
  1579. $this
  1580. ->setName('clear-cache')
  1581. ->setAliases(array('clearcache'))
  1582. ->setDescription('Clears composer\'s internal package cache.')
  1583. ->setHelp(<<<EOT
  1584. The <info>clear-cache</info> deletes all cached packages from composer's
  1585. cache directory.
  1586. EOT
  1587. )
  1588. ;
  1589. }
  1590. protected function execute(InputInterface $input, OutputInterface $output)
  1591. {
  1592. $config = Factory::createConfig();
  1593. $io = $this->getIO();
  1594. $cachePaths = array(
  1595. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1596. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1597. 'cache-files-dir' => $config->get('cache-files-dir'),
  1598. 'cache-dir' => $config->get('cache-dir'),
  1599. );
  1600. foreach ($cachePaths as $key => $cachePath) {
  1601. $cachePath = realpath($cachePath);
  1602. if (!$cachePath) {
  1603. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1604. continue;
  1605. }
  1606. $cache = new Cache($io, $cachePath);
  1607. if (!$cache->isEnabled()) {
  1608. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1609. continue;
  1610. }
  1611. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1612. $cache->clear();
  1613. }
  1614. $io->writeError('<info>All caches cleared.</info>');
  1615. }
  1616. }
  1617. <?php
  1618. namespace Composer\Command;
  1619. use Composer\Util\Platform;
  1620. use Composer\Util\Silencer;
  1621. use Symfony\Component\Console\Input\InputInterface;
  1622. use Symfony\Component\Console\Input\InputArgument;
  1623. use Symfony\Component\Console\Input\InputOption;
  1624. use Symfony\Component\Console\Output\OutputInterface;
  1625. use Composer\Config;
  1626. use Composer\Config\JsonConfigSource;
  1627. use Composer\Factory;
  1628. use Composer\Json\JsonFile;
  1629. use Composer\Semver\VersionParser;
  1630. use Composer\Package\BasePackage;
  1631. class ConfigCommand extends BaseCommand
  1632. {
  1633. protected $config;
  1634. protected $configFile;
  1635. protected $configSource;
  1636. protected $authConfigFile;
  1637. protected $authConfigSource;
  1638. protected function configure()
  1639. {
  1640. $this
  1641. ->setName('config')
  1642. ->setDescription('Sets config options.')
  1643. ->setDefinition(array(
  1644. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1645. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1646. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1647. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1648. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1649. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1650. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1651. new InputArgument('setting-key', null, 'Setting key'),
  1652. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1653. ))
  1654. ->setHelp(<<<EOT
  1655. This command allows you to edit composer config settings and repositories
  1656. in either the local composer.json file or the global config.json file.
  1657. Additionally it lets you edit most properties in the local composer.json.
  1658. To set a config setting:
  1659. <comment>%command.full_name% bin-dir bin/</comment>
  1660. To read a config setting:
  1661. <comment>%command.full_name% bin-dir</comment>
  1662. Outputs: <info>bin</info>
  1663. To edit the global config.json file:
  1664. <comment>%command.full_name% --global</comment>
  1665. To add a repository:
  1666. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1667. To remove a repository (repo is a short alias for repositories):
  1668. <comment>%command.full_name% --unset repo.foo</comment>
  1669. To disable packagist:
  1670. <comment>%command.full_name% repo.packagist false</comment>
  1671. You can alter repositories in the global config.json file by passing in the
  1672. <info>--global</info> option.
  1673. To edit the file in an external editor:
  1674. <comment>%command.full_name% --editor</comment>
  1675. To choose your editor you can set the "EDITOR" env variable.
  1676. To get a list of configuration values in the file:
  1677. <comment>%command.full_name% --list</comment>
  1678. You can always pass more than one option. As an example, if you want to edit the
  1679. global config.json file.
  1680. <comment>%command.full_name% --editor --global</comment>
  1681. EOT
  1682. )
  1683. ;
  1684. }
  1685. protected function initialize(InputInterface $input, OutputInterface $output)
  1686. {
  1687. parent::initialize($input, $output);
  1688. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1689. throw new \RuntimeException('--file and --global can not be combined');
  1690. }
  1691. $io = $this->getIO();
  1692. $this->config = Factory::createConfig($io);
  1693. $configFile = $input->getOption('global')
  1694. ? ($this->config->get('home') . '/config.json')
  1695. : ($input->getOption('file') ?: Factory::getComposerFile());
  1696. if (
  1697. ($configFile === 'composer.json' || $configFile === './composer.json')
  1698. && !file_exists($configFile)
  1699. && realpath(getcwd()) === realpath($this->config->get('home'))
  1700. ) {
  1701. file_put_contents($configFile, "{\n}\n");
  1702. }
  1703. $this->configFile = new JsonFile($configFile, null, $io);
  1704. $this->configSource = new JsonConfigSource($this->configFile);
  1705. $authConfigFile = $input->getOption('global')
  1706. ? ($this->config->get('home') . '/auth.json')
  1707. : dirname(realpath($configFile)) . '/auth.json';
  1708. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1709. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1710. if ($input->getOption('global') && !$this->configFile->exists()) {
  1711. touch($this->configFile->getPath());
  1712. $this->configFile->write(array('config' => new \ArrayObject));
  1713. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1714. }
  1715. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1716. touch($this->authConfigFile->getPath());
  1717. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1718. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1719. }
  1720. if (!$this->configFile->exists()) {
  1721. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1722. }
  1723. }
  1724. protected function execute(InputInterface $input, OutputInterface $output)
  1725. {
  1726. if ($input->getOption('editor')) {
  1727. $editor = escapeshellcmd(getenv('EDITOR'));
  1728. if (!$editor) {
  1729. if (Platform::isWindows()) {
  1730. $editor = 'notepad';
  1731. } else {
  1732. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1733. if (exec('which '.$candidate)) {
  1734. $editor = $candidate;
  1735. break;
  1736. }
  1737. }
  1738. }
  1739. }
  1740. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1741. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1742. return 0;
  1743. }
  1744. if (!$input->getOption('global')) {
  1745. $this->config->merge($this->configFile->read());
  1746. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1747. }
  1748. if ($input->getOption('list')) {
  1749. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1750. return 0;
  1751. }
  1752. $settingKey = $input->getArgument('setting-key');
  1753. if (!$settingKey) {
  1754. return 0;
  1755. }
  1756. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1757. throw new \RuntimeException('You can not combine a setting value with --unset');
  1758. }
  1759. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1760. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1761. $rawData = $this->configFile->read();
  1762. $data = $this->config->all();
  1763. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1764. if (!isset($matches[1]) || $matches[1] === '') {
  1765. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1766. } else {
  1767. if (!isset($data['repositories'][$matches[1]])) {
  1768. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1769. }
  1770. $value = $data['repositories'][$matches[1]];
  1771. }
  1772. } elseif (strpos($settingKey, '.')) {
  1773. $bits = explode('.', $settingKey);
  1774. if ($bits[0] === 'extra') {
  1775. $data = $rawData;
  1776. } else {
  1777. $data = $data['config'];
  1778. }
  1779. $match = false;
  1780. foreach ($bits as $bit) {
  1781. $key = isset($key) ? $key.'.'.$bit : $bit;
  1782. $match = false;
  1783. if (isset($data[$key])) {
  1784. $match = true;
  1785. $data = $data[$key];
  1786. unset($key);
  1787. }
  1788. }
  1789. if (!$match) {
  1790. throw new \RuntimeException($settingKey.' is not defined.');
  1791. }
  1792. $value = $data;
  1793. } elseif (isset($data['config'][$settingKey])) {
  1794. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1795. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1796. $value = $rawData[$settingKey];
  1797. } else {
  1798. throw new \RuntimeException($settingKey.' is not defined');
  1799. }
  1800. if (is_array($value)) {
  1801. $value = json_encode($value);
  1802. }
  1803. $this->getIO()->write($value);
  1804. return 0;
  1805. }
  1806. $values = $input->getArgument('setting-value');
  1807. $booleanValidator = function ($val) {
  1808. return in_array($val, array('true', 'false', '1', '0'), true);
  1809. };
  1810. $booleanNormalizer = function ($val) {
  1811. return $val !== 'false' && (bool) $val;
  1812. };
  1813. $uniqueConfigValues = array(
  1814. 'process-timeout' => array('is_numeric', 'intval'),
  1815. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1816. 'preferred-install' => array(
  1817. function ($val) {
  1818. return in_array($val, array('auto', 'source', 'dist'), true);
  1819. },
  1820. function ($val) {
  1821. return $val;
  1822. },
  1823. ),
  1824. 'store-auths' => array(
  1825. function ($val) {
  1826. return in_array($val, array('true', 'false', 'prompt'), true);
  1827. },
  1828. function ($val) {
  1829. if ('prompt' === $val) {
  1830. return 'prompt';
  1831. }
  1832. return $val !== 'false' && (bool) $val;
  1833. },
  1834. ),
  1835. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1836. 'vendor-dir' => array('is_string', function ($val) {
  1837. return $val;
  1838. }),
  1839. 'bin-dir' => array('is_string', function ($val) {
  1840. return $val;
  1841. }),
  1842. 'archive-dir' => array('is_string', function ($val) {
  1843. return $val;
  1844. }),
  1845. 'archive-format' => array('is_string', function ($val) {
  1846. return $val;
  1847. }),
  1848. 'data-dir' => array('is_string', function ($val) {
  1849. return $val;
  1850. }),
  1851. 'cache-dir' => array('is_string', function ($val) {
  1852. return $val;
  1853. }),
  1854. 'cache-files-dir' => array('is_string', function ($val) {
  1855. return $val;
  1856. }),
  1857. 'cache-repo-dir' => array('is_string', function ($val) {
  1858. return $val;
  1859. }),
  1860. 'cache-vcs-dir' => array('is_string', function ($val) {
  1861. return $val;
  1862. }),
  1863. 'cache-ttl' => array('is_numeric', 'intval'),
  1864. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1865. 'cache-files-maxsize' => array(
  1866. function ($val) {
  1867. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  1868. },
  1869. function ($val) {
  1870. return $val;
  1871. },
  1872. ),
  1873. 'bin-compat' => array(
  1874. function ($val) {
  1875. return in_array($val, array('auto', 'full'));
  1876. },
  1877. function ($val) {
  1878. return $val;
  1879. },
  1880. ),
  1881. 'discard-changes' => array(
  1882. function ($val) {
  1883. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  1884. },
  1885. function ($val) {
  1886. if ('stash' === $val) {
  1887. return 'stash';
  1888. }
  1889. return $val !== 'false' && (bool) $val;
  1890. },
  1891. ),
  1892. 'autoloader-suffix' => array('is_string', function ($val) {
  1893. return $val === 'null' ? null : $val;
  1894. }),
  1895. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1896. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1897. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1898. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  1899. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1900. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1901. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  1902. 'cafile' => array(
  1903. function ($val) {
  1904. return file_exists($val) && is_readable($val);
  1905. },
  1906. function ($val) {
  1907. return $val === 'null' ? null : $val;
  1908. },
  1909. ),
  1910. 'capath' => array(
  1911. function ($val) {
  1912. return is_dir($val) && is_readable($val);
  1913. },
  1914. function ($val) {
  1915. return $val === 'null' ? null : $val;
  1916. },
  1917. ),
  1918. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  1919. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  1920. );
  1921. $multiConfigValues = array(
  1922. 'github-protocols' => array(
  1923. function ($vals) {
  1924. if (!is_array($vals)) {
  1925. return 'array expected';
  1926. }
  1927. foreach ($vals as $val) {
  1928. if (!in_array($val, array('git', 'https', 'ssh'))) {
  1929. return 'valid protocols include: git, https, ssh';
  1930. }
  1931. }
  1932. return true;
  1933. },
  1934. function ($vals) {
  1935. return $vals;
  1936. },
  1937. ),
  1938. 'github-domains' => array(
  1939. function ($vals) {
  1940. if (!is_array($vals)) {
  1941. return 'array expected';
  1942. }
  1943. return true;
  1944. },
  1945. function ($vals) {
  1946. return $vals;
  1947. },
  1948. ),
  1949. 'gitlab-domains' => array(
  1950. function ($vals) {
  1951. if (!is_array($vals)) {
  1952. return 'array expected';
  1953. }
  1954. return true;
  1955. },
  1956. function ($vals) {
  1957. return $vals;
  1958. },
  1959. ),
  1960. );
  1961. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  1962. return $this->configSource->removeConfigSetting($settingKey);
  1963. }
  1964. if (isset($uniqueConfigValues[$settingKey])) {
  1965. return $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  1966. }
  1967. if (isset($multiConfigValues[$settingKey])) {
  1968. return $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  1969. }
  1970. $uniqueProps = array(
  1971. 'name' => array('is_string', function ($val) {
  1972. return $val;
  1973. }),
  1974. 'type' => array('is_string', function ($val) {
  1975. return $val;
  1976. }),
  1977. 'description' => array('is_string', function ($val) {
  1978. return $val;
  1979. }),
  1980. 'homepage' => array('is_string', function ($val) {
  1981. return $val;
  1982. }),
  1983. 'version' => array('is_string', function ($val) {
  1984. return $val;
  1985. }),
  1986. 'minimum-stability' => array(
  1987. function ($val) {
  1988. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  1989. },
  1990. function ($val) {
  1991. return VersionParser::normalizeStability($val);
  1992. },
  1993. ),
  1994. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  1995. );
  1996. $multiProps = array(
  1997. 'keywords' => array(
  1998. function ($vals) {
  1999. if (!is_array($vals)) {
  2000. return 'array expected';
  2001. }
  2002. return true;
  2003. },
  2004. function ($vals) {
  2005. return $vals;
  2006. },
  2007. ),
  2008. 'license' => array(
  2009. function ($vals) {
  2010. if (!is_array($vals)) {
  2011. return 'array expected';
  2012. }
  2013. return true;
  2014. },
  2015. function ($vals) {
  2016. return $vals;
  2017. },
  2018. ),
  2019. );
  2020. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2021. throw new \InvalidArgumentException('The '.$settingKey.' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
  2022. }
  2023. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2024. return $this->configSource->removeProperty($settingKey);
  2025. }
  2026. if (isset($uniqueProps[$settingKey])) {
  2027. return $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2028. }
  2029. if (isset($multiProps[$settingKey])) {
  2030. return $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2031. }
  2032. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2033. if ($input->getOption('unset')) {
  2034. return $this->configSource->removeRepository($matches[1]);
  2035. }
  2036. if (2 === count($values)) {
  2037. return $this->configSource->addRepository($matches[1], array(
  2038. 'type' => $values[0],
  2039. 'url' => $values[1],
  2040. ));
  2041. }
  2042. if (1 === count($values)) {
  2043. $value = strtolower($values[0]);
  2044. if (true === $booleanValidator($value)) {
  2045. if (false === $booleanNormalizer($value)) {
  2046. return $this->configSource->addRepository($matches[1], false);
  2047. }
  2048. } else {
  2049. $value = JsonFile::parseJson($values[0]);
  2050. return $this->configSource->addRepository($matches[1], $value);
  2051. }
  2052. }
  2053. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2054. }
  2055. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2056. if ($input->getOption('unset')) {
  2057. return $this->configSource->removeProperty($settingKey);
  2058. }
  2059. return $this->configSource->addProperty($settingKey, $values[0]);
  2060. }
  2061. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2062. if ($input->getOption('unset')) {
  2063. return $this->configSource->removeConfigSetting($settingKey);
  2064. }
  2065. return $this->configSource->addConfigSetting($settingKey, $values[0]);
  2066. }
  2067. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2068. return $this->configSource->removeConfigSetting($settingKey);
  2069. }
  2070. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
  2071. if ($input->getOption('unset')) {
  2072. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2073. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2074. return;
  2075. }
  2076. if ($matches[1] === 'bitbucket-oauth') {
  2077. if (2 !== count($values)) {
  2078. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2079. }
  2080. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2081. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2082. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
  2083. if (1 !== count($values)) {
  2084. throw new \RuntimeException('Too many arguments, expected only one token');
  2085. }
  2086. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2087. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2088. } elseif ($matches[1] === 'http-basic') {
  2089. if (2 !== count($values)) {
  2090. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2091. }
  2092. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2093. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2094. }
  2095. return;
  2096. }
  2097. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2098. }
  2099. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2100. {
  2101. list($validator, $normalizer) = $callbacks;
  2102. if (1 !== count($values)) {
  2103. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2104. }
  2105. if (true !== $validation = $validator($values[0])) {
  2106. throw new \RuntimeException(sprintf(
  2107. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2108. $values[0]
  2109. ));
  2110. }
  2111. return call_user_func(array($this->configSource, $method), $key, $normalizer($values[0]));
  2112. }
  2113. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2114. {
  2115. list($validator, $normalizer) = $callbacks;
  2116. if (true !== $validation = $validator($values)) {
  2117. throw new \RuntimeException(sprintf(
  2118. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2119. json_encode($values)
  2120. ));
  2121. }
  2122. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2123. }
  2124. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2125. {
  2126. $origK = $k;
  2127. $io = $this->getIO();
  2128. foreach ($contents as $key => $value) {
  2129. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2130. continue;
  2131. }
  2132. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2133. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2134. $k .= preg_replace('{^config\.}', '', $key . '.');
  2135. $this->listConfiguration($value, $rawVal, $output, $k);
  2136. $k = $origK;
  2137. continue;
  2138. }
  2139. if (is_array($value)) {
  2140. $value = array_map(function ($val) {
  2141. return is_array($val) ? json_encode($val) : $val;
  2142. }, $value);
  2143. $value = '['.implode(', ', $value).']';
  2144. }
  2145. if (is_bool($value)) {
  2146. $value = var_export($value, true);
  2147. }
  2148. if (is_string($rawVal) && $rawVal != $value) {
  2149. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>');
  2150. } else {
  2151. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
  2152. }
  2153. }
  2154. }
  2155. }
  2156. <?php
  2157. namespace Composer\Command;
  2158. use Composer\Config;
  2159. use Composer\Factory;
  2160. use Composer\Installer;
  2161. use Composer\Installer\ProjectInstaller;
  2162. use Composer\Installer\InstallationManager;
  2163. use Composer\Installer\SuggestedPackagesReporter;
  2164. use Composer\IO\IOInterface;
  2165. use Composer\Package\BasePackage;
  2166. use Composer\DependencyResolver\Pool;
  2167. use Composer\DependencyResolver\Operation\InstallOperation;
  2168. use Composer\Package\Version\VersionSelector;
  2169. use Composer\Package\AliasPackage;
  2170. use Composer\Repository\RepositoryFactory;
  2171. use Composer\Repository\CompositeRepository;
  2172. use Composer\Repository\PlatformRepository;
  2173. use Composer\Repository\InstalledFilesystemRepository;
  2174. use Composer\Script\ScriptEvents;
  2175. use Composer\Util\Silencer;
  2176. use Symfony\Component\Console\Input\InputArgument;
  2177. use Symfony\Component\Console\Input\InputInterface;
  2178. use Symfony\Component\Console\Input\InputOption;
  2179. use Symfony\Component\Console\Output\OutputInterface;
  2180. use Symfony\Component\Finder\Finder;
  2181. use Composer\Json\JsonFile;
  2182. use Composer\Config\JsonConfigSource;
  2183. use Composer\Util\Filesystem;
  2184. use Composer\Package\Version\VersionParser;
  2185. class CreateProjectCommand extends BaseCommand
  2186. {
  2187. protected $suggestedPackagesReporter;
  2188. protected function configure()
  2189. {
  2190. $this
  2191. ->setName('create-project')
  2192. ->setDescription('Creates new project from a package into given directory.')
  2193. ->setDefinition(array(
  2194. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2195. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2196. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2197. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2198. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2199. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2200. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2201. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2202. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2203. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2204. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2205. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2206. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2207. new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
  2208. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2209. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2210. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2211. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2212. ))
  2213. ->setHelp(<<<EOT
  2214. The <info>create-project</info> command creates a new project from a given
  2215. package into a new directory. If executed without params and in a directory
  2216. with a composer.json file it installs the packages for the current project.
  2217. You can use this command to bootstrap new projects or setup a clean
  2218. version-controlled installation for developers of your project.
  2219. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2220. You can also specify the version with the package name using = or : as separator.
  2221. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2222. To install unstable packages, either specify the version you want, or use the
  2223. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2224. To setup a developer workable version you should create the project using the source
  2225. controlled code by appending the <info>'--prefer-source'</info> flag.
  2226. To install a package from another repository than the default one you
  2227. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2228. EOT
  2229. )
  2230. ;
  2231. }
  2232. protected function execute(InputInterface $input, OutputInterface $output)
  2233. {
  2234. $config = Factory::createConfig();
  2235. $io = $this->getIO();
  2236. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2237. if ($input->getOption('dev')) {
  2238. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2239. }
  2240. if ($input->getOption('no-custom-installers')) {
  2241. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2242. $input->setOption('no-plugins', true);
  2243. }
  2244. return $this->installProject(
  2245. $io,
  2246. $config,
  2247. $input,
  2248. $input->getArgument('package'),
  2249. $input->getArgument('directory'),
  2250. $input->getArgument('version'),
  2251. $input->getOption('stability'),
  2252. $preferSource,
  2253. $preferDist,
  2254. !$input->getOption('no-dev'),
  2255. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2256. $input->getOption('no-plugins'),
  2257. $input->getOption('no-scripts'),
  2258. $input->getOption('keep-vcs'),
  2259. $input->getOption('no-progress'),
  2260. $input->getOption('no-install'),
  2261. $input->getOption('ignore-platform-reqs'),
  2262. !$input->getOption('no-secure-http'),
  2263. $input->getOption('remove-vcs')
  2264. );
  2265. }
  2266. public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true, $removeVcs = false)
  2267. {
  2268. $oldCwd = getcwd();
  2269. $io->loadConfiguration($config);
  2270. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2271. if ($packageName !== null) {
  2272. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $keepVcs, $noProgress, $ignorePlatformReqs, $secureHttp);
  2273. } else {
  2274. $installedFromVcs = false;
  2275. }
  2276. $composer = Factory::create($io, null, $disablePlugins);
  2277. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2278. $fs = new Filesystem();
  2279. if ($noScripts === false) {
  2280. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2281. }
  2282. $config = $composer->getConfig();
  2283. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2284. if ($noInstall === false) {
  2285. $installer = Installer::create($io, $composer);
  2286. $installer->setPreferSource($preferSource)
  2287. ->setPreferDist($preferDist)
  2288. ->setDevMode($installDevPackages)
  2289. ->setRunScripts(!$noScripts)
  2290. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2291. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2292. ->setOptimizeAutoloader($config->get('optimize-autoloader'));
  2293. if ($disablePlugins) {
  2294. $installer->disablePlugins();
  2295. }
  2296. $status = $installer->run();
  2297. if (0 !== $status) {
  2298. return $status;
  2299. }
  2300. }
  2301. $hasVcs = $installedFromVcs;
  2302. if (
  2303. !$keepVcs
  2304. && $installedFromVcs
  2305. && (
  2306. $removeVcs
  2307. || !$io->isInteractive()
  2308. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2309. )
  2310. ) {
  2311. $finder = new Finder();
  2312. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2313. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2314. $finder->name($vcsName);
  2315. }
  2316. try {
  2317. $dirs = iterator_to_array($finder);
  2318. unset($finder);
  2319. foreach ($dirs as $dir) {
  2320. if (!$fs->removeDirectory($dir)) {
  2321. throw new \RuntimeException('Could not remove '.$dir);
  2322. }
  2323. }
  2324. } catch (\Exception $e) {
  2325. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2326. }
  2327. $hasVcs = false;
  2328. }
  2329. if (!$hasVcs) {
  2330. $package = $composer->getPackage();
  2331. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2332. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2333. foreach ($package->{'get'.$meta['method']}() as $link) {
  2334. if ($link->getPrettyConstraint() === 'self.version') {
  2335. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2336. }
  2337. }
  2338. }
  2339. }
  2340. if ($noScripts === false) {
  2341. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2342. }
  2343. chdir($oldCwd);
  2344. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2345. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2346. Silencer::call('rmdir', $vendorComposerDir);
  2347. $vendorDir = $config->get('vendor-dir');
  2348. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2349. Silencer::call('rmdir', $vendorDir);
  2350. }
  2351. }
  2352. return 0;
  2353. }
  2354. protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $keepVcs = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2355. {
  2356. if (!$secureHttp) {
  2357. $config->merge(array('config' => array('secure-http' => false)));
  2358. }
  2359. if (null === $repository) {
  2360. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2361. } else {
  2362. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2363. }
  2364. $parser = new VersionParser();
  2365. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2366. $name = strtolower($requirements[0]['name']);
  2367. if (!$packageVersion && isset($requirements[0]['version'])) {
  2368. $packageVersion = $requirements[0]['version'];
  2369. }
  2370. if (null === $stability) {
  2371. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2372. $stability = $match[1];
  2373. } else {
  2374. $stability = VersionParser::parseStability($packageVersion);
  2375. }
  2376. }
  2377. $stability = VersionParser::normalizeStability($stability);
  2378. if (!isset(BasePackage::$stabilities[$stability])) {
  2379. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2380. }
  2381. $pool = new Pool($stability);
  2382. $pool->addRepository($sourceRepo);
  2383. $phpVersion = null;
  2384. $prettyPhpVersion = null;
  2385. if (!$ignorePlatformReqs) {
  2386. $platformOverrides = $config->get('platform') ?: array();
  2387. $platform = new PlatformRepository(array(), $platformOverrides);
  2388. $phpPackage = $platform->findPackage('php', '*');
  2389. $phpVersion = $phpPackage->getVersion();
  2390. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2391. }
  2392. $versionSelector = new VersionSelector($pool);
  2393. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2394. if (!$package) {
  2395. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2396. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2397. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2398. }
  2399. throw new \InvalidArgumentException($errorMessage .'.');
  2400. }
  2401. if (null === $directory) {
  2402. $parts = explode("/", $name, 2);
  2403. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2404. }
  2405. if (function_exists('pcntl_async_signals')) {
  2406. @mkdir($directory, 0777, true);
  2407. if ($realDir = realpath($directory)) {
  2408. pcntl_async_signals(true);
  2409. pcntl_signal(SIGINT, function () use ($realDir) {
  2410. $fs = new Filesystem();
  2411. $fs->removeDirectory($realDir);
  2412. exit(130);
  2413. });
  2414. }
  2415. }
  2416. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2417. if ($disablePlugins) {
  2418. $io->writeError('<info>Plugins have been disabled.</info>');
  2419. }
  2420. if ($package instanceof AliasPackage) {
  2421. $package = $package->getAliasOf();
  2422. }
  2423. if (0 === strpos($package->getPrettyVersion(), 'dev-') && in_array($package->getSourceType(), array('git', 'hg'))) {
  2424. $package->setSourceReference(substr($package->getPrettyVersion(), 4));
  2425. }
  2426. $dm = $this->createDownloadManager($io, $config);
  2427. $dm->setPreferSource($preferSource)
  2428. ->setPreferDist($preferDist)
  2429. ->setOutputProgress(!$noProgress);
  2430. $projectInstaller = new ProjectInstaller($directory, $dm);
  2431. $im = $this->createInstallationManager();
  2432. $im->addInstaller($projectInstaller);
  2433. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2434. $im->notifyInstalls($io);
  2435. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2436. $installedFromVcs = 'source' === $package->getInstallationSource();
  2437. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2438. chdir($directory);
  2439. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2440. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2441. return $installedFromVcs;
  2442. }
  2443. protected function createDownloadManager(IOInterface $io, Config $config)
  2444. {
  2445. $factory = new Factory();
  2446. return $factory->createDownloadManager($io, $config);
  2447. }
  2448. protected function createInstallationManager()
  2449. {
  2450. return new InstallationManager();
  2451. }
  2452. }
  2453. <?php
  2454. namespace Composer\Command;
  2455. use Symfony\Component\Console\Input\InputInterface;
  2456. use Symfony\Component\Console\Output\OutputInterface;
  2457. class DependsCommand extends BaseDependencyCommand
  2458. {
  2459. protected function configure()
  2460. {
  2461. parent::configure();
  2462. $this
  2463. ->setName('depends')
  2464. ->setAliases(array('why'))
  2465. ->setDescription('Shows which packages cause the given package to be installed.')
  2466. ->setHelp(<<<EOT
  2467. Displays detailed information about where a package is referenced.
  2468. <info>php composer.phar depends composer/composer</info>
  2469. EOT
  2470. )
  2471. ;
  2472. }
  2473. protected function execute(InputInterface $input, OutputInterface $output)
  2474. {
  2475. return parent::doExecute($input, $output, false);
  2476. }
  2477. }
  2478. <?php
  2479. namespace Composer\Command;
  2480. use Composer\Composer;
  2481. use Composer\Factory;
  2482. use Composer\Config;
  2483. use Composer\Downloader\TransportException;
  2484. use Composer\Plugin\CommandEvent;
  2485. use Composer\Plugin\PluginEvents;
  2486. use Composer\Util\ConfigValidator;
  2487. use Composer\Util\IniHelper;
  2488. use Composer\Util\ProcessExecutor;
  2489. use Composer\Util\RemoteFilesystem;
  2490. use Composer\Util\StreamContextFactory;
  2491. use Composer\SelfUpdate\Keys;
  2492. use Composer\SelfUpdate\Versions;
  2493. use Composer\IO\NullIO;
  2494. use Symfony\Component\Console\Input\InputInterface;
  2495. use Symfony\Component\Console\Output\OutputInterface;
  2496. class DiagnoseCommand extends BaseCommand
  2497. {
  2498. protected $rfs;
  2499. protected $process;
  2500. protected $exitCode = 0;
  2501. protected function configure()
  2502. {
  2503. $this
  2504. ->setName('diagnose')
  2505. ->setDescription('Diagnoses the system to identify common errors.')
  2506. ->setHelp(<<<EOT
  2507. The <info>diagnose</info> command checks common errors to help debugging problems.
  2508. The process exit code will be 1 in case of warnings and 2 for errors.
  2509. EOT
  2510. )
  2511. ;
  2512. }
  2513. protected function execute(InputInterface $input, OutputInterface $output)
  2514. {
  2515. $composer = $this->getComposer(false);
  2516. $io = $this->getIO();
  2517. if ($composer) {
  2518. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2519. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2520. $io->write('Checking composer.json: ', false);
  2521. $this->outputResult($this->checkComposerSchema());
  2522. }
  2523. if ($composer) {
  2524. $config = $composer->getConfig();
  2525. } else {
  2526. $config = Factory::createConfig();
  2527. }
  2528. $config->merge(array('config' => array('secure-http' => false)));
  2529. $config->prohibitUrlByConfig('http://packagist.org', new NullIO);
  2530. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2531. $this->process = new ProcessExecutor($io);
  2532. $io->write('Checking platform settings: ', false);
  2533. $this->outputResult($this->checkPlatform());
  2534. $io->write('Checking git settings: ', false);
  2535. $this->outputResult($this->checkGit());
  2536. $io->write('Checking http connectivity to packagist: ', false);
  2537. $this->outputResult($this->checkHttp('http', $config));
  2538. $io->write('Checking https connectivity to packagist: ', false);
  2539. $this->outputResult($this->checkHttp('https', $config));
  2540. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2541. if (!empty($opts['http']['proxy'])) {
  2542. $io->write('Checking HTTP proxy: ', false);
  2543. $this->outputResult($this->checkHttpProxy());
  2544. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2545. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2546. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2547. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2548. }
  2549. if ($oauth = $config->get('github-oauth')) {
  2550. foreach ($oauth as $domain => $token) {
  2551. $io->write('Checking '.$domain.' oauth access: ', false);
  2552. $this->outputResult($this->checkGithubOauth($domain, $token));
  2553. }
  2554. } else {
  2555. $io->write('Checking github.com rate limit: ', false);
  2556. try {
  2557. $rate = $this->getGithubRateLimit('github.com');
  2558. $this->outputResult(true);
  2559. if (10 > $rate['remaining']) {
  2560. $io->write('<warning>WARNING</warning>');
  2561. $io->write(sprintf(
  2562. '<comment>Github has a rate limit on their API. '
  2563. . 'You currently have <options=bold>%u</options=bold> '
  2564. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2565. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2566. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2567. $rate['remaining'],
  2568. $rate['limit']
  2569. ));
  2570. }
  2571. } catch (\Exception $e) {
  2572. if ($e instanceof TransportException && $e->getCode() === 401) {
  2573. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2574. } else {
  2575. $this->outputResult($e);
  2576. }
  2577. }
  2578. }
  2579. $io->write('Checking disk free space: ', false);
  2580. $this->outputResult($this->checkDiskSpace($config));
  2581. if ('phar:' === substr(__FILE__, 0, 5)) {
  2582. $io->write('Checking pubkeys: ', false);
  2583. $this->outputResult($this->checkPubKeys($config));
  2584. $io->write('Checking composer version: ', false);
  2585. $this->outputResult($this->checkVersion($config));
  2586. }
  2587. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2588. $io->write(sprintf('PHP version: <comment>%s</comment>', PHP_VERSION));
  2589. if (defined('PHP_BINARY')) {
  2590. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2591. }
  2592. return $this->exitCode;
  2593. }
  2594. private function checkComposerSchema()
  2595. {
  2596. $validator = new ConfigValidator($this->getIO());
  2597. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2598. if ($errors || $warnings) {
  2599. $messages = array(
  2600. 'error' => $errors,
  2601. 'warning' => $warnings,
  2602. );
  2603. $output = '';
  2604. foreach ($messages as $style => $msgs) {
  2605. foreach ($msgs as $msg) {
  2606. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2607. }
  2608. }
  2609. return rtrim($output);
  2610. }
  2611. return true;
  2612. }
  2613. private function checkGit()
  2614. {
  2615. $this->process->execute('git config color.ui', $output);
  2616. if (strtolower(trim($output)) === 'always') {
  2617. return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
  2618. }
  2619. return true;
  2620. }
  2621. private function checkHttp($proto, Config $config)
  2622. {
  2623. $disableTls = false;
  2624. $result = array();
  2625. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2626. $disableTls = true;
  2627. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2628. }
  2629. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2630. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2631. }
  2632. try {
  2633. $this->rfs->getContents('packagist.org', $proto . '://packagist.org/packages.json', false);
  2634. } catch (TransportException $e) {
  2635. if (false !== strpos($e->getMessage(), 'cafile')) {
  2636. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2637. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2638. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2639. } else {
  2640. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2641. }
  2642. }
  2643. if (count($result) > 0) {
  2644. return $result;
  2645. }
  2646. return true;
  2647. }
  2648. private function checkHttpProxy()
  2649. {
  2650. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2651. try {
  2652. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://packagist.org/packages.json', false), true);
  2653. $hash = reset($json['provider-includes']);
  2654. $hash = $hash['sha256'];
  2655. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2656. $provider = $this->rfs->getContents('packagist.org', $protocol . '://packagist.org/'.$path, false);
  2657. if (hash('sha256', $provider) !== $hash) {
  2658. return 'It seems that your proxy is modifying http traffic on the fly';
  2659. }
  2660. } catch (\Exception $e) {
  2661. return $e;
  2662. }
  2663. return true;
  2664. }
  2665. private function checkHttpProxyFullUriRequestParam()
  2666. {
  2667. $url = 'http://packagist.org/packages.json';
  2668. try {
  2669. $this->rfs->getContents('packagist.org', $url, false);
  2670. } catch (TransportException $e) {
  2671. try {
  2672. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2673. } catch (TransportException $e) {
  2674. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2675. }
  2676. return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" and "HTTPS_PROXY_REQUEST_FULLURI" environment variables to "false"';
  2677. }
  2678. return true;
  2679. }
  2680. private function checkHttpsProxyFullUriRequestParam()
  2681. {
  2682. if (!extension_loaded('openssl')) {
  2683. return 'You need the openssl extension installed for this check';
  2684. }
  2685. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2686. try {
  2687. $this->rfs->getContents('github.com', $url, false);
  2688. } catch (TransportException $e) {
  2689. try {
  2690. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2691. } catch (TransportException $e) {
  2692. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2693. }
  2694. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2695. }
  2696. return true;
  2697. }
  2698. private function checkGithubOauth($domain, $token)
  2699. {
  2700. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2701. try {
  2702. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2703. return $this->rfs->getContents($domain, $url, false, array(
  2704. 'retry-auth-failure' => false,
  2705. )) ? true : 'Unexpected error';
  2706. } catch (\Exception $e) {
  2707. if ($e instanceof TransportException && $e->getCode() === 401) {
  2708. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2709. }
  2710. return $e;
  2711. }
  2712. }
  2713. private function getGithubRateLimit($domain, $token = null)
  2714. {
  2715. if ($token) {
  2716. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2717. }
  2718. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2719. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2720. $data = json_decode($json, true);
  2721. return $data['resources']['core'];
  2722. }
  2723. private function checkDiskSpace($config)
  2724. {
  2725. $minSpaceFree = 1024 * 1024;
  2726. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2727. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2728. ) {
  2729. return '<error>The disk hosting '.$dir.' is full</error>';
  2730. }
  2731. return true;
  2732. }
  2733. private function checkPubKeys($config)
  2734. {
  2735. $home = $config->get('home');
  2736. $errors = array();
  2737. $io = $this->getIO();
  2738. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2739. $io->write('');
  2740. }
  2741. if (file_exists($home.'/keys.tags.pub')) {
  2742. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2743. } else {
  2744. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2745. }
  2746. if (file_exists($home.'/keys.dev.pub')) {
  2747. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2748. } else {
  2749. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2750. }
  2751. if ($errors) {
  2752. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2753. }
  2754. return $errors ?: true;
  2755. }
  2756. private function checkVersion($config)
  2757. {
  2758. $versionsUtil = new Versions($config, $this->rfs);
  2759. $latest = $versionsUtil->getLatest();
  2760. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2761. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2762. }
  2763. return true;
  2764. }
  2765. private function outputResult($result)
  2766. {
  2767. $io = $this->getIO();
  2768. if (true === $result) {
  2769. $io->write('<info>OK</info>');
  2770. return;
  2771. }
  2772. $hadError = false;
  2773. if ($result instanceof \Exception) {
  2774. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2775. }
  2776. if (!$result) {
  2777. $hadError = true;
  2778. } else {
  2779. if (!is_array($result)) {
  2780. $result = array($result);
  2781. }
  2782. foreach ($result as $message) {
  2783. if (false !== strpos($message, '<error>')) {
  2784. $hadError = true;
  2785. }
  2786. }
  2787. }
  2788. if ($hadError) {
  2789. $io->write('<error>FAIL</error>');
  2790. $this->exitCode = 2;
  2791. } else {
  2792. $io->write('<warning>WARNING</warning>');
  2793. $this->exitCode = 1;
  2794. }
  2795. if ($result) {
  2796. foreach ($result as $message) {
  2797. $io->write($message);
  2798. }
  2799. }
  2800. }
  2801. private function checkPlatform()
  2802. {
  2803. $output = '';
  2804. $out = function ($msg, $style) use (&$output) {
  2805. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2806. };
  2807. $errors = array();
  2808. $warnings = array();
  2809. $displayIniMessage = false;
  2810. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  2811. $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
  2812. if (!function_exists('json_decode')) {
  2813. $errors['json'] = true;
  2814. }
  2815. if (!extension_loaded('Phar')) {
  2816. $errors['phar'] = true;
  2817. }
  2818. if (!extension_loaded('filter')) {
  2819. $errors['filter'] = true;
  2820. }
  2821. if (!extension_loaded('hash')) {
  2822. $errors['hash'] = true;
  2823. }
  2824. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2825. $errors['iconv_mbstring'] = true;
  2826. }
  2827. if (!ini_get('allow_url_fopen')) {
  2828. $errors['allow_url_fopen'] = true;
  2829. }
  2830. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2831. $errors['ioncube'] = ioncube_loader_version();
  2832. }
  2833. if (PHP_VERSION_ID < 50302) {
  2834. $errors['php'] = PHP_VERSION;
  2835. }
  2836. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2837. $warnings['php'] = PHP_VERSION;
  2838. }
  2839. if (!extension_loaded('openssl')) {
  2840. $errors['openssl'] = true;
  2841. }
  2842. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2843. $warnings['openssl_version'] = true;
  2844. }
  2845. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
  2846. $warnings['apc_cli'] = true;
  2847. }
  2848. if (!extension_loaded('zlib')) {
  2849. $warnings['zlib'] = true;
  2850. }
  2851. ob_start();
  2852. phpinfo(INFO_GENERAL);
  2853. $phpinfo = ob_get_clean();
  2854. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  2855. $configure = $match[1];
  2856. if (false !== strpos($configure, '--enable-sigchild')) {
  2857. $warnings['sigchild'] = true;
  2858. }
  2859. if (false !== strpos($configure, '--with-curlwrappers')) {
  2860. $warnings['curlwrappers'] = true;
  2861. }
  2862. }
  2863. if (ini_get('xdebug.profiler_enabled')) {
  2864. $warnings['xdebug_profile'] = true;
  2865. } elseif (extension_loaded('xdebug')) {
  2866. $warnings['xdebug_loaded'] = true;
  2867. }
  2868. if (!empty($errors)) {
  2869. foreach ($errors as $error => $current) {
  2870. switch ($error) {
  2871. case 'json':
  2872. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  2873. $text .= "Install it or recompile php without --disable-json";
  2874. break;
  2875. case 'phar':
  2876. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  2877. $text .= "Install it or recompile php without --disable-phar";
  2878. break;
  2879. case 'filter':
  2880. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  2881. $text .= "Install it or recompile php without --disable-filter";
  2882. break;
  2883. case 'hash':
  2884. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  2885. $text .= "Install it or recompile php without --disable-hash";
  2886. break;
  2887. case 'iconv_mbstring':
  2888. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  2889. $text .= "Install either of them or recompile php without --disable-iconv";
  2890. break;
  2891. case 'unicode':
  2892. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  2893. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2894. $text .= " detect_unicode = Off";
  2895. $displayIniMessage = true;
  2896. break;
  2897. case 'suhosin':
  2898. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  2899. $text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):".PHP_EOL;
  2900. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  2901. $displayIniMessage = true;
  2902. break;
  2903. case 'php':
  2904. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  2905. break;
  2906. case 'allow_url_fopen':
  2907. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  2908. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2909. $text .= " allow_url_fopen = On";
  2910. $displayIniMessage = true;
  2911. break;
  2912. case 'ioncube':
  2913. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  2914. $text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
  2915. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  2916. $displayIniMessage = true;
  2917. break;
  2918. case 'openssl':
  2919. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  2920. $text .= "If possible you should enable it or recompile php with --with-openssl";
  2921. break;
  2922. }
  2923. $out($text, 'error');
  2924. }
  2925. $output .= PHP_EOL;
  2926. }
  2927. if (!empty($warnings)) {
  2928. foreach ($warnings as $warning => $current) {
  2929. switch ($warning) {
  2930. case 'apc_cli':
  2931. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  2932. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  2933. $text .= " apc.enable_cli = Off";
  2934. $displayIniMessage = true;
  2935. break;
  2936. case 'zlib':
  2937. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  2938. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  2939. $displayIniMessage = true;
  2940. break;
  2941. case 'sigchild':
  2942. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  2943. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  2944. $text .= " https://bugs.php.net/bug.php?id=22999";
  2945. break;
  2946. case 'curlwrappers':
  2947. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  2948. $text .= " Recompile it without this flag if possible";
  2949. break;
  2950. case 'php':
  2951. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  2952. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  2953. break;
  2954. case 'openssl_version':
  2955. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  2956. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  2957. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  2958. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  2959. break;
  2960. case 'xdebug_loaded':
  2961. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  2962. $text .= " Disabling it when using Composer is recommended.";
  2963. break;
  2964. case 'xdebug_profile':
  2965. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  2966. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  2967. $text .= " xdebug.profiler_enabled = 0";
  2968. $displayIniMessage = true;
  2969. break;
  2970. }
  2971. $out($text, 'comment');
  2972. }
  2973. }
  2974. if ($displayIniMessage) {
  2975. $out($iniMessage, 'comment');
  2976. }
  2977. return !$warnings && !$errors ? true : $output;
  2978. }
  2979. }
  2980. <?php
  2981. namespace Composer\Command;
  2982. use Composer\Plugin\CommandEvent;
  2983. use Composer\Plugin\PluginEvents;
  2984. use Symfony\Component\Console\Input\InputInterface;
  2985. use Symfony\Component\Console\Input\InputOption;
  2986. use Symfony\Component\Console\Output\OutputInterface;
  2987. class DumpAutoloadCommand extends BaseCommand
  2988. {
  2989. protected function configure()
  2990. {
  2991. $this
  2992. ->setName('dump-autoload')
  2993. ->setAliases(array('dumpautoload'))
  2994. ->setDescription('Dumps the autoloader.')
  2995. ->setDefinition(array(
  2996. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  2997. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  2998. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  2999. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3000. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3001. ))
  3002. ->setHelp(<<<EOT
  3003. <info>php composer.phar dump-autoload</info>
  3004. EOT
  3005. )
  3006. ;
  3007. }
  3008. protected function execute(InputInterface $input, OutputInterface $output)
  3009. {
  3010. $composer = $this->getComposer();
  3011. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3012. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3013. $installationManager = $composer->getInstallationManager();
  3014. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3015. $package = $composer->getPackage();
  3016. $config = $composer->getConfig();
  3017. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3018. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3019. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3020. if ($authoritative) {
  3021. $this->getIO()->writeError('<info>Generating optimized autoload files (authoritative)</info>');
  3022. } elseif ($optimize) {
  3023. $this->getIO()->writeError('<info>Generating optimized autoload files</info>');
  3024. } else {
  3025. $this->getIO()->writeError('<info>Generating autoload files</info>');
  3026. }
  3027. $generator = $composer->getAutoloadGenerator();
  3028. $generator->setDevMode(!$input->getOption('no-dev'));
  3029. $generator->setClassMapAuthoritative($authoritative);
  3030. $generator->setApcu($apcu);
  3031. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3032. $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3033. }
  3034. }
  3035. <?php
  3036. namespace Composer\Command;
  3037. use Symfony\Component\Console\Input\InputInterface;
  3038. use Symfony\Component\Console\Input\InputOption;
  3039. use Symfony\Component\Console\Output\OutputInterface;
  3040. use Symfony\Component\Console\Input\InputArgument;
  3041. class ExecCommand extends BaseCommand
  3042. {
  3043. protected function configure()
  3044. {
  3045. $this
  3046. ->setName('exec')
  3047. ->setDescription('Executes a vendored binary/script.')
  3048. ->setDefinition(array(
  3049. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3050. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3051. new InputArgument(
  3052. 'args',
  3053. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3054. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3055. ),
  3056. ))
  3057. ;
  3058. }
  3059. protected function execute(InputInterface $input, OutputInterface $output)
  3060. {
  3061. $composer = $this->getComposer();
  3062. $binDir = $composer->getConfig()->get('bin-dir');
  3063. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3064. $bins = glob($binDir . '/*');
  3065. $bins = array_merge($bins, array_map(function ($e) {
  3066. return "$e (local)";
  3067. }, $composer->getPackage()->getBinaries()));
  3068. if (!$bins) {
  3069. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3070. }
  3071. $this->getIO()->write(<<<EOT
  3072. <comment>Available binaries:</comment>
  3073. EOT
  3074. );
  3075. foreach ($bins as $bin) {
  3076. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3077. continue;
  3078. }
  3079. $previousBin = $bin;
  3080. $bin = basename($bin);
  3081. $this->getIO()->write(<<<EOT
  3082. <info>- $bin</info>
  3083. EOT
  3084. );
  3085. }
  3086. return 0;
  3087. }
  3088. $binary = $input->getArgument('binary');
  3089. $dispatcher = $composer->getEventDispatcher();
  3090. $dispatcher->addListener('__exec_command', $binary);
  3091. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3092. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3093. }
  3094. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3095. }
  3096. }
  3097. <?php
  3098. namespace Composer\Command;
  3099. use Composer\Factory;
  3100. use Symfony\Component\Console\Input\InputInterface;
  3101. use Symfony\Component\Console\Input\InputArgument;
  3102. use Symfony\Component\Console\Input\StringInput;
  3103. use Symfony\Component\Console\Output\OutputInterface;
  3104. class GlobalCommand extends BaseCommand
  3105. {
  3106. protected function configure()
  3107. {
  3108. $this
  3109. ->setName('global')
  3110. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3111. ->setDefinition(array(
  3112. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3113. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3114. ))
  3115. ->setHelp(<<<EOT
  3116. Use this command as a wrapper to run other Composer commands
  3117. within the global context of COMPOSER_HOME.
  3118. You can use this to install CLI utilities globally, all you need
  3119. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3120. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3121. and /home/<user>/.composer on unix systems.
  3122. If your system uses freedesktop.org standards, then it will first check
  3123. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3124. Note: This path may vary depending on customizations to bin-dir in
  3125. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3126. EOT
  3127. )
  3128. ;
  3129. }
  3130. public function run(InputInterface $input, OutputInterface $output)
  3131. {
  3132. $tokens = preg_split('{\s+}', $input->__toString());
  3133. $args = array();
  3134. foreach ($tokens as $token) {
  3135. if ($token && $token[0] !== '-') {
  3136. $args[] = $token;
  3137. if (count($args) >= 2) {
  3138. break;
  3139. }
  3140. }
  3141. }
  3142. if (count($args) < 2) {
  3143. return parent::run($input, $output);
  3144. }
  3145. $config = Factory::createConfig();
  3146. chdir($config->get('home'));
  3147. $this->getIO()->writeError('<info>Changed current directory to '.$config->get('home').'</info>');
  3148. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3149. $this->getApplication()->resetComposer();
  3150. return $this->getApplication()->run($input, $output);
  3151. }
  3152. public function isProxyCommand()
  3153. {
  3154. return true;
  3155. }
  3156. }
  3157. <?php
  3158. namespace Composer\Command;
  3159. use Composer\Package\CompletePackageInterface;
  3160. use Composer\Repository\RepositoryInterface;
  3161. use Composer\Repository\ArrayRepository;
  3162. use Composer\Repository\RepositoryFactory;
  3163. use Composer\Util\Platform;
  3164. use Composer\Util\ProcessExecutor;
  3165. use Symfony\Component\Console\Input\InputArgument;
  3166. use Symfony\Component\Console\Input\InputOption;
  3167. use Symfony\Component\Console\Input\InputInterface;
  3168. use Symfony\Component\Console\Output\OutputInterface;
  3169. class HomeCommand extends BaseCommand
  3170. {
  3171. protected function configure()
  3172. {
  3173. $this
  3174. ->setName('browse')
  3175. ->setAliases(array('home'))
  3176. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3177. ->setDefinition(array(
  3178. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3179. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3180. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3181. ))
  3182. ->setHelp(<<<EOT
  3183. The home command opens or shows a package's repository URL or
  3184. homepage in your default browser.
  3185. To open the homepage by default, use -H or --homepage.
  3186. To show instead of open the repository or homepage URL, use -s or --show.
  3187. EOT
  3188. );
  3189. }
  3190. protected function execute(InputInterface $input, OutputInterface $output)
  3191. {
  3192. $repos = $this->initializeRepos();
  3193. $io = $this->getIO();
  3194. $return = 0;
  3195. $packages = $input->getArgument('packages');
  3196. if (!$packages) {
  3197. $io->writeError('No package specified, opening homepage for the root package');
  3198. $packages = array($this->getComposer()->getPackage()->getName());
  3199. }
  3200. foreach ($packages as $packageName) {
  3201. $handled = false;
  3202. $packageExists = false;
  3203. foreach ($repos as $repo) {
  3204. foreach ($repo->findPackages($packageName) as $package) {
  3205. $packageExists = true;
  3206. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3207. $handled = true;
  3208. break 2;
  3209. }
  3210. }
  3211. }
  3212. if (!$packageExists) {
  3213. $return = 1;
  3214. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3215. }
  3216. if (!$handled) {
  3217. $return = 1;
  3218. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3219. }
  3220. }
  3221. return $return;
  3222. }
  3223. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3224. {
  3225. $support = $package->getSupport();
  3226. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3227. if (!$url || $showHomepage) {
  3228. $url = $package->getHomepage();
  3229. }
  3230. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3231. return false;
  3232. }
  3233. if ($showOnly) {
  3234. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3235. } else {
  3236. $this->openBrowser($url);
  3237. }
  3238. return true;
  3239. }
  3240. private function openBrowser($url)
  3241. {
  3242. $url = ProcessExecutor::escape($url);
  3243. $process = new ProcessExecutor($this->getIO());
  3244. if (Platform::isWindows()) {
  3245. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3246. }
  3247. $linux = $process->execute('which xdg-open', $output);
  3248. $osx = $process->execute('which open', $output);
  3249. if (0 === $linux) {
  3250. $process->execute('xdg-open ' . $url, $output);
  3251. } elseif (0 === $osx) {
  3252. $process->execute('open ' . $url, $output);
  3253. } else {
  3254. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3255. }
  3256. }
  3257. private function initializeRepos()
  3258. {
  3259. $composer = $this->getComposer(false);
  3260. if ($composer) {
  3261. return array_merge(
  3262. array(new ArrayRepository(array($composer->getPackage()))),
  3263. array($composer->getRepositoryManager()->getLocalRepository()),
  3264. $composer->getRepositoryManager()->getRepositories()
  3265. );
  3266. }
  3267. return RepositoryFactory::defaultRepos($this->getIO());
  3268. }
  3269. }
  3270. <?php
  3271. namespace Composer\Command;
  3272. use Composer\DependencyResolver\Pool;
  3273. use Composer\Factory;
  3274. use Composer\Json\JsonFile;
  3275. use Composer\Package\BasePackage;
  3276. use Composer\Package\Version\VersionParser;
  3277. use Composer\Package\Version\VersionSelector;
  3278. use Composer\Repository\CompositeRepository;
  3279. use Composer\Repository\PlatformRepository;
  3280. use Composer\Repository\RepositoryFactory;
  3281. use Composer\Util\ProcessExecutor;
  3282. use Symfony\Component\Console\Input\InputInterface;
  3283. use Symfony\Component\Console\Input\InputOption;
  3284. use Symfony\Component\Console\Output\OutputInterface;
  3285. use Symfony\Component\Process\ExecutableFinder;
  3286. use Symfony\Component\Process\Process;
  3287. class InitCommand extends BaseCommand
  3288. {
  3289. protected $repos;
  3290. private $gitConfig;
  3291. private $pools;
  3292. protected function configure()
  3293. {
  3294. $this
  3295. ->setName('init')
  3296. ->setDescription('Creates a basic composer.json file in current directory.')
  3297. ->setDefinition(array(
  3298. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3299. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3300. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3301. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3302. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3303. new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3304. new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3305. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3306. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3307. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3308. ))
  3309. ->setHelp(<<<EOT
  3310. The <info>init</info> command creates a basic composer.json file
  3311. in the current directory.
  3312. <info>php composer.phar init</info>
  3313. EOT
  3314. )
  3315. ;
  3316. }
  3317. protected function execute(InputInterface $input, OutputInterface $output)
  3318. {
  3319. $io = $this->getIO();
  3320. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3321. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3322. if (isset($options['author'])) {
  3323. $options['authors'] = $this->formatAuthors($options['author']);
  3324. unset($options['author']);
  3325. }
  3326. $repositories = $input->getOption('repository');
  3327. if ($repositories) {
  3328. $config = Factory::createConfig($io);
  3329. foreach ($repositories as $repo) {
  3330. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3331. }
  3332. }
  3333. if (isset($options['stability'])) {
  3334. $options['minimum-stability'] = $options['stability'];
  3335. unset($options['stability']);
  3336. }
  3337. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3338. if (array() === $options['require']) {
  3339. $options['require'] = new \stdClass;
  3340. }
  3341. if (isset($options['require-dev'])) {
  3342. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3343. if (array() === $options['require-dev']) {
  3344. $options['require-dev'] = new \stdClass;
  3345. }
  3346. }
  3347. $file = new JsonFile(Factory::getComposerFile());
  3348. $json = $file->encode($options);
  3349. if ($input->isInteractive()) {
  3350. $io->writeError(array('', $json, ''));
  3351. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3352. $io->writeError('<error>Command aborted</error>');
  3353. return 1;
  3354. }
  3355. }
  3356. $file->write($options);
  3357. if ($input->isInteractive() && is_dir('.git')) {
  3358. $ignoreFile = realpath('.gitignore');
  3359. if (false === $ignoreFile) {
  3360. $ignoreFile = realpath('.') . '/.gitignore';
  3361. }
  3362. if (!$this->hasVendorIgnore($ignoreFile)) {
  3363. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3364. if ($io->askConfirmation($question, true)) {
  3365. $this->addVendorIgnore($ignoreFile);
  3366. }
  3367. }
  3368. }
  3369. }
  3370. protected function interact(InputInterface $input, OutputInterface $output)
  3371. {
  3372. $git = $this->getGitConfig();
  3373. $io = $this->getIO();
  3374. $formatter = $this->getHelperSet()->get('formatter');
  3375. $repositories = $input->getOption('repository');
  3376. if ($repositories) {
  3377. $config = Factory::createConfig($io);
  3378. $repos = array(new PlatformRepository);
  3379. foreach ($repositories as $repo) {
  3380. $repos[] = RepositoryFactory::fromString($io, $config, $repo);
  3381. }
  3382. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3383. 'type' => 'composer',
  3384. 'url' => 'https://packagist.org',
  3385. ));
  3386. $this->repos = new CompositeRepository($repos);
  3387. unset($repos, $config, $repositories);
  3388. }
  3389. $io->writeError(array(
  3390. '',
  3391. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3392. '',
  3393. ));
  3394. $io->writeError(array(
  3395. '',
  3396. 'This command will guide you through creating your composer.json config.',
  3397. '',
  3398. ));
  3399. $cwd = realpath(".");
  3400. if (!$name = $input->getOption('name')) {
  3401. $name = basename($cwd);
  3402. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3403. $name = strtolower($name);
  3404. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3405. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3406. } elseif (isset($git['github.user'])) {
  3407. $name = $git['github.user'] . '/' . $name;
  3408. } elseif (!empty($_SERVER['USERNAME'])) {
  3409. $name = $_SERVER['USERNAME'] . '/' . $name;
  3410. } elseif (!empty($_SERVER['USER'])) {
  3411. $name = $_SERVER['USER'] . '/' . $name;
  3412. } elseif (get_current_user()) {
  3413. $name = get_current_user() . '/' . $name;
  3414. } else {
  3415. $name = $name . '/' . $name;
  3416. }
  3417. $name = strtolower($name);
  3418. } else {
  3419. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) {
  3420. throw new \InvalidArgumentException(
  3421. 'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3422. );
  3423. }
  3424. }
  3425. $name = $io->askAndValidate(
  3426. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3427. function ($value) use ($name) {
  3428. if (null === $value) {
  3429. return $name;
  3430. }
  3431. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $value)) {
  3432. throw new \InvalidArgumentException(
  3433. 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3434. );
  3435. }
  3436. return $value;
  3437. },
  3438. null,
  3439. $name
  3440. );
  3441. $input->setOption('name', $name);
  3442. $description = $input->getOption('description') ?: false;
  3443. $description = $io->ask(
  3444. 'Description [<comment>'.$description.'</comment>]: ',
  3445. $description
  3446. );
  3447. $input->setOption('description', $description);
  3448. if (null === $author = $input->getOption('author')) {
  3449. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3450. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3451. } elseif (isset($git['user.name'])) {
  3452. $author_name = $git['user.name'];
  3453. }
  3454. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3455. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3456. } elseif (isset($git['user.email'])) {
  3457. $author_email = $git['user.email'];
  3458. }
  3459. if (isset($author_name) && isset($author_email)) {
  3460. $author = sprintf('%s <%s>', $author_name, $author_email);
  3461. }
  3462. }
  3463. $self = $this;
  3464. $author = $io->askAndValidate(
  3465. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3466. function ($value) use ($self, $author) {
  3467. if ($value === 'n' || $value === 'no') {
  3468. return;
  3469. }
  3470. $value = $value ?: $author;
  3471. $author = $self->parseAuthorString($value);
  3472. return sprintf('%s <%s>', $author['name'], $author['email']);
  3473. },
  3474. null,
  3475. $author
  3476. );
  3477. $input->setOption('author', $author);
  3478. $minimumStability = $input->getOption('stability') ?: null;
  3479. $minimumStability = $io->askAndValidate(
  3480. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3481. function ($value) use ($self, $minimumStability) {
  3482. if (null === $value) {
  3483. return $minimumStability;
  3484. }
  3485. if (!isset(BasePackage::$stabilities[$value])) {
  3486. throw new \InvalidArgumentException(
  3487. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3488. implode(', ', array_keys(BasePackage::$stabilities))
  3489. );
  3490. }
  3491. return $value;
  3492. },
  3493. null,
  3494. $minimumStability
  3495. );
  3496. $input->setOption('stability', $minimumStability);
  3497. $type = $input->getOption('type') ?: false;
  3498. $type = $io->ask(
  3499. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3500. $type
  3501. );
  3502. $input->setOption('type', $type);
  3503. if (null === $license = $input->getOption('license')) {
  3504. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3505. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3506. }
  3507. }
  3508. $license = $io->ask(
  3509. 'License [<comment>'.$license.'</comment>]: ',
  3510. $license
  3511. );
  3512. $input->setOption('license', $license);
  3513. $io->writeError(array('', 'Define your dependencies.', ''));
  3514. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3515. $require = $input->getOption('require');
  3516. $requirements = array();
  3517. if ($require || $io->askConfirmation($question, true)) {
  3518. $requirements = $this->determineRequirements($input, $output, $require);
  3519. }
  3520. $input->setOption('require', $requirements);
  3521. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3522. $requireDev = $input->getOption('require-dev');
  3523. $devRequirements = array();
  3524. if ($requireDev || $io->askConfirmation($question, true)) {
  3525. $devRequirements = $this->determineRequirements($input, $output, $requireDev);
  3526. }
  3527. $input->setOption('require-dev', $devRequirements);
  3528. }
  3529. public function parseAuthorString($author)
  3530. {
  3531. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3532. if ($this->isValidEmail($match['email'])) {
  3533. return array(
  3534. 'name' => trim($match['name']),
  3535. 'email' => $match['email'],
  3536. );
  3537. }
  3538. }
  3539. throw new \InvalidArgumentException(
  3540. 'Invalid author string. Must be in the format: '.
  3541. 'John Smith <john@example.com>'
  3542. );
  3543. }
  3544. protected function findPackages($name)
  3545. {
  3546. return $this->getRepos()->search($name);
  3547. }
  3548. protected function getRepos()
  3549. {
  3550. if (!$this->repos) {
  3551. $this->repos = new CompositeRepository(array_merge(
  3552. array(new PlatformRepository),
  3553. RepositoryFactory::defaultRepos($this->getIO())
  3554. ));
  3555. }
  3556. return $this->repos;
  3557. }
  3558. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable')
  3559. {
  3560. if ($requires) {
  3561. $requires = $this->normalizeRequirements($requires);
  3562. $result = array();
  3563. $io = $this->getIO();
  3564. foreach ($requires as $requirement) {
  3565. if (!isset($requirement['version'])) {
  3566. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability);
  3567. $requirement['version'] = $version;
  3568. $requirement['name'] = $name;
  3569. $io->writeError(sprintf(
  3570. 'Using version <info>%s</info> for <info>%s</info>',
  3571. $requirement['version'],
  3572. $requirement['name']
  3573. ));
  3574. } else {
  3575. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $requirement['version'], 'dev');
  3576. $requirement['name'] = $name;
  3577. }
  3578. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3579. }
  3580. return $result;
  3581. }
  3582. $versionParser = new VersionParser();
  3583. $io = $this->getIO();
  3584. while (null !== $package = $io->ask('Search for a package: ')) {
  3585. $matches = $this->findPackages($package);
  3586. if (count($matches)) {
  3587. $exactMatch = null;
  3588. $choices = array();
  3589. foreach ($matches as $position => $foundPackage) {
  3590. $abandoned = '';
  3591. if (isset($foundPackage['abandoned'])) {
  3592. if (is_string($foundPackage['abandoned'])) {
  3593. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  3594. } else {
  3595. $replacement = 'No replacement was suggested';
  3596. }
  3597. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  3598. }
  3599. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  3600. if ($foundPackage['name'] === $package) {
  3601. $exactMatch = true;
  3602. break;
  3603. }
  3604. }
  3605. if (!$exactMatch) {
  3606. $io->writeError(array(
  3607. '',
  3608. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3609. '',
  3610. ));
  3611. $io->writeError($choices);
  3612. $io->writeError('');
  3613. $validator = function ($selection) use ($matches, $versionParser) {
  3614. if ('' === $selection) {
  3615. return false;
  3616. }
  3617. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3618. $package = $matches[(int) $selection];
  3619. return $package['name'];
  3620. }
  3621. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3622. if (isset($packageMatches['version'])) {
  3623. $versionParser->parseConstraints($packageMatches['version']);
  3624. return $packageMatches['name'].' '.$packageMatches['version'];
  3625. }
  3626. return $packageMatches['name'];
  3627. }
  3628. throw new \Exception('Not a valid selection');
  3629. };
  3630. $package = $io->askAndValidate(
  3631. 'Enter package # to add, or the complete package name if it is not listed: ',
  3632. $validator,
  3633. 3,
  3634. false
  3635. );
  3636. }
  3637. if (false !== $package && false === strpos($package, ' ')) {
  3638. $validator = function ($input) {
  3639. $input = trim($input);
  3640. return $input ?: false;
  3641. };
  3642. $constraint = $io->askAndValidate(
  3643. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3644. $validator,
  3645. 3,
  3646. false
  3647. );
  3648. if (false === $constraint) {
  3649. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  3650. $io->writeError(sprintf(
  3651. 'Using version <info>%s</info> for <info>%s</info>',
  3652. $constraint,
  3653. $package
  3654. ));
  3655. }
  3656. $package .= ' '.$constraint;
  3657. }
  3658. if (false !== $package) {
  3659. $requires[] = $package;
  3660. }
  3661. }
  3662. }
  3663. return $requires;
  3664. }
  3665. protected function formatAuthors($author)
  3666. {
  3667. return array($this->parseAuthorString($author));
  3668. }
  3669. protected function formatRequirements(array $requirements)
  3670. {
  3671. $requires = array();
  3672. $requirements = $this->normalizeRequirements($requirements);
  3673. foreach ($requirements as $requirement) {
  3674. $requires[$requirement['name']] = $requirement['version'];
  3675. }
  3676. return $requires;
  3677. }
  3678. protected function getGitConfig()
  3679. {
  3680. if (null !== $this->gitConfig) {
  3681. return $this->gitConfig;
  3682. }
  3683. $finder = new ExecutableFinder();
  3684. $gitBin = $finder->find('git');
  3685. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3686. $cmd->run();
  3687. if ($cmd->isSuccessful()) {
  3688. $this->gitConfig = array();
  3689. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3690. foreach ($matches as $match) {
  3691. $this->gitConfig[$match[1]] = $match[2];
  3692. }
  3693. return $this->gitConfig;
  3694. }
  3695. return $this->gitConfig = array();
  3696. }
  3697. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3698. {
  3699. if (!file_exists($ignoreFile)) {
  3700. return false;
  3701. }
  3702. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3703. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3704. foreach ($lines as $line) {
  3705. if (preg_match($pattern, $line)) {
  3706. return true;
  3707. }
  3708. }
  3709. return false;
  3710. }
  3711. protected function normalizeRequirements(array $requirements)
  3712. {
  3713. $parser = new VersionParser();
  3714. return $parser->parseNameVersionPairs($requirements);
  3715. }
  3716. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3717. {
  3718. $contents = "";
  3719. if (file_exists($ignoreFile)) {
  3720. $contents = file_get_contents($ignoreFile);
  3721. if ("\n" !== substr($contents, 0, -1)) {
  3722. $contents .= "\n";
  3723. }
  3724. }
  3725. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3726. }
  3727. protected function isValidEmail($email)
  3728. {
  3729. if (!function_exists('filter_var')) {
  3730. return true;
  3731. }
  3732. if (PHP_VERSION_ID < 50303) {
  3733. return true;
  3734. }
  3735. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3736. }
  3737. private function getPool(InputInterface $input, $minimumStability = null)
  3738. {
  3739. $key = $minimumStability ?: 'default';
  3740. if (!isset($this->pools[$key])) {
  3741. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  3742. $pool->addRepository($this->getRepos());
  3743. }
  3744. return $this->pools[$key];
  3745. }
  3746. private function getMinimumStability(InputInterface $input)
  3747. {
  3748. if ($input->hasOption('stability')) {
  3749. return $input->getOption('stability') ?: 'stable';
  3750. }
  3751. $file = Factory::getComposerFile();
  3752. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3753. if (!empty($composer['minimum-stability'])) {
  3754. return $composer['minimum-stability'];
  3755. }
  3756. }
  3757. return 'stable';
  3758. }
  3759. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null)
  3760. {
  3761. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  3762. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3763. if ($input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs')) {
  3764. $phpVersion = null;
  3765. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3766. }
  3767. if (!$package) {
  3768. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  3769. throw new \InvalidArgumentException(sprintf(
  3770. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)', $name, $requiredVersion, $phpVersion
  3771. ));
  3772. }
  3773. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  3774. throw new \InvalidArgumentException(sprintf(
  3775. 'Could not find package %s in a version matching %s', $name, $requiredVersion
  3776. ));
  3777. }
  3778. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  3779. throw new \InvalidArgumentException(sprintf(
  3780. 'Could not find package %s in any version matching your PHP version (%s)', $name, $phpVersion
  3781. ));
  3782. }
  3783. $similar = $this->findSimilar($name);
  3784. if ($similar) {
  3785. if ($requiredVersion === null && in_array($name, $similar, true)) {
  3786. throw new \InvalidArgumentException(sprintf(
  3787. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  3788. $name,
  3789. $this->getMinimumStability($input)
  3790. ));
  3791. }
  3792. throw new \InvalidArgumentException(sprintf(
  3793. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  3794. $name,
  3795. implode("\n ", $similar)
  3796. ));
  3797. }
  3798. throw new \InvalidArgumentException(sprintf(
  3799. 'Could not find a matching version of package %s. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (%s).',
  3800. $name,
  3801. $this->getMinimumStability($input)
  3802. ));
  3803. }
  3804. return array(
  3805. $package->getPrettyName(),
  3806. $versionSelector->findRecommendedRequireVersion($package)
  3807. );
  3808. }
  3809. private function findSimilar($package)
  3810. {
  3811. try {
  3812. $results = $this->repos->search($package);
  3813. } catch (\Exception $e) {
  3814. return array();
  3815. }
  3816. $similarPackages = array();
  3817. foreach ($results as $result) {
  3818. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  3819. }
  3820. asort($similarPackages);
  3821. return array_keys(array_slice($similarPackages, 0, 5));
  3822. }
  3823. }
  3824. <?php
  3825. namespace Composer\Command;
  3826. use Composer\Installer;
  3827. use Composer\Plugin\CommandEvent;
  3828. use Composer\Plugin\PluginEvents;
  3829. use Symfony\Component\Console\Input\InputInterface;
  3830. use Symfony\Component\Console\Input\InputOption;
  3831. use Symfony\Component\Console\Input\InputArgument;
  3832. use Symfony\Component\Console\Output\OutputInterface;
  3833. class InstallCommand extends BaseCommand
  3834. {
  3835. protected function configure()
  3836. {
  3837. $this
  3838. ->setName('install')
  3839. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  3840. ->setDefinition(array(
  3841. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  3842. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  3843. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  3844. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  3845. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  3846. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  3847. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  3848. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3849. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  3850. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  3851. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  3852. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  3853. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  3854. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3855. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  3856. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  3857. ))
  3858. ->setHelp(<<<EOT
  3859. The <info>install</info> command reads the composer.lock file from
  3860. the current directory, processes it, and downloads and installs all the
  3861. libraries and dependencies outlined in that file. If the file does not
  3862. exist it will look for composer.json and do the same.
  3863. <info>php composer.phar install</info>
  3864. EOT
  3865. )
  3866. ;
  3867. }
  3868. protected function execute(InputInterface $input, OutputInterface $output)
  3869. {
  3870. $io = $this->getIO();
  3871. if ($args = $input->getArgument('packages')) {
  3872. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  3873. return 1;
  3874. }
  3875. if ($input->getOption('no-custom-installers')) {
  3876. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  3877. $input->setOption('no-plugins', true);
  3878. }
  3879. if ($input->getOption('dev')) {
  3880. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  3881. }
  3882. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  3883. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  3884. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  3885. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3886. $install = Installer::create($io, $composer);
  3887. $config = $composer->getConfig();
  3888. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  3889. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  3890. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3891. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  3892. $install
  3893. ->setDryRun($input->getOption('dry-run'))
  3894. ->setVerbose($input->getOption('verbose'))
  3895. ->setPreferSource($preferSource)
  3896. ->setPreferDist($preferDist)
  3897. ->setDevMode(!$input->getOption('no-dev'))
  3898. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  3899. ->setRunScripts(!$input->getOption('no-scripts'))
  3900. ->setSkipSuggest($input->getOption('no-suggest'))
  3901. ->setOptimizeAutoloader($optimize)
  3902. ->setClassMapAuthoritative($authoritative)
  3903. ->setApcuAutoloader($apcu)
  3904. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  3905. ;
  3906. if ($input->getOption('no-plugins')) {
  3907. $install->disablePlugins();
  3908. }
  3909. return $install->run();
  3910. }
  3911. }
  3912. <?php
  3913. namespace Composer\Command;
  3914. use Composer\Json\JsonFile;
  3915. use Composer\Plugin\CommandEvent;
  3916. use Composer\Plugin\PluginEvents;
  3917. use Composer\Package\PackageInterface;
  3918. use Composer\Repository\RepositoryInterface;
  3919. use Symfony\Component\Console\Helper\Table;
  3920. use Symfony\Component\Console\Input\InputInterface;
  3921. use Symfony\Component\Console\Input\InputOption;
  3922. use Symfony\Component\Console\Output\OutputInterface;
  3923. class LicensesCommand extends BaseCommand
  3924. {
  3925. protected function configure()
  3926. {
  3927. $this
  3928. ->setName('licenses')
  3929. ->setDescription('Shows information about licenses of dependencies.')
  3930. ->setDefinition(array(
  3931. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  3932. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  3933. ))
  3934. ->setHelp(<<<EOT
  3935. The license command displays detailed information about the licenses of
  3936. the installed dependencies.
  3937. EOT
  3938. )
  3939. ;
  3940. }
  3941. protected function execute(InputInterface $input, OutputInterface $output)
  3942. {
  3943. $composer = $this->getComposer();
  3944. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  3945. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3946. $root = $composer->getPackage();
  3947. $repo = $composer->getRepositoryManager()->getLocalRepository();
  3948. if ($input->getOption('no-dev')) {
  3949. $packages = $this->filterRequiredPackages($repo, $root);
  3950. } else {
  3951. $packages = $this->appendPackages($repo->getPackages(), array());
  3952. }
  3953. ksort($packages);
  3954. $io = $this->getIO();
  3955. switch ($format = $input->getOption('format')) {
  3956. case 'text':
  3957. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  3958. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  3959. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  3960. $io->write('Dependencies:');
  3961. $io->write('');
  3962. $table = new Table($output);
  3963. $table->setStyle('compact');
  3964. $table->getStyle()->setVerticalBorderChar('');
  3965. $table->getStyle()->setCellRowContentFormat('%s ');
  3966. $table->setHeaders(array('Name', 'Version', 'License'));
  3967. foreach ($packages as $package) {
  3968. $table->addRow(array(
  3969. $package->getPrettyName(),
  3970. $package->getFullPrettyVersion(),
  3971. implode(', ', $package->getLicense()) ?: 'none',
  3972. ));
  3973. }
  3974. $table->render();
  3975. break;
  3976. case 'json':
  3977. $dependencies = array();
  3978. foreach ($packages as $package) {
  3979. $dependencies[$package->getPrettyName()] = array(
  3980. 'version' => $package->getFullPrettyVersion(),
  3981. 'license' => $package->getLicense(),
  3982. );
  3983. }
  3984. $io->write(JsonFile::encode(array(
  3985. 'name' => $root->getPrettyName(),
  3986. 'version' => $root->getFullPrettyVersion(),
  3987. 'license' => $root->getLicense(),
  3988. 'dependencies' => $dependencies,
  3989. )));
  3990. break;
  3991. default:
  3992. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  3993. }
  3994. }
  3995. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  3996. {
  3997. $requires = array_keys($package->getRequires());
  3998. $packageListNames = array_keys($bucket);
  3999. $packages = array_filter(
  4000. $repo->getPackages(),
  4001. function ($package) use ($requires, $packageListNames) {
  4002. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4003. }
  4004. );
  4005. $bucket = $this->appendPackages($packages, $bucket);
  4006. foreach ($packages as $package) {
  4007. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4008. }
  4009. return $bucket;
  4010. }
  4011. public function appendPackages(array $packages, array $bucket)
  4012. {
  4013. foreach ($packages as $package) {
  4014. $bucket[$package->getName()] = $package;
  4015. }
  4016. return $bucket;
  4017. }
  4018. }
  4019. <?php
  4020. namespace Composer\Command;
  4021. use Symfony\Component\Console\Input\InputInterface;
  4022. use Symfony\Component\Console\Input\InputArgument;
  4023. use Symfony\Component\Console\Input\ArrayInput;
  4024. use Symfony\Component\Console\Input\InputOption;
  4025. use Symfony\Component\Console\Output\OutputInterface;
  4026. class OutdatedCommand extends ShowCommand
  4027. {
  4028. protected function configure()
  4029. {
  4030. $this
  4031. ->setName('outdated')
  4032. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4033. ->setDefinition(array(
  4034. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4035. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4036. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4037. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4038. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4039. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4040. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4041. ))
  4042. ->setHelp(<<<EOT
  4043. The outdated command is just a proxy for `composer show -l`
  4044. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4045. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4046. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4047. compatibility breaks according to semver, so upgrade when you can but it
  4048. may involve work.
  4049. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4050. EOT
  4051. )
  4052. ;
  4053. }
  4054. protected function execute(InputInterface $input, OutputInterface $output)
  4055. {
  4056. $args = array(
  4057. 'show',
  4058. '--latest' => true,
  4059. );
  4060. if (!$input->getOption('all')) {
  4061. $args['--outdated'] = true;
  4062. }
  4063. if ($input->getOption('direct')) {
  4064. $args['--direct'] = true;
  4065. }
  4066. if ($input->getArgument('package')) {
  4067. $args['package'] = $input->getArgument('package');
  4068. }
  4069. if ($input->getOption('strict')) {
  4070. $args['--strict'] = true;
  4071. }
  4072. if ($input->getOption('minor-only')) {
  4073. $args['--minor-only'] = true;
  4074. }
  4075. $args['--format'] = $input->getOption('format');
  4076. $input = new ArrayInput($args);
  4077. return $this->getApplication()->run($input, $output);
  4078. }
  4079. public function isProxyCommand()
  4080. {
  4081. return true;
  4082. }
  4083. }
  4084. <?php
  4085. namespace Composer\Command;
  4086. use Symfony\Component\Console\Input\InputInterface;
  4087. use Symfony\Component\Console\Output\OutputInterface;
  4088. class ProhibitsCommand extends BaseDependencyCommand
  4089. {
  4090. protected function configure()
  4091. {
  4092. parent::configure();
  4093. $this
  4094. ->setName('prohibits')
  4095. ->setAliases(array('why-not'))
  4096. ->setDescription('Shows which packages prevent the given package from being installed.')
  4097. ->setHelp(<<<EOT
  4098. Displays detailed information about why a package cannot be installed.
  4099. <info>php composer.phar prohibits composer/composer</info>
  4100. EOT
  4101. )
  4102. ;
  4103. }
  4104. protected function execute(InputInterface $input, OutputInterface $output)
  4105. {
  4106. return parent::doExecute($input, $output, true);
  4107. }
  4108. }
  4109. <?php
  4110. namespace Composer\Command;
  4111. use Composer\Config\JsonConfigSource;
  4112. use Composer\Installer;
  4113. use Composer\Plugin\CommandEvent;
  4114. use Composer\Plugin\PluginEvents;
  4115. use Composer\Json\JsonFile;
  4116. use Composer\Factory;
  4117. use Symfony\Component\Console\Input\InputInterface;
  4118. use Symfony\Component\Console\Input\InputOption;
  4119. use Symfony\Component\Console\Input\InputArgument;
  4120. use Symfony\Component\Console\Output\OutputInterface;
  4121. class RemoveCommand extends BaseCommand
  4122. {
  4123. protected function configure()
  4124. {
  4125. $this
  4126. ->setName('remove')
  4127. ->setDescription('Removes a package from the require or require-dev.')
  4128. ->setDefinition(array(
  4129. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4130. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4131. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4132. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4133. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4134. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4135. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4136. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4137. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4138. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4139. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4140. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4141. ))
  4142. ->setHelp(<<<EOT
  4143. The <info>remove</info> command removes a package from the current
  4144. list of installed packages
  4145. <info>php composer.phar remove</info>
  4146. EOT
  4147. )
  4148. ;
  4149. }
  4150. protected function execute(InputInterface $input, OutputInterface $output)
  4151. {
  4152. $packages = $input->getArgument('packages');
  4153. $packages = array_map('strtolower', $packages);
  4154. $file = Factory::getComposerFile();
  4155. $jsonFile = new JsonFile($file);
  4156. $composer = $jsonFile->read();
  4157. $composerBackup = file_get_contents($jsonFile->getPath());
  4158. $json = new JsonConfigSource($jsonFile);
  4159. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4160. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4161. $io = $this->getIO();
  4162. if ($input->getOption('update-with-dependencies')) {
  4163. $io->writeError('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>');
  4164. }
  4165. foreach (array('require', 'require-dev') as $linkType) {
  4166. if (isset($composer[$linkType])) {
  4167. foreach ($composer[$linkType] as $name => $version) {
  4168. $composer[$linkType][strtolower($name)] = $name;
  4169. }
  4170. }
  4171. }
  4172. foreach ($packages as $package) {
  4173. if (isset($composer[$type][$package])) {
  4174. $json->removeLink($type, $composer[$type][$package]);
  4175. } elseif (isset($composer[$altType][$package])) {
  4176. $io->writeError('<warning>'.$composer[$altType][$package].' could not be found in '.$type.' but it is present in '.$altType.'</warning>');
  4177. if ($io->isInteractive()) {
  4178. if ($io->askConfirmation('Do you want to remove it from '.$altType.' [<comment>yes</comment>]? ', true)) {
  4179. $json->removeLink($altType, $composer[$altType][$package]);
  4180. }
  4181. }
  4182. } else {
  4183. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4184. }
  4185. }
  4186. if ($input->getOption('no-update')) {
  4187. return 0;
  4188. }
  4189. $this->resetComposer();
  4190. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4191. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4192. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4193. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4194. $install = Installer::create($io, $composer);
  4195. $updateDevMode = !$input->getOption('update-no-dev');
  4196. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4197. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4198. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4199. $install
  4200. ->setVerbose($input->getOption('verbose'))
  4201. ->setDevMode($updateDevMode)
  4202. ->setOptimizeAutoloader($optimize)
  4203. ->setClassMapAuthoritative($authoritative)
  4204. ->setApcuAutoloader($apcu)
  4205. ->setUpdate(true)
  4206. ->setUpdateWhitelist($packages)
  4207. ->setWhitelistTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4208. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4209. ->setRunScripts(!$input->getOption('no-scripts'))
  4210. ;
  4211. $status = $install->run();
  4212. if ($status !== 0) {
  4213. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4214. file_put_contents($jsonFile->getPath(), $composerBackup);
  4215. }
  4216. return $status;
  4217. }
  4218. }
  4219. <?php
  4220. namespace Composer\Command;
  4221. use Symfony\Component\Console\Input\InputInterface;
  4222. use Symfony\Component\Console\Input\InputArgument;
  4223. use Symfony\Component\Console\Input\InputOption;
  4224. use Symfony\Component\Console\Output\OutputInterface;
  4225. use Composer\Factory;
  4226. use Composer\Installer;
  4227. use Composer\Json\JsonFile;
  4228. use Composer\Json\JsonManipulator;
  4229. use Composer\Package\Version\VersionParser;
  4230. use Composer\Plugin\CommandEvent;
  4231. use Composer\Plugin\PluginEvents;
  4232. use Composer\Repository\CompositeRepository;
  4233. use Composer\Repository\PlatformRepository;
  4234. class RequireCommand extends InitCommand
  4235. {
  4236. protected function configure()
  4237. {
  4238. $this
  4239. ->setName('require')
  4240. ->setDescription('Adds required packages to your composer.json and installs them.')
  4241. ->setDefinition(array(
  4242. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name can also include a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  4243. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4244. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4245. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4246. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4247. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4248. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4249. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4250. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4251. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4252. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4253. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4254. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4255. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4256. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4257. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4258. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4259. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4260. ))
  4261. ->setHelp(<<<EOT
  4262. The require command adds required packages to your composer.json and installs them.
  4263. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4264. matches to require.
  4265. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4266. If you do not want to install the new dependencies immediately you can call it with --no-update
  4267. EOT
  4268. )
  4269. ;
  4270. }
  4271. protected function execute(InputInterface $input, OutputInterface $output)
  4272. {
  4273. $file = Factory::getComposerFile();
  4274. $io = $this->getIO();
  4275. $newlyCreated = !file_exists($file);
  4276. if ($newlyCreated && !file_put_contents($file, "{\n}\n")) {
  4277. $io->writeError('<error>'.$file.' could not be created.</error>');
  4278. return 1;
  4279. }
  4280. if (!is_readable($file)) {
  4281. $io->writeError('<error>'.$file.' is not readable.</error>');
  4282. return 1;
  4283. }
  4284. if (!is_writable($file)) {
  4285. $io->writeError('<error>'.$file.' is not writable.</error>');
  4286. return 1;
  4287. }
  4288. if (filesize($file) === 0) {
  4289. file_put_contents($file, "{\n}\n");
  4290. }
  4291. $json = new JsonFile($file);
  4292. $composerBackup = file_get_contents($json->getPath());
  4293. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4294. $repos = $composer->getRepositoryManager()->getRepositories();
  4295. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4296. $this->repos = new CompositeRepository(array_merge(
  4297. array(new PlatformRepository(array(), $platformOverrides)),
  4298. $repos
  4299. ));
  4300. if ($composer->getPackage()->getPreferStable()) {
  4301. $preferredStability = 'stable';
  4302. } else {
  4303. $preferredStability = $composer->getPackage()->getMinimumStability();
  4304. }
  4305. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4306. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability);
  4307. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4308. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4309. $requirements = $this->formatRequirements($requirements);
  4310. $versionParser = new VersionParser();
  4311. foreach ($requirements as $constraint) {
  4312. $versionParser->parseConstraints($constraint);
  4313. }
  4314. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4315. if (!$this->updateFileCleanly($json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4316. $composerDefinition = $json->read();
  4317. foreach ($requirements as $package => $version) {
  4318. $composerDefinition[$requireKey][$package] = $version;
  4319. unset($composerDefinition[$removeKey][$package]);
  4320. }
  4321. $json->write($composerDefinition);
  4322. }
  4323. $io->writeError('<info>'.$file.' has been '.($newlyCreated ? 'created' : 'updated').'</info>');
  4324. if ($input->getOption('no-update')) {
  4325. return 0;
  4326. }
  4327. $updateDevMode = !$input->getOption('update-no-dev');
  4328. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4329. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4330. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4331. $this->resetComposer();
  4332. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4333. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4334. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4335. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4336. $install = Installer::create($io, $composer);
  4337. $install
  4338. ->setVerbose($input->getOption('verbose'))
  4339. ->setPreferSource($input->getOption('prefer-source'))
  4340. ->setPreferDist($input->getOption('prefer-dist'))
  4341. ->setDevMode($updateDevMode)
  4342. ->setRunScripts(!$input->getOption('no-scripts'))
  4343. ->setSkipSuggest($input->getOption('no-suggest'))
  4344. ->setOptimizeAutoloader($optimize)
  4345. ->setClassMapAuthoritative($authoritative)
  4346. ->setApcuAutoloader($apcu)
  4347. ->setUpdate(true)
  4348. ->setUpdateWhitelist(array_keys($requirements))
  4349. ->setWhitelistTransitiveDependencies($input->getOption('update-with-dependencies'))
  4350. ->setWhitelistAllDependencies($input->getOption('update-with-all-dependencies'))
  4351. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4352. ->setPreferStable($input->getOption('prefer-stable'))
  4353. ->setPreferLowest($input->getOption('prefer-lowest'))
  4354. ;
  4355. $status = $install->run();
  4356. if ($status !== 0) {
  4357. if ($newlyCreated) {
  4358. $io->writeError("\n".'<error>Installation failed, deleting '.$file.'.</error>');
  4359. unlink($json->getPath());
  4360. } else {
  4361. $io->writeError("\n".'<error>Installation failed, reverting '.$file.' to its original content.</error>');
  4362. file_put_contents($json->getPath(), $composerBackup);
  4363. }
  4364. }
  4365. return $status;
  4366. }
  4367. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4368. {
  4369. $contents = file_get_contents($json->getPath());
  4370. $manipulator = new JsonManipulator($contents);
  4371. foreach ($new as $package => $constraint) {
  4372. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4373. return false;
  4374. }
  4375. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4376. return false;
  4377. }
  4378. }
  4379. file_put_contents($json->getPath(), $manipulator->getContents());
  4380. return true;
  4381. }
  4382. protected function interact(InputInterface $input, OutputInterface $output)
  4383. {
  4384. return;
  4385. }
  4386. }
  4387. <?php
  4388. namespace Composer\Command;
  4389. use Composer\Script\Event as ScriptEvent;
  4390. use Composer\Script\ScriptEvents;
  4391. use Composer\Util\ProcessExecutor;
  4392. use Symfony\Component\Console\Input\InputInterface;
  4393. use Symfony\Component\Console\Input\InputOption;
  4394. use Symfony\Component\Console\Input\InputArgument;
  4395. use Symfony\Component\Console\Output\OutputInterface;
  4396. use Symfony\Component\Console\Helper\Table;
  4397. class RunScriptCommand extends BaseCommand
  4398. {
  4399. protected $scriptEvents = array(
  4400. ScriptEvents::PRE_INSTALL_CMD,
  4401. ScriptEvents::POST_INSTALL_CMD,
  4402. ScriptEvents::PRE_UPDATE_CMD,
  4403. ScriptEvents::POST_UPDATE_CMD,
  4404. ScriptEvents::PRE_STATUS_CMD,
  4405. ScriptEvents::POST_STATUS_CMD,
  4406. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4407. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4408. ScriptEvents::PRE_ARCHIVE_CMD,
  4409. ScriptEvents::POST_ARCHIVE_CMD,
  4410. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4411. ScriptEvents::POST_AUTOLOAD_DUMP,
  4412. );
  4413. protected function configure()
  4414. {
  4415. $this
  4416. ->setName('run-script')
  4417. ->setDescription('Runs the scripts defined in composer.json.')
  4418. ->setDefinition(array(
  4419. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4420. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4421. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4422. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4423. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4424. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4425. ))
  4426. ->setHelp(<<<EOT
  4427. The <info>run-script</info> command runs scripts defined in composer.json:
  4428. <info>php composer.phar run-script post-update-cmd</info>
  4429. EOT
  4430. )
  4431. ;
  4432. }
  4433. protected function execute(InputInterface $input, OutputInterface $output)
  4434. {
  4435. if ($input->getOption('list')) {
  4436. return $this->listScripts($output);
  4437. } elseif (!$input->getArgument('script')) {
  4438. throw new \RuntimeException('Missing required argument "script"');
  4439. }
  4440. $script = $input->getArgument('script');
  4441. if (!in_array($script, $this->scriptEvents)) {
  4442. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4443. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4444. }
  4445. }
  4446. $composer = $this->getComposer();
  4447. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  4448. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  4449. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  4450. if (!$hasListeners) {
  4451. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4452. }
  4453. $args = $input->getArgument('args');
  4454. if (null !== $timeout = $input->getOption('timeout')) {
  4455. if (!ctype_digit($timeout)) {
  4456. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4457. }
  4458. ProcessExecutor::setTimeout((int) $timeout);
  4459. }
  4460. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  4461. }
  4462. protected function listScripts(OutputInterface $output)
  4463. {
  4464. $scripts = $this->getComposer()->getPackage()->getScripts();
  4465. if (!count($scripts)) {
  4466. return 0;
  4467. }
  4468. $io = $this->getIO();
  4469. $io->writeError('<info>scripts:</info>');
  4470. $table = array();
  4471. foreach ($scripts as $name => $script) {
  4472. $cmd = $this->getApplication()->find($name);
  4473. $description = '';
  4474. if ($cmd instanceof ScriptAliasCommand) {
  4475. $description = $cmd->getDescription();
  4476. }
  4477. $table[] = array(' '.$name, $description);
  4478. }
  4479. $renderer = new Table($output);
  4480. $renderer->setStyle('compact');
  4481. $renderer->getStyle()->setVerticalBorderChar('');
  4482. $renderer->getStyle()->setCellRowContentFormat('%s ');
  4483. $renderer->setRows($table)->render();
  4484. return 0;
  4485. }
  4486. }
  4487. <?php
  4488. namespace Composer\Command;
  4489. use Symfony\Component\Console\Input\InputInterface;
  4490. use Symfony\Component\Console\Input\InputOption;
  4491. use Symfony\Component\Console\Input\InputArgument;
  4492. use Symfony\Component\Console\Output\OutputInterface;
  4493. class ScriptAliasCommand extends BaseCommand
  4494. {
  4495. private $script;
  4496. private $description;
  4497. public function __construct($script, $description)
  4498. {
  4499. $this->script = $script;
  4500. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  4501. parent::__construct();
  4502. }
  4503. protected function configure()
  4504. {
  4505. $this
  4506. ->setName($this->script)
  4507. ->setDescription($this->description)
  4508. ->setDefinition(array(
  4509. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4510. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4511. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4512. ))
  4513. ->setHelp(<<<EOT
  4514. The <info>run-script</info> command runs scripts defined in composer.json:
  4515. <info>php composer.phar run-script post-update-cmd</info>
  4516. EOT
  4517. )
  4518. ;
  4519. }
  4520. protected function execute(InputInterface $input, OutputInterface $output)
  4521. {
  4522. $composer = $this->getComposer();
  4523. $args = $input->getArguments();
  4524. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4525. }
  4526. }
  4527. <?php
  4528. namespace Composer\Command;
  4529. use Composer\Factory;
  4530. use Symfony\Component\Console\Input\InputInterface;
  4531. use Symfony\Component\Console\Input\InputArgument;
  4532. use Symfony\Component\Console\Input\InputOption;
  4533. use Symfony\Component\Console\Output\OutputInterface;
  4534. use Composer\Repository\CompositeRepository;
  4535. use Composer\Repository\PlatformRepository;
  4536. use Composer\Repository\RepositoryInterface;
  4537. use Composer\Plugin\CommandEvent;
  4538. use Composer\Plugin\PluginEvents;
  4539. class SearchCommand extends BaseCommand
  4540. {
  4541. protected $matches;
  4542. protected $lowMatches = array();
  4543. protected $tokens;
  4544. protected $output;
  4545. protected $onlyName;
  4546. protected function configure()
  4547. {
  4548. $this
  4549. ->setName('search')
  4550. ->setDescription('Searches for packages.')
  4551. ->setDefinition(array(
  4552. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4553. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4554. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4555. ))
  4556. ->setHelp(<<<EOT
  4557. The search command searches for packages by its name
  4558. <info>php composer.phar search symfony composer</info>
  4559. EOT
  4560. )
  4561. ;
  4562. }
  4563. protected function execute(InputInterface $input, OutputInterface $output)
  4564. {
  4565. $platformRepo = new PlatformRepository;
  4566. $io = $this->getIO();
  4567. if (!($composer = $this->getComposer(false))) {
  4568. $composer = Factory::create($this->getIO(), array());
  4569. }
  4570. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4571. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4572. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4573. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4574. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4575. $onlyName = $input->getOption('only-name');
  4576. $type = $input->getOption('type') ?: null;
  4577. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4578. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4579. foreach ($results as $result) {
  4580. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4581. }
  4582. }
  4583. }
  4584. <?php
  4585. namespace Composer\Command;
  4586. use Composer\Composer;
  4587. use Composer\Factory;
  4588. use Composer\Config;
  4589. use Composer\Util\Filesystem;
  4590. use Composer\SelfUpdate\Keys;
  4591. use Composer\SelfUpdate\Versions;
  4592. use Composer\IO\IOInterface;
  4593. use Composer\Downloader\FilesystemException;
  4594. use Symfony\Component\Console\Input\InputInterface;
  4595. use Symfony\Component\Console\Input\InputOption;
  4596. use Symfony\Component\Console\Input\InputArgument;
  4597. use Symfony\Component\Console\Output\OutputInterface;
  4598. use Symfony\Component\Finder\Finder;
  4599. class SelfUpdateCommand extends BaseCommand
  4600. {
  4601. const HOMEPAGE = 'getcomposer.org';
  4602. const OLD_INSTALL_EXT = '-old.phar';
  4603. protected function configure()
  4604. {
  4605. $this
  4606. ->setName('self-update')
  4607. ->setAliases(array('selfupdate'))
  4608. ->setDescription('Updates composer.phar to the latest version.')
  4609. ->setDefinition(array(
  4610. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4611. new InputOption('clean-backups', null, InputOption::VALUE_NONE, 'Delete old backups during an update. This makes the current version of composer the only backup available after the update'),
  4612. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4613. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4614. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4615. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  4616. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  4617. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  4618. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  4619. ))
  4620. ->setHelp(<<<EOT
  4621. The <info>self-update</info> command checks getcomposer.org for newer
  4622. versions of composer and if found, installs the latest.
  4623. <info>php composer.phar self-update</info>
  4624. EOT
  4625. )
  4626. ;
  4627. }
  4628. protected function execute(InputInterface $input, OutputInterface $output)
  4629. {
  4630. $config = Factory::createConfig();
  4631. if ($config->get('disable-tls') === true) {
  4632. $baseUrl = 'http://' . self::HOMEPAGE;
  4633. } else {
  4634. $baseUrl = 'https://' . self::HOMEPAGE;
  4635. }
  4636. $io = $this->getIO();
  4637. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4638. $versionsUtil = new Versions($config, $remoteFilesystem);
  4639. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  4640. if ($input->getOption($channel)) {
  4641. $versionsUtil->setChannel($channel);
  4642. }
  4643. }
  4644. if ($input->getOption('set-channel-only')) {
  4645. return 0;
  4646. }
  4647. $cacheDir = $config->get('cache-dir');
  4648. $rollbackDir = $config->get('data-dir');
  4649. $home = $config->get('home');
  4650. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4651. if ($input->getOption('update-keys')) {
  4652. return $this->fetchKeys($io, $config);
  4653. }
  4654. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4655. if (!is_writable($tmpDir)) {
  4656. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4657. }
  4658. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  4659. $composeUser = posix_getpwuid(posix_geteuid());
  4660. $homeOwner = posix_getpwuid(fileowner($home));
  4661. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  4662. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  4663. }
  4664. }
  4665. if ($input->getOption('rollback')) {
  4666. return $this->rollback($output, $rollbackDir, $localFilename);
  4667. }
  4668. $latest = $versionsUtil->getLatest();
  4669. $latestVersion = $latest['version'];
  4670. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4671. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4672. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4673. return 1;
  4674. }
  4675. if (Composer::VERSION === $updateVersion) {
  4676. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  4677. if ($input->getOption('clean-backups')) {
  4678. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  4679. }
  4680. return 0;
  4681. }
  4682. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  4683. $backupFile = sprintf(
  4684. '%s/%s-%s%s',
  4685. $rollbackDir,
  4686. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  4687. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  4688. self::OLD_INSTALL_EXT
  4689. );
  4690. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  4691. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  4692. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  4693. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  4694. $io->writeError(' ', false);
  4695. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  4696. $io->writeError('');
  4697. if (!file_exists($tempFilename) || !$signature) {
  4698. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  4699. return 1;
  4700. }
  4701. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  4702. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  4703. } else {
  4704. if (!extension_loaded('openssl')) {
  4705. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  4706. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  4707. }
  4708. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  4709. if (!file_exists($sigFile)) {
  4710. file_put_contents($home.'/keys.dev.pub', <<<DEVPUBKEY
  4711. -----BEGIN PUBLIC KEY-----
  4712. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  4713. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  4714. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  4715. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  4716. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  4717. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  4718. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  4719. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  4720. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  4721. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  4722. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  4723. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  4724. -----END PUBLIC KEY-----
  4725. DEVPUBKEY
  4726. );
  4727. file_put_contents($home.'/keys.tags.pub', <<<TAGSPUBKEY
  4728. -----BEGIN PUBLIC KEY-----
  4729. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  4730. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  4731. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  4732. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  4733. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  4734. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  4735. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  4736. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  4737. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  4738. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  4739. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  4740. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  4741. -----END PUBLIC KEY-----
  4742. TAGSPUBKEY
  4743. );
  4744. }
  4745. $pubkeyid = openssl_pkey_get_public($sigFile);
  4746. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  4747. if (!in_array('SHA384', openssl_get_md_methods())) {
  4748. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  4749. }
  4750. $signature = json_decode($signature, true);
  4751. $signature = base64_decode($signature['sha384']);
  4752. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  4753. openssl_free_key($pubkeyid);
  4754. if (!$verified) {
  4755. throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
  4756. }
  4757. }
  4758. if ($input->getOption('clean-backups')) {
  4759. $this->cleanBackups($rollbackDir);
  4760. }
  4761. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  4762. @unlink($tempFilename);
  4763. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  4764. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  4765. return 1;
  4766. }
  4767. if (file_exists($backupFile)) {
  4768. $io->writeError(sprintf(
  4769. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  4770. Composer::VERSION
  4771. ));
  4772. } else {
  4773. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  4774. }
  4775. }
  4776. protected function fetchKeys(IOInterface $io, Config $config)
  4777. {
  4778. if (!$io->isInteractive()) {
  4779. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  4780. }
  4781. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  4782. $validator = function ($value) {
  4783. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  4784. throw new \UnexpectedValueException('Invalid input');
  4785. }
  4786. return trim($value)."\n";
  4787. };
  4788. $devKey = '';
  4789. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  4790. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  4791. while ($line = $io->ask('')) {
  4792. $devKey .= trim($line)."\n";
  4793. if (trim($line) === '-----END PUBLIC KEY-----') {
  4794. break;
  4795. }
  4796. }
  4797. }
  4798. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  4799. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4800. $tagsKey = '';
  4801. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  4802. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  4803. while ($line = $io->ask('')) {
  4804. $tagsKey .= trim($line)."\n";
  4805. if (trim($line) === '-----END PUBLIC KEY-----') {
  4806. break;
  4807. }
  4808. }
  4809. }
  4810. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  4811. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  4812. $io->write('Public keys stored in '.$config->get('home'));
  4813. }
  4814. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  4815. {
  4816. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  4817. if (!$rollbackVersion) {
  4818. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  4819. }
  4820. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  4821. if (!is_file($oldFile)) {
  4822. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  4823. }
  4824. if (!is_readable($oldFile)) {
  4825. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  4826. }
  4827. $io = $this->getIO();
  4828. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  4829. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  4830. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  4831. return 1;
  4832. }
  4833. return 0;
  4834. }
  4835. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  4836. {
  4837. try {
  4838. @chmod($newFilename, fileperms($localFilename));
  4839. if (!ini_get('phar.readonly')) {
  4840. $phar = new \Phar($newFilename);
  4841. unset($phar);
  4842. }
  4843. if ($backupTarget && file_exists($localFilename)) {
  4844. @copy($localFilename, $backupTarget);
  4845. }
  4846. rename($newFilename, $localFilename);
  4847. return null;
  4848. } catch (\Exception $e) {
  4849. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  4850. throw $e;
  4851. }
  4852. return $e;
  4853. }
  4854. }
  4855. protected function cleanBackups($rollbackDir, $except = null)
  4856. {
  4857. $finder = $this->getOldInstallationFinder($rollbackDir);
  4858. $io = $this->getIO();
  4859. $fs = new Filesystem;
  4860. foreach ($finder as $file) {
  4861. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  4862. continue;
  4863. }
  4864. $file = (string) $file;
  4865. $io->writeError('<info>Removing: '.$file.'</info>');
  4866. $fs->remove($file);
  4867. }
  4868. }
  4869. protected function getLastBackupVersion($rollbackDir)
  4870. {
  4871. $finder = $this->getOldInstallationFinder($rollbackDir);
  4872. $finder->sortByName();
  4873. $files = iterator_to_array($finder);
  4874. if (count($files)) {
  4875. return basename(end($files), self::OLD_INSTALL_EXT);
  4876. }
  4877. return false;
  4878. }
  4879. protected function getOldInstallationFinder($rollbackDir)
  4880. {
  4881. $finder = Finder::create()
  4882. ->depth(0)
  4883. ->files()
  4884. ->name('*' . self::OLD_INSTALL_EXT)
  4885. ->in($rollbackDir);
  4886. return $finder;
  4887. }
  4888. }
  4889. <?php
  4890. namespace Composer\Command;
  4891. use Composer\Composer;
  4892. use Composer\DependencyResolver\DefaultPolicy;
  4893. use Composer\DependencyResolver\Pool;
  4894. use Composer\Json\JsonFile;
  4895. use Composer\Package\BasePackage;
  4896. use Composer\Package\CompletePackageInterface;
  4897. use Composer\Package\PackageInterface;
  4898. use Composer\Package\Version\VersionParser;
  4899. use Composer\Package\Version\VersionSelector;
  4900. use Composer\Plugin\CommandEvent;
  4901. use Composer\Plugin\PluginEvents;
  4902. use Composer\Repository\ArrayRepository;
  4903. use Composer\Repository\ComposerRepository;
  4904. use Composer\Repository\CompositeRepository;
  4905. use Composer\Repository\PlatformRepository;
  4906. use Composer\Repository\RepositoryFactory;
  4907. use Composer\Repository\RepositoryInterface;
  4908. use Composer\Semver\Constraint\ConstraintInterface;
  4909. use Composer\Semver\Semver;
  4910. use Composer\Spdx\SpdxLicenses;
  4911. use Composer\Util\Platform;
  4912. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  4913. use Symfony\Component\Console\Input\InputArgument;
  4914. use Symfony\Component\Console\Input\InputInterface;
  4915. use Symfony\Component\Console\Input\InputOption;
  4916. use Symfony\Component\Console\Output\OutputInterface;
  4917. use Symfony\Component\Console\Terminal;
  4918. class ShowCommand extends BaseCommand
  4919. {
  4920. protected $versionParser;
  4921. protected $colors;
  4922. private $pool;
  4923. protected function configure()
  4924. {
  4925. $this
  4926. ->setName('show')
  4927. ->setAliases(array('info'))
  4928. ->setDescription('Shows information about packages.')
  4929. ->setDefinition(array(
  4930. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4931. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  4932. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  4933. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  4934. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  4935. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  4936. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  4937. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  4938. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  4939. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  4940. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  4941. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  4942. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4943. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4944. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4945. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4946. ))
  4947. ->setHelp(<<<EOT
  4948. The show command displays detailed information about a package, or
  4949. lists all packages available.
  4950. EOT
  4951. )
  4952. ;
  4953. }
  4954. protected function execute(InputInterface $input, OutputInterface $output)
  4955. {
  4956. $this->versionParser = new VersionParser;
  4957. if ($input->getOption('tree')) {
  4958. $this->initStyles($output);
  4959. }
  4960. $composer = $this->getComposer(false);
  4961. $io = $this->getIO();
  4962. if ($input->getOption('installed')) {
  4963. $io->writeError('<warning>You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.</warning>');
  4964. }
  4965. if ($input->getOption('outdated')) {
  4966. $input->setOption('latest', true);
  4967. }
  4968. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  4969. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  4970. return 1;
  4971. }
  4972. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  4973. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  4974. return 1;
  4975. }
  4976. $format = $input->getOption('format');
  4977. if (!in_array($format, array('text', 'json'))) {
  4978. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4979. return 1;
  4980. }
  4981. $platformOverrides = array();
  4982. if ($composer) {
  4983. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4984. }
  4985. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  4986. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  4987. if ($input->getOption('self')) {
  4988. $package = $this->getComposer()->getPackage();
  4989. $repos = $installedRepo = new ArrayRepository(array($package));
  4990. } elseif ($input->getOption('platform')) {
  4991. $repos = $installedRepo = $platformRepo;
  4992. } elseif ($input->getOption('available')) {
  4993. $installedRepo = $platformRepo;
  4994. if ($composer) {
  4995. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  4996. } else {
  4997. $defaultRepos = RepositoryFactory::defaultRepos($io);
  4998. $repos = new CompositeRepository($defaultRepos);
  4999. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5000. }
  5001. } elseif ($input->getOption('all') && $composer) {
  5002. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5003. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5004. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5005. } elseif ($input->getOption('all')) {
  5006. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5007. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5008. $installedRepo = $platformRepo;
  5009. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5010. } else {
  5011. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5012. $rootPkg = $this->getComposer()->getPackage();
  5013. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5014. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5015. }
  5016. }
  5017. if ($composer) {
  5018. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5019. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5020. }
  5021. if ($input->getOption('latest') && null === $composer) {
  5022. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5023. $input->setOption('latest', false);
  5024. }
  5025. $packageFilter = $input->getArgument('package');
  5026. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5027. if ('json' === $format) {
  5028. $io->writeError('Format "json" is only supported for package listings, falling back to format "text"');
  5029. }
  5030. if (empty($package)) {
  5031. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5032. if (empty($package)) {
  5033. $options = $input->getOptions();
  5034. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5035. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5036. }
  5037. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5038. return 1;
  5039. }
  5040. } else {
  5041. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5042. }
  5043. $exitCode = 0;
  5044. if ($input->getOption('tree')) {
  5045. $this->displayPackageTree($package, $installedRepo, $repos);
  5046. } else {
  5047. $latestPackage = null;
  5048. if ($input->getOption('latest')) {
  5049. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5050. }
  5051. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5052. $exitCode = 1;
  5053. }
  5054. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  5055. $this->printLinks($package, 'requires');
  5056. $this->printLinks($package, 'devRequires', 'requires (dev)');
  5057. if ($package->getSuggests()) {
  5058. $io->write("\n<info>suggests</info>");
  5059. foreach ($package->getSuggests() as $suggested => $reason) {
  5060. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  5061. }
  5062. }
  5063. $this->printLinks($package, 'provides');
  5064. $this->printLinks($package, 'conflicts');
  5065. $this->printLinks($package, 'replaces');
  5066. }
  5067. return $exitCode;
  5068. }
  5069. if ($input->getOption('tree')) {
  5070. if ('json' === $format) {
  5071. $io->writeError('Format "json" is only supported for package listings, falling back to format "text"');
  5072. }
  5073. $rootRequires = $this->getRootRequires();
  5074. $packages = $installedRepo->getPackages();
  5075. usort($packages, 'strcmp');
  5076. foreach ($packages as $package) {
  5077. if (in_array($package->getName(), $rootRequires, true)) {
  5078. $this->displayPackageTree($package, $installedRepo, $repos);
  5079. }
  5080. }
  5081. return 0;
  5082. }
  5083. if ($repos instanceof CompositeRepository) {
  5084. $repos = $repos->getRepositories();
  5085. } elseif (!is_array($repos)) {
  5086. $repos = array($repos);
  5087. }
  5088. $packages = array();
  5089. if (null !== $packageFilter) {
  5090. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5091. }
  5092. $packageListFilter = array();
  5093. if ($input->getOption('direct')) {
  5094. $packageListFilter = $this->getRootRequires();
  5095. }
  5096. if (class_exists('Symfony\Component\Console\Terminal')) {
  5097. $terminal = new Terminal();
  5098. $width = $terminal->getWidth();
  5099. } else {
  5100. list($width) = $this->getApplication()->getTerminalDimensions();
  5101. }
  5102. if (null === $width) {
  5103. $width = PHP_INT_MAX;
  5104. }
  5105. if (Platform::isWindows()) {
  5106. $width--;
  5107. } else {
  5108. $width = max(80, $width);
  5109. }
  5110. if ($input->getOption('path') && null === $composer) {
  5111. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5112. $input->setOption('path', false);
  5113. }
  5114. foreach ($repos as $repo) {
  5115. if ($repo === $platformRepo) {
  5116. $type = 'platform';
  5117. } elseif (
  5118. $repo === $installedRepo
  5119. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5120. ) {
  5121. $type = 'installed';
  5122. } else {
  5123. $type = 'available';
  5124. }
  5125. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5126. foreach ($repo->getProviderNames() as $name) {
  5127. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5128. $packages[$type][$name] = $name;
  5129. }
  5130. }
  5131. } else {
  5132. foreach ($repo->getPackages() as $package) {
  5133. if (!isset($packages[$type][$package->getName()])
  5134. || !is_object($packages[$type][$package->getName()])
  5135. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5136. ) {
  5137. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5138. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5139. $packages[$type][$package->getName()] = $package;
  5140. }
  5141. }
  5142. }
  5143. }
  5144. }
  5145. }
  5146. $showAllTypes = $input->getOption('all');
  5147. $showLatest = $input->getOption('latest');
  5148. $showMinorOnly = $input->getOption('minor-only');
  5149. $indent = $showAllTypes ? ' ' : '';
  5150. $latestPackages = array();
  5151. $exitCode = 0;
  5152. $viewData = array();
  5153. $viewMetaData = array();
  5154. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5155. if (isset($packages[$type])) {
  5156. ksort($packages[$type]);
  5157. $nameLength = $versionLength = $latestLength = 0;
  5158. foreach ($packages[$type] as $package) {
  5159. if (is_object($package)) {
  5160. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5161. if ($showVersion) {
  5162. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5163. if ($showLatest) {
  5164. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5165. if ($latestPackage === false) {
  5166. continue;
  5167. }
  5168. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5169. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5170. }
  5171. }
  5172. } else {
  5173. $nameLength = max($nameLength, strlen($package));
  5174. }
  5175. }
  5176. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5177. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5178. $writeLatest = $writeVersion && $showLatest;
  5179. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5180. $hasOutdatedPackages = false;
  5181. $viewData[$type] = array();
  5182. $viewMetaData[$type] = array(
  5183. 'nameLength' => $nameLength,
  5184. 'versionLength' => $versionLength,
  5185. 'latestLength' => $latestLength,
  5186. );
  5187. foreach ($packages[$type] as $package) {
  5188. $packageViewData = array();
  5189. if (is_object($package)) {
  5190. $latestPackage = null;
  5191. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5192. $latestPackage = $latestPackages[$package->getPrettyName()];
  5193. }
  5194. if ($input->getOption('outdated') && $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5195. continue;
  5196. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5197. $hasOutdatedPackages = true;
  5198. }
  5199. $packageViewData['name'] = $package->getPrettyName();
  5200. if ($writeVersion) {
  5201. $packageViewData['version'] = $package->getFullPrettyVersion();
  5202. }
  5203. if ($writeLatest && $latestPackage) {
  5204. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5205. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5206. }
  5207. if ($writeDescription) {
  5208. $packageViewData['description'] = $package->getDescription();
  5209. }
  5210. if ($writePath) {
  5211. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5212. }
  5213. if ($latestPackage && $latestPackage->isAbandoned()) {
  5214. $replacement = (is_string($latestPackage->getReplacementPackage()))
  5215. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5216. : 'No replacement was suggested';
  5217. $packageWarning = sprintf(
  5218. 'Package %s is abandoned, you should avoid using it. %s.',
  5219. $package->getPrettyName(),
  5220. $replacement
  5221. );
  5222. $packageViewData['warning'] = $packageWarning;
  5223. }
  5224. } else {
  5225. $packageViewData['name'] = $package;
  5226. }
  5227. $viewData[$type][] = $packageViewData;
  5228. }
  5229. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5230. $exitCode = 1;
  5231. break;
  5232. }
  5233. }
  5234. }
  5235. if ('json' === $format) {
  5236. $io->write(JsonFile::encode($viewData));
  5237. } else {
  5238. foreach ($viewData as $type => $packages) {
  5239. $nameLength = $viewMetaData[$type]['nameLength'];
  5240. $versionLength = $viewMetaData[$type]['versionLength'];
  5241. $latestLength = $viewMetaData[$type]['latestLength'];
  5242. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5243. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5244. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  5245. if ($writeLatest && !$io->isDecorated()) {
  5246. $latestLength += 2;
  5247. }
  5248. if ($showAllTypes) {
  5249. if ('available' === $type) {
  5250. $io->write('<comment>' . $type . '</comment>:');
  5251. } else {
  5252. $io->write('<info>' . $type . '</info>:');
  5253. }
  5254. }
  5255. foreach ($packages as $package) {
  5256. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  5257. if (isset($package['version']) && $writeVersion) {
  5258. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  5259. }
  5260. if (isset($package['latest']) && $writeLatest) {
  5261. $latestVersion = $package['latest'];
  5262. $updateStatus = $package['latest-status'];
  5263. $style = $this->updateStatusToVersionStyle($updateStatus);
  5264. if (!$io->isDecorated()) {
  5265. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  5266. }
  5267. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  5268. }
  5269. if (isset($package['description']) && $writeDescription) {
  5270. $description = strtok($package['description'], "\r\n");
  5271. $remaining = $width - $nameLength - $versionLength - 4;
  5272. if ($writeLatest) {
  5273. $remaining -= $latestLength;
  5274. }
  5275. if (strlen($description) > $remaining) {
  5276. $description = substr($description, 0, $remaining - 3) . '...';
  5277. }
  5278. $io->write(' ' . $description, false);
  5279. }
  5280. if (isset($package['path'])) {
  5281. $io->write(' ' . $package['path'], false);
  5282. }
  5283. $io->write('');
  5284. if (isset($package['warning'])) {
  5285. $io->write('<warning>' . $package['warning'] . '</warning>');
  5286. }
  5287. }
  5288. if ($showAllTypes) {
  5289. $io->write('');
  5290. }
  5291. }
  5292. }
  5293. return $exitCode;
  5294. }
  5295. protected function getRootRequires()
  5296. {
  5297. $rootPackage = $this->getComposer()->getPackage();
  5298. return array_map(
  5299. 'strtolower',
  5300. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  5301. );
  5302. }
  5303. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  5304. {
  5305. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  5306. }
  5307. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  5308. {
  5309. $name = strtolower($name);
  5310. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  5311. $policy = new DefaultPolicy();
  5312. $pool = new Pool('dev');
  5313. $pool->addRepository($repos);
  5314. $matchedPackage = null;
  5315. $versions = array();
  5316. $matches = $pool->whatProvides($name, $constraint);
  5317. foreach ($matches as $index => $package) {
  5318. if ($package->getName() !== $name) {
  5319. unset($matches[$index]);
  5320. continue;
  5321. }
  5322. if (null === $version && $installedRepo->hasPackage($package)) {
  5323. $matchedPackage = $package;
  5324. }
  5325. $versions[$package->getPrettyVersion()] = $package->getVersion();
  5326. $matches[$index] = $package->getId();
  5327. }
  5328. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  5329. $matchedPackage = $pool->literalToPackage($preferred[0]);
  5330. }
  5331. return array($matchedPackage, $versions);
  5332. }
  5333. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  5334. {
  5335. $io = $this->getIO();
  5336. $io->write('<info>name</info> : ' . $package->getPrettyName());
  5337. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  5338. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  5339. $this->printVersions($package, $versions, $installedRepo);
  5340. if ($latestPackage) {
  5341. $style = $this->getVersionStyle($latestPackage, $package);
  5342. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  5343. } else {
  5344. $latestPackage = $package;
  5345. }
  5346. $io->write('<info>type</info> : ' . $package->getType());
  5347. $this->printLicenses($package);
  5348. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  5349. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  5350. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  5351. if ($latestPackage->isAbandoned()) {
  5352. $replacement = ($latestPackage->getReplacementPackage() !== null)
  5353. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  5354. : null;
  5355. $io->writeError(
  5356. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  5357. );
  5358. }
  5359. if ($package->getSupport()) {
  5360. $io->write("\n<info>support</info>");
  5361. foreach ($package->getSupport() as $type => $value) {
  5362. $io->write('<comment>' . $type . '</comment> : '.$value);
  5363. }
  5364. }
  5365. if ($package->getAutoload()) {
  5366. $io->write("\n<info>autoload</info>");
  5367. foreach ($package->getAutoload() as $type => $autoloads) {
  5368. $io->write('<comment>' . $type . '</comment>');
  5369. if ($type === 'psr-0') {
  5370. foreach ($autoloads as $name => $path) {
  5371. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5372. }
  5373. } elseif ($type === 'psr-4') {
  5374. foreach ($autoloads as $name => $path) {
  5375. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5376. }
  5377. } elseif ($type === 'classmap') {
  5378. $io->write(implode(', ', $autoloads));
  5379. }
  5380. }
  5381. if ($package->getIncludePaths()) {
  5382. $io->write('<comment>include-path</comment>');
  5383. $io->write(implode(', ', $package->getIncludePaths()));
  5384. }
  5385. }
  5386. }
  5387. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  5388. {
  5389. uasort($versions, 'version_compare');
  5390. $versions = array_keys(array_reverse($versions));
  5391. if ($installedRepo->hasPackage($package)) {
  5392. $installedVersion = $package->getPrettyVersion();
  5393. $key = array_search($installedVersion, $versions);
  5394. if (false !== $key) {
  5395. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  5396. }
  5397. }
  5398. $versions = implode(', ', $versions);
  5399. $this->getIO()->write('<info>versions</info> : ' . $versions);
  5400. }
  5401. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  5402. {
  5403. $title = $title ?: $linkType;
  5404. $io = $this->getIO();
  5405. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  5406. $io->write("\n<info>" . $title . "</info>");
  5407. foreach ($links as $link) {
  5408. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  5409. }
  5410. }
  5411. }
  5412. protected function printLicenses(CompletePackageInterface $package)
  5413. {
  5414. $spdxLicenses = new SpdxLicenses();
  5415. $licenses = $package->getLicense();
  5416. $io = $this->getIO();
  5417. foreach ($licenses as $licenseId) {
  5418. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  5419. if (!$license) {
  5420. $out = $licenseId;
  5421. } else {
  5422. if ($license[1] === true) {
  5423. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  5424. } else {
  5425. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  5426. }
  5427. }
  5428. $io->write('<info>license</info> : ' . $out);
  5429. }
  5430. }
  5431. protected function initStyles(OutputInterface $output)
  5432. {
  5433. $this->colors = array(
  5434. 'green',
  5435. 'yellow',
  5436. 'cyan',
  5437. 'magenta',
  5438. 'blue',
  5439. );
  5440. foreach ($this->colors as $color) {
  5441. $style = new OutputFormatterStyle($color);
  5442. $output->getFormatter()->setStyle($color, $style);
  5443. }
  5444. }
  5445. protected function displayPackageTree(PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos)
  5446. {
  5447. $io = $this->getIO();
  5448. $io->write(sprintf('<info>%s</info>', $package->getPrettyName()), false);
  5449. $io->write(' ' . $package->getPrettyVersion(), false);
  5450. $io->write(' ' . strtok($package->getDescription(), "\r\n"));
  5451. if (is_object($package)) {
  5452. $requires = $package->getRequires();
  5453. ksort($requires);
  5454. $treeBar = '├';
  5455. $j = 0;
  5456. $total = count($requires);
  5457. foreach ($requires as $requireName => $require) {
  5458. $j++;
  5459. if ($j == 0) {
  5460. $this->writeTreeLine($treeBar);
  5461. }
  5462. if ($j == $total) {
  5463. $treeBar = 'â””';
  5464. }
  5465. $level = 1;
  5466. $color = $this->colors[$level];
  5467. $info = sprintf('%s──<%s>%s</%s> %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint());
  5468. $this->writeTreeLine($info);
  5469. $treeBar = str_replace('â””', ' ', $treeBar);
  5470. $packagesInTree = array($package->getName(), $requireName);
  5471. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree, $treeBar, $level + 1);
  5472. }
  5473. }
  5474. }
  5475. protected function displayTree($name, $package, RepositoryInterface $installedRepo, RepositoryInterface $distantRepos, array $packagesInTree, $previousTreeBar = '├', $level = 1)
  5476. {
  5477. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5478. list($package, $versions) = $this->getPackage($installedRepo, $distantRepos, $name, $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint());
  5479. if (is_object($package)) {
  5480. $requires = $package->getRequires();
  5481. ksort($requires);
  5482. $treeBar = $previousTreeBar . ' ├';
  5483. $i = 0;
  5484. $total = count($requires);
  5485. foreach ($requires as $requireName => $require) {
  5486. $currentTree = $packagesInTree;
  5487. $i++;
  5488. if ($i == $total) {
  5489. $treeBar = $previousTreeBar . ' â””';
  5490. }
  5491. $colorIdent = $level % count($this->colors);
  5492. $color = $this->colors[$colorIdent];
  5493. $circularWarn = in_array($requireName, $currentTree) ? '(circular dependency aborted here)' : '';
  5494. $info = rtrim(sprintf('%s──<%s>%s</%s> %s %s', $treeBar, $color, $requireName, $color, $require->getPrettyConstraint(), $circularWarn));
  5495. $this->writeTreeLine($info);
  5496. $treeBar = str_replace('â””', ' ', $treeBar);
  5497. if (!in_array($requireName, $currentTree)) {
  5498. $currentTree[] = $requireName;
  5499. $this->displayTree($requireName, $require, $installedRepo, $distantRepos, $currentTree, $treeBar, $level + 1);
  5500. }
  5501. }
  5502. }
  5503. }
  5504. private function updateStatusToVersionStyle($updateStatus)
  5505. {
  5506. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  5507. }
  5508. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  5509. {
  5510. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  5511. return 'up-to-date';
  5512. }
  5513. $constraint = $package->getVersion();
  5514. if (0 !== strpos($constraint, 'dev-')) {
  5515. $constraint = '^'.$constraint;
  5516. }
  5517. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  5518. return 'semver-safe-update';
  5519. }
  5520. return 'update-possible';
  5521. }
  5522. private function writeTreeLine($line)
  5523. {
  5524. $io = $this->getIO();
  5525. if (!$io->isDecorated()) {
  5526. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  5527. }
  5528. $io->write($line);
  5529. }
  5530. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  5531. {
  5532. $name = $package->getName();
  5533. $versionSelector = new VersionSelector($this->getPool($composer));
  5534. $stability = $composer->getPackage()->getMinimumStability();
  5535. $flags = $composer->getPackage()->getStabilityFlags();
  5536. if (isset($flags[$name])) {
  5537. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  5538. }
  5539. $bestStability = $stability;
  5540. if ($composer->getPackage()->getPreferStable()) {
  5541. $bestStability = $package->getStability();
  5542. }
  5543. $targetVersion = null;
  5544. if (0 === strpos($package->getVersion(), 'dev-')) {
  5545. $targetVersion = $package->getVersion();
  5546. }
  5547. if ($targetVersion === null && $minorOnly) {
  5548. $targetVersion = '^' . $package->getVersion();
  5549. }
  5550. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  5551. }
  5552. private function getPool(Composer $composer)
  5553. {
  5554. if (!$this->pool) {
  5555. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  5556. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  5557. }
  5558. return $this->pool;
  5559. }
  5560. }
  5561. <?php
  5562. namespace Composer\Command;
  5563. use Symfony\Component\Console\Input\InputInterface;
  5564. use Symfony\Component\Console\Input\InputOption;
  5565. use Symfony\Component\Console\Output\OutputInterface;
  5566. use Composer\Downloader\ChangeReportInterface;
  5567. use Composer\Downloader\DvcsDownloaderInterface;
  5568. use Composer\Downloader\VcsCapableDownloaderInterface;
  5569. use Composer\Package\Dumper\ArrayDumper;
  5570. use Composer\Package\Version\VersionGuesser;
  5571. use Composer\Package\Version\VersionParser;
  5572. use Composer\Plugin\CommandEvent;
  5573. use Composer\Plugin\PluginEvents;
  5574. use Composer\Script\ScriptEvents;
  5575. use Composer\Util\ProcessExecutor;
  5576. class StatusCommand extends BaseCommand
  5577. {
  5578. const EXIT_CODE_ERRORS = 1;
  5579. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  5580. const EXIT_CODE_VERSION_CHANGES = 4;
  5581. protected function configure()
  5582. {
  5583. $this
  5584. ->setName('status')
  5585. ->setDescription('Shows a list of locally modified packages.')
  5586. ->setDefinition(array(
  5587. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  5588. ))
  5589. ->setHelp(<<<EOT
  5590. The status command displays a list of dependencies that have
  5591. been modified locally.
  5592. EOT
  5593. )
  5594. ;
  5595. }
  5596. protected function execute(InputInterface $input, OutputInterface $output)
  5597. {
  5598. $composer = $this->getComposer();
  5599. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  5600. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5601. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  5602. $dm = $composer->getDownloadManager();
  5603. $im = $composer->getInstallationManager();
  5604. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  5605. $errors = array();
  5606. $io = $this->getIO();
  5607. $unpushedChanges = array();
  5608. $vcsVersionChanges = array();
  5609. $parser = new VersionParser;
  5610. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  5611. $dumper = new ArrayDumper;
  5612. foreach ($installedRepo->getCanonicalPackages() as $package) {
  5613. $downloader = $dm->getDownloaderForInstalledPackage($package);
  5614. $targetDir = $im->getInstallPath($package);
  5615. if ($downloader instanceof ChangeReportInterface) {
  5616. if (is_link($targetDir)) {
  5617. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  5618. }
  5619. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  5620. $errors[$targetDir] = $changes;
  5621. }
  5622. }
  5623. if ($downloader instanceof VcsCapableDownloaderInterface) {
  5624. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  5625. switch ($package->getInstallationSource()) {
  5626. case 'source':
  5627. $previousRef = $package->getSourceReference();
  5628. break;
  5629. case 'dist':
  5630. $previousRef = $package->getDistReference();
  5631. break;
  5632. default:
  5633. $previousRef = null;
  5634. }
  5635. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  5636. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  5637. $vcsVersionChanges[$targetDir] = array(
  5638. 'previous' => array(
  5639. 'version' => $package->getPrettyVersion(),
  5640. 'ref' => $previousRef,
  5641. ),
  5642. 'current' => array(
  5643. 'version' => $currentVersion['pretty_version'],
  5644. 'ref' => $currentVersion['commit'],
  5645. ),
  5646. );
  5647. }
  5648. }
  5649. }
  5650. if ($downloader instanceof DvcsDownloaderInterface) {
  5651. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  5652. $unpushedChanges[$targetDir] = $unpushed;
  5653. }
  5654. }
  5655. }
  5656. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  5657. $io->writeError('<info>No local changes</info>');
  5658. return 0;
  5659. }
  5660. if ($errors) {
  5661. $io->writeError('<error>You have changes in the following dependencies:</error>');
  5662. foreach ($errors as $path => $changes) {
  5663. if ($input->getOption('verbose')) {
  5664. $indentedChanges = implode("\n", array_map(function ($line) {
  5665. return ' ' . ltrim($line);
  5666. }, explode("\n", $changes)));
  5667. $io->write('<info>'.$path.'</info>:');
  5668. $io->write($indentedChanges);
  5669. } else {
  5670. $io->write($path);
  5671. }
  5672. }
  5673. }
  5674. if ($unpushedChanges) {
  5675. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  5676. foreach ($unpushedChanges as $path => $changes) {
  5677. if ($input->getOption('verbose')) {
  5678. $indentedChanges = implode("\n", array_map(function ($line) {
  5679. return ' ' . ltrim($line);
  5680. }, explode("\n", $changes)));
  5681. $io->write('<info>'.$path.'</info>:');
  5682. $io->write($indentedChanges);
  5683. } else {
  5684. $io->write($path);
  5685. }
  5686. }
  5687. }
  5688. if ($vcsVersionChanges) {
  5689. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  5690. foreach ($vcsVersionChanges as $path => $changes) {
  5691. if ($input->getOption('verbose')) {
  5692. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  5693. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  5694. if ($io->isVeryVerbose()) {
  5695. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  5696. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  5697. }
  5698. $io->write('<info>'.$path.'</info>:');
  5699. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  5700. } else {
  5701. $io->write($path);
  5702. }
  5703. }
  5704. }
  5705. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  5706. $io->writeError('Use --verbose (-v) to see a list of files');
  5707. }
  5708. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  5709. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  5710. }
  5711. }
  5712. <?php
  5713. namespace Composer\Command;
  5714. use Composer\Repository\PlatformRepository;
  5715. use Symfony\Component\Console\Input\InputArgument;
  5716. use Symfony\Component\Console\Input\InputInterface;
  5717. use Symfony\Component\Console\Input\InputOption;
  5718. use Symfony\Component\Console\Output\OutputInterface;
  5719. class SuggestsCommand extends BaseCommand
  5720. {
  5721. protected function configure()
  5722. {
  5723. $this
  5724. ->setName('suggests')
  5725. ->setDescription('Shows package suggestions.')
  5726. ->setDefinition(array(
  5727. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  5728. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  5729. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  5730. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  5731. ))
  5732. ->setHelp(<<<EOT
  5733. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  5734. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  5735. EOT
  5736. )
  5737. ;
  5738. }
  5739. protected function execute(InputInterface $input, OutputInterface $output)
  5740. {
  5741. $lock = $this->getComposer()->getLocker()->getLockData();
  5742. if (empty($lock)) {
  5743. throw new \RuntimeException('Lockfile seems to be empty?');
  5744. }
  5745. $packages = $lock['packages'];
  5746. if (!$input->getOption('no-dev')) {
  5747. $packages += $lock['packages-dev'];
  5748. }
  5749. $filter = $input->getArgument('packages');
  5750. $installed = array();
  5751. foreach ($packages as $package) {
  5752. $installed[] = $package['name'];
  5753. if (!empty($package['provide'])) {
  5754. $installed = array_merge($installed, array_keys($package['provide']));
  5755. }
  5756. if (!empty($package['replace'])) {
  5757. $installed = array_merge($installed, array_keys($package['replace']));
  5758. }
  5759. }
  5760. $installed = array_flip($installed);
  5761. ksort($installed);
  5762. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  5763. $suggesters = array();
  5764. $suggested = array();
  5765. foreach ($packages as $package) {
  5766. $packageName = $package['name'];
  5767. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  5768. continue;
  5769. }
  5770. foreach ($package['suggest'] as $suggestion => $reason) {
  5771. if (false === strpos('/', $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  5772. continue;
  5773. }
  5774. if (!isset($installed[$suggestion])) {
  5775. $suggesters[$packageName][$suggestion] = $reason;
  5776. $suggested[$suggestion][$packageName] = $reason;
  5777. }
  5778. }
  5779. }
  5780. ksort($suggesters);
  5781. ksort($suggested);
  5782. $mode = 0;
  5783. $io = $this->getIO();
  5784. if ($input->getOption('by-package') || $io->isVerbose()) {
  5785. $mode |= 1;
  5786. }
  5787. if ($input->getOption('by-suggestion')) {
  5788. $mode |= 2;
  5789. }
  5790. if ($mode === 0) {
  5791. foreach (array_keys($suggested) as $suggestion) {
  5792. $io->write(sprintf('<info>%s</info>', $suggestion));
  5793. }
  5794. return;
  5795. }
  5796. if ($mode & 1) {
  5797. foreach ($suggesters as $suggester => $suggestions) {
  5798. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  5799. foreach ($suggestions as $suggestion => $reason) {
  5800. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  5801. }
  5802. $io->write('');
  5803. }
  5804. }
  5805. if ($mode & 2) {
  5806. if ($mode & 1) {
  5807. $io->write(str_repeat('-', 78));
  5808. }
  5809. foreach ($suggested as $suggestion => $suggesters) {
  5810. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  5811. foreach ($suggesters as $suggester => $reason) {
  5812. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  5813. }
  5814. $io->write('');
  5815. }
  5816. }
  5817. }
  5818. }
  5819. <?php
  5820. namespace Composer\Command;
  5821. use Composer\Composer;
  5822. use Composer\Installer;
  5823. use Composer\IO\IOInterface;
  5824. use Composer\Plugin\CommandEvent;
  5825. use Composer\Plugin\PluginEvents;
  5826. use Symfony\Component\Console\Helper\Table;
  5827. use Symfony\Component\Console\Input\InputInterface;
  5828. use Symfony\Component\Console\Input\InputOption;
  5829. use Symfony\Component\Console\Input\InputArgument;
  5830. use Symfony\Component\Console\Output\OutputInterface;
  5831. use Symfony\Component\Console\Question\Question;
  5832. class UpdateCommand extends BaseCommand
  5833. {
  5834. protected function configure()
  5835. {
  5836. $this
  5837. ->setName('update')
  5838. ->setAliases(array('upgrade'))
  5839. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  5840. ->setDefinition(array(
  5841. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  5842. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  5843. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  5844. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  5845. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  5846. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  5847. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  5848. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  5849. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  5850. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  5851. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5852. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  5853. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of whitelisted packages to the whitelist, except those defined in root package.'),
  5854. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist, including those defined in root package.'),
  5855. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  5856. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  5857. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  5858. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  5859. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  5860. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  5861. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  5862. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  5863. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  5864. ))
  5865. ->setHelp(<<<EOT
  5866. The <info>update</info> command reads the composer.json file from the
  5867. current directory, processes it, and updates, removes or installs all the
  5868. dependencies.
  5869. <info>php composer.phar update</info>
  5870. To limit the update operation to a few packages, you can list the package(s)
  5871. you want to update as such:
  5872. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  5873. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  5874. from a specific vendor:
  5875. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  5876. To select packages names interactively with auto-completion use <info>-i</info>.
  5877. EOT
  5878. )
  5879. ;
  5880. }
  5881. protected function execute(InputInterface $input, OutputInterface $output)
  5882. {
  5883. $io = $this->getIO();
  5884. if ($input->getOption('no-custom-installers')) {
  5885. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  5886. $input->setOption('no-plugins', true);
  5887. }
  5888. if ($input->getOption('dev')) {
  5889. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  5890. }
  5891. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  5892. $packages = $input->getArgument('packages');
  5893. if ($input->getOption('interactive')) {
  5894. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  5895. }
  5896. if ($input->getOption('root-reqs')) {
  5897. $require = array_keys($composer->getPackage()->getRequires());
  5898. if (!$input->getOption('no-dev')) {
  5899. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  5900. $require = array_merge($require, $requireDev);
  5901. }
  5902. if (!empty($packages)) {
  5903. $packages = array_intersect($packages, $require);
  5904. } else {
  5905. $packages = $require;
  5906. }
  5907. }
  5908. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  5909. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  5910. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5911. $install = Installer::create($io, $composer);
  5912. $config = $composer->getConfig();
  5913. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  5914. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  5915. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  5916. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  5917. $install
  5918. ->setDryRun($input->getOption('dry-run'))
  5919. ->setVerbose($input->getOption('verbose'))
  5920. ->setPreferSource($preferSource)
  5921. ->setPreferDist($preferDist)
  5922. ->setDevMode(!$input->getOption('no-dev'))
  5923. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  5924. ->setRunScripts(!$input->getOption('no-scripts'))
  5925. ->setSkipSuggest($input->getOption('no-suggest'))
  5926. ->setOptimizeAutoloader($optimize)
  5927. ->setClassMapAuthoritative($authoritative)
  5928. ->setApcuAutoloader($apcu)
  5929. ->setUpdate(true)
  5930. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  5931. ->setWhitelistTransitiveDependencies($input->getOption('with-dependencies'))
  5932. ->setWhitelistAllDependencies($input->getOption('with-all-dependencies'))
  5933. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  5934. ->setPreferStable($input->getOption('prefer-stable'))
  5935. ->setPreferLowest($input->getOption('prefer-lowest'))
  5936. ;
  5937. if ($input->getOption('no-plugins')) {
  5938. $install->disablePlugins();
  5939. }
  5940. return $install->run();
  5941. }
  5942. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  5943. {
  5944. if (!$input->isInteractive()) {
  5945. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  5946. }
  5947. $requires = array_merge(
  5948. $composer->getPackage()->getRequires(),
  5949. $composer->getPackage()->getDevRequires()
  5950. );
  5951. $autocompleterValues = array();
  5952. foreach ($requires as $require) {
  5953. $target = $require->getTarget();
  5954. $autocompleterValues[strtolower($target)] = $target;
  5955. }
  5956. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  5957. foreach ($installedPackages as $package) {
  5958. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  5959. }
  5960. $helper = $this->getHelper('question');
  5961. $question = new Question('<comment>Enter package name: </comment>', null);
  5962. $io->writeError('<info>Press enter without value to end submission</info>');
  5963. do {
  5964. $autocompleterValues = array_diff($autocompleterValues, $packages);
  5965. $question->setAutocompleterValues($autocompleterValues);
  5966. $addedPackage = $helper->ask($input, $output, $question);
  5967. if (!is_string($addedPackage) || empty($addedPackage)) {
  5968. break;
  5969. }
  5970. $addedPackage = strtolower($addedPackage);
  5971. if (!in_array($addedPackage, $packages)) {
  5972. $packages[] = $addedPackage;
  5973. }
  5974. } while (true);
  5975. $packages = array_filter($packages);
  5976. if (!$packages) {
  5977. throw new \InvalidArgumentException('You must enter minimum one package.');
  5978. }
  5979. $table = new Table($output);
  5980. $table->setHeaders(array('Selected packages'));
  5981. foreach ($packages as $package) {
  5982. $table->addRow(array($package));
  5983. }
  5984. $table->render();
  5985. if ($io->askConfirmation(sprintf(
  5986. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  5987. 1 === count($packages) ? '' : 's'
  5988. ), true)) {
  5989. return $packages;
  5990. }
  5991. throw new \RuntimeException('Installation aborted.');
  5992. }
  5993. }
  5994. <?php
  5995. namespace Composer\Command;
  5996. use Composer\Factory;
  5997. use Composer\Package\Loader\ValidatingArrayLoader;
  5998. use Composer\Plugin\CommandEvent;
  5999. use Composer\Plugin\PluginEvents;
  6000. use Composer\Util\ConfigValidator;
  6001. use Symfony\Component\Console\Input\InputArgument;
  6002. use Symfony\Component\Console\Input\InputInterface;
  6003. use Symfony\Component\Console\Input\InputOption;
  6004. use Symfony\Component\Console\Output\OutputInterface;
  6005. class ValidateCommand extends BaseCommand
  6006. {
  6007. protected function configure()
  6008. {
  6009. $this
  6010. ->setName('validate')
  6011. ->setDescription('Validates a composer.json and composer.lock.')
  6012. ->setDefinition(array(
  6013. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not make a complete validation'),
  6014. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  6015. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  6016. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  6017. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  6018. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  6019. ))
  6020. ->setHelp(<<<EOT
  6021. The validate command validates a given composer.json and composer.lock
  6022. Exit codes in case of errors are:
  6023. 1 validation warning(s), only when --strict is given
  6024. 2 validation error(s)
  6025. 3 file unreadable or missing
  6026. EOT
  6027. );
  6028. }
  6029. protected function execute(InputInterface $input, OutputInterface $output)
  6030. {
  6031. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  6032. $io = $this->getIO();
  6033. if (!file_exists($file)) {
  6034. $io->writeError('<error>' . $file . ' not found.</error>');
  6035. return 3;
  6036. }
  6037. if (!is_readable($file)) {
  6038. $io->writeError('<error>' . $file . ' is not readable.</error>');
  6039. return 3;
  6040. }
  6041. $validator = new ConfigValidator($io);
  6042. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  6043. $checkPublish = !$input->getOption('no-check-publish');
  6044. $checkLock = !$input->getOption('no-check-lock');
  6045. $isStrict = $input->getOption('strict');
  6046. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6047. $lockErrors = array();
  6048. $composer = Factory::create($io, $file);
  6049. $locker = $composer->getLocker();
  6050. if ($locker->isLocked() && !$locker->isFresh()) {
  6051. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  6052. }
  6053. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  6054. $exitCode = $errors || ($publishErrors && $checkPublish) || ($lockErrors && $checkLock) ? 2 : ($isStrict && $warnings ? 1 : 0);
  6055. if ($input->getOption('with-dependencies')) {
  6056. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6057. foreach ($localRepo->getPackages() as $package) {
  6058. $path = $composer->getInstallationManager()->getInstallPath($package);
  6059. $file = $path . '/composer.json';
  6060. if (is_dir($path) && file_exists($file)) {
  6061. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6062. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  6063. $depCode = $errors || ($publishErrors && $checkPublish) ? 2 : ($isStrict && $warnings ? 1 : 0);
  6064. $exitCode = max($depCode, $exitCode);
  6065. }
  6066. }
  6067. }
  6068. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  6069. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6070. $exitCode = max($eventCode, $exitCode);
  6071. return $exitCode;
  6072. }
  6073. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  6074. {
  6075. if (!$errors && !$publishErrors && !$warnings) {
  6076. $io->write('<info>' . $name . ' is valid</info>');
  6077. } elseif (!$errors && !$publishErrors) {
  6078. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  6079. if ($printSchemaUrl) {
  6080. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6081. }
  6082. } elseif (!$errors) {
  6083. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  6084. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  6085. if ($printSchemaUrl) {
  6086. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6087. }
  6088. } else {
  6089. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  6090. }
  6091. if ($checkPublish) {
  6092. $errors = array_merge($errors, $publishErrors);
  6093. } else {
  6094. $warnings = array_merge($warnings, $publishErrors);
  6095. }
  6096. if ($checkLock) {
  6097. $errors = array_merge($errors, $lockErrors);
  6098. } else {
  6099. $warnings = array_merge($warnings, $lockErrors);
  6100. }
  6101. $messages = array(
  6102. 'error' => $errors,
  6103. 'warning' => $warnings,
  6104. );
  6105. foreach ($messages as $style => $msgs) {
  6106. foreach ($msgs as $msg) {
  6107. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  6108. }
  6109. }
  6110. }
  6111. }
  6112. <?php
  6113. namespace Composer;
  6114. use Composer\Package\RootPackageInterface;
  6115. use Composer\Package\Locker;
  6116. use Composer\Repository\RepositoryManager;
  6117. use Composer\Installer\InstallationManager;
  6118. use Composer\Plugin\PluginManager;
  6119. use Composer\Downloader\DownloadManager;
  6120. use Composer\EventDispatcher\EventDispatcher;
  6121. use Composer\Autoload\AutoloadGenerator;
  6122. use Composer\Package\Archiver\ArchiveManager;
  6123. class Composer
  6124. {
  6125. const VERSION = '1.6.3';
  6126. const BRANCH_ALIAS_VERSION = '';
  6127. const RELEASE_DATE = '2018-01-31 16:28:17';
  6128. private $package;
  6129. private $locker;
  6130. private $repositoryManager;
  6131. private $downloadManager;
  6132. private $installationManager;
  6133. private $pluginManager;
  6134. private $config;
  6135. private $eventDispatcher;
  6136. private $autoloadGenerator;
  6137. private $archiveManager;
  6138. public function setPackage(RootPackageInterface $package)
  6139. {
  6140. $this->package = $package;
  6141. }
  6142. public function getPackage()
  6143. {
  6144. return $this->package;
  6145. }
  6146. public function setConfig(Config $config)
  6147. {
  6148. $this->config = $config;
  6149. }
  6150. public function getConfig()
  6151. {
  6152. return $this->config;
  6153. }
  6154. public function setLocker(Locker $locker)
  6155. {
  6156. $this->locker = $locker;
  6157. }
  6158. public function getLocker()
  6159. {
  6160. return $this->locker;
  6161. }
  6162. public function setRepositoryManager(RepositoryManager $manager)
  6163. {
  6164. $this->repositoryManager = $manager;
  6165. }
  6166. public function getRepositoryManager()
  6167. {
  6168. return $this->repositoryManager;
  6169. }
  6170. public function setDownloadManager(DownloadManager $manager)
  6171. {
  6172. $this->downloadManager = $manager;
  6173. }
  6174. public function getDownloadManager()
  6175. {
  6176. return $this->downloadManager;
  6177. }
  6178. public function setArchiveManager(ArchiveManager $manager)
  6179. {
  6180. $this->archiveManager = $manager;
  6181. }
  6182. public function getArchiveManager()
  6183. {
  6184. return $this->archiveManager;
  6185. }
  6186. public function setInstallationManager(InstallationManager $manager)
  6187. {
  6188. $this->installationManager = $manager;
  6189. }
  6190. public function getInstallationManager()
  6191. {
  6192. return $this->installationManager;
  6193. }
  6194. public function setPluginManager(PluginManager $manager)
  6195. {
  6196. $this->pluginManager = $manager;
  6197. }
  6198. public function getPluginManager()
  6199. {
  6200. return $this->pluginManager;
  6201. }
  6202. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  6203. {
  6204. $this->eventDispatcher = $eventDispatcher;
  6205. }
  6206. public function getEventDispatcher()
  6207. {
  6208. return $this->eventDispatcher;
  6209. }
  6210. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  6211. {
  6212. $this->autoloadGenerator = $autoloadGenerator;
  6213. }
  6214. public function getAutoloadGenerator()
  6215. {
  6216. return $this->autoloadGenerator;
  6217. }
  6218. }
  6219. <?php
  6220. namespace Composer;
  6221. use Composer\Config\ConfigSourceInterface;
  6222. use Composer\Downloader\TransportException;
  6223. use Composer\IO\IOInterface;
  6224. use Composer\Util\Platform;
  6225. class Config
  6226. {
  6227. const RELATIVE_PATHS = 1;
  6228. public static $defaultConfig = array(
  6229. 'process-timeout' => 300,
  6230. 'use-include-path' => false,
  6231. 'preferred-install' => 'auto',
  6232. 'notify-on-install' => true,
  6233. 'github-protocols' => array('https', 'ssh', 'git'),
  6234. 'vendor-dir' => 'vendor',
  6235. 'bin-dir' => '{$vendor-dir}/bin',
  6236. 'cache-dir' => '{$home}/cache',
  6237. 'data-dir' => '{$home}',
  6238. 'cache-files-dir' => '{$cache-dir}/files',
  6239. 'cache-repo-dir' => '{$cache-dir}/repo',
  6240. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  6241. 'cache-ttl' => 15552000,
  6242. 'cache-files-ttl' => null,
  6243. 'cache-files-maxsize' => '300MiB',
  6244. 'bin-compat' => 'auto',
  6245. 'discard-changes' => false,
  6246. 'autoloader-suffix' => null,
  6247. 'sort-packages' => false,
  6248. 'optimize-autoloader' => false,
  6249. 'classmap-authoritative' => false,
  6250. 'apcu-autoloader' => false,
  6251. 'prepend-autoloader' => true,
  6252. 'github-domains' => array('github.com'),
  6253. 'bitbucket-expose-hostname' => true,
  6254. 'disable-tls' => false,
  6255. 'secure-http' => true,
  6256. 'cafile' => null,
  6257. 'capath' => null,
  6258. 'github-expose-hostname' => true,
  6259. 'gitlab-domains' => array('gitlab.com'),
  6260. 'store-auths' => 'prompt',
  6261. 'platform' => array(),
  6262. 'archive-format' => 'tar',
  6263. 'archive-dir' => '.',
  6264. 'htaccess-protect' => true,
  6265. );
  6266. public static $defaultRepositories = array(
  6267. 'packagist.org' => array(
  6268. 'type' => 'composer',
  6269. 'url' => 'https?://packagist.org',
  6270. 'allow_ssl_downgrade' => true,
  6271. ),
  6272. );
  6273. private $config;
  6274. private $baseDir;
  6275. private $repositories;
  6276. private $configSource;
  6277. private $authConfigSource;
  6278. private $useEnvironment;
  6279. private $warnedHosts = array();
  6280. public function __construct($useEnvironment = true, $baseDir = null)
  6281. {
  6282. $this->config = static::$defaultConfig;
  6283. $this->repositories = static::$defaultRepositories;
  6284. $this->useEnvironment = (bool) $useEnvironment;
  6285. $this->baseDir = $baseDir;
  6286. }
  6287. public function setConfigSource(ConfigSourceInterface $source)
  6288. {
  6289. $this->configSource = $source;
  6290. }
  6291. public function getConfigSource()
  6292. {
  6293. return $this->configSource;
  6294. }
  6295. public function setAuthConfigSource(ConfigSourceInterface $source)
  6296. {
  6297. $this->authConfigSource = $source;
  6298. }
  6299. public function getAuthConfigSource()
  6300. {
  6301. return $this->authConfigSource;
  6302. }
  6303. public function merge($config)
  6304. {
  6305. if (!empty($config['config']) && is_array($config['config'])) {
  6306. foreach ($config['config'] as $key => $val) {
  6307. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic')) && isset($this->config[$key])) {
  6308. $this->config[$key] = array_merge($this->config[$key], $val);
  6309. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  6310. if (is_array($val) || is_array($this->config[$key])) {
  6311. if (is_string($val)) {
  6312. $val = array('*' => $val);
  6313. }
  6314. if (is_string($this->config[$key])) {
  6315. $this->config[$key] = array('*' => $this->config[$key]);
  6316. }
  6317. $this->config[$key] = array_merge($this->config[$key], $val);
  6318. if (isset($this->config[$key]['*'])) {
  6319. $wildcard = $this->config[$key]['*'];
  6320. unset($this->config[$key]['*']);
  6321. $this->config[$key]['*'] = $wildcard;
  6322. }
  6323. } else {
  6324. $this->config[$key] = $val;
  6325. }
  6326. } else {
  6327. $this->config[$key] = $val;
  6328. }
  6329. }
  6330. }
  6331. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  6332. $this->repositories = array_reverse($this->repositories, true);
  6333. $newRepos = array_reverse($config['repositories'], true);
  6334. foreach ($newRepos as $name => $repository) {
  6335. if (false === $repository) {
  6336. $this->disableRepoByName($name);
  6337. continue;
  6338. }
  6339. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  6340. $this->disableRepoByName(key($repository));
  6341. continue;
  6342. }
  6343. if (is_int($name)) {
  6344. $this->repositories[] = $repository;
  6345. } else {
  6346. if ($name === 'packagist') {
  6347. $this->repositories[$name . '.org'] = $repository;
  6348. } else {
  6349. $this->repositories[$name] = $repository;
  6350. }
  6351. }
  6352. }
  6353. $this->repositories = array_reverse($this->repositories, true);
  6354. }
  6355. }
  6356. public function getRepositories()
  6357. {
  6358. return $this->repositories;
  6359. }
  6360. public function get($key, $flags = 0)
  6361. {
  6362. switch ($key) {
  6363. case 'vendor-dir':
  6364. case 'bin-dir':
  6365. case 'process-timeout':
  6366. case 'data-dir':
  6367. case 'cache-dir':
  6368. case 'cache-files-dir':
  6369. case 'cache-repo-dir':
  6370. case 'cache-vcs-dir':
  6371. case 'cafile':
  6372. case 'capath':
  6373. case 'htaccess-protect':
  6374. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  6375. $val = $this->getComposerEnv($env);
  6376. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  6377. $val = Platform::expandPath($val);
  6378. if (substr($key, -4) !== '-dir') {
  6379. return $val;
  6380. }
  6381. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  6382. case 'cache-ttl':
  6383. return (int) $this->config[$key];
  6384. case 'cache-files-maxsize':
  6385. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  6386. throw new \RuntimeException(
  6387. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  6388. );
  6389. }
  6390. $size = $matches[1];
  6391. if (isset($matches[2])) {
  6392. switch (strtolower($matches[2])) {
  6393. case 'g':
  6394. $size *= 1024;
  6395. case 'm':
  6396. $size *= 1024;
  6397. case 'k':
  6398. $size *= 1024;
  6399. break;
  6400. }
  6401. }
  6402. return $size;
  6403. case 'cache-files-ttl':
  6404. if (isset($this->config[$key])) {
  6405. return (int) $this->config[$key];
  6406. }
  6407. return (int) $this->config['cache-ttl'];
  6408. case 'home':
  6409. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  6410. return rtrim($this->process($val, $flags), '/\\');
  6411. case 'bin-compat':
  6412. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  6413. if (!in_array($value, array('auto', 'full'))) {
  6414. throw new \RuntimeException(
  6415. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  6416. );
  6417. }
  6418. return $value;
  6419. case 'discard-changes':
  6420. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  6421. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  6422. throw new \RuntimeException(
  6423. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  6424. );
  6425. }
  6426. if ('stash' === $env) {
  6427. return 'stash';
  6428. }
  6429. return $env !== 'false' && (bool) $env;
  6430. }
  6431. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  6432. throw new \RuntimeException(
  6433. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  6434. );
  6435. }
  6436. return $this->config[$key];
  6437. case 'github-protocols':
  6438. $protos = $this->config['github-protocols'];
  6439. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  6440. unset($protos[$index]);
  6441. }
  6442. if (reset($protos) === 'http') {
  6443. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  6444. }
  6445. return $protos;
  6446. case 'disable-tls':
  6447. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6448. case 'secure-http':
  6449. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6450. default:
  6451. if (!isset($this->config[$key])) {
  6452. return null;
  6453. }
  6454. return $this->process($this->config[$key], $flags);
  6455. }
  6456. }
  6457. public function all($flags = 0)
  6458. {
  6459. $all = array(
  6460. 'repositories' => $this->getRepositories(),
  6461. );
  6462. foreach (array_keys($this->config) as $key) {
  6463. $all['config'][$key] = $this->get($key, $flags);
  6464. }
  6465. return $all;
  6466. }
  6467. public function raw()
  6468. {
  6469. return array(
  6470. 'repositories' => $this->getRepositories(),
  6471. 'config' => $this->config,
  6472. );
  6473. }
  6474. public function has($key)
  6475. {
  6476. return array_key_exists($key, $this->config);
  6477. }
  6478. private function process($value, $flags)
  6479. {
  6480. $config = $this;
  6481. if (!is_string($value)) {
  6482. return $value;
  6483. }
  6484. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  6485. return $config->get($match[1], $flags);
  6486. }, $value);
  6487. }
  6488. private function realpath($path)
  6489. {
  6490. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  6491. return $path;
  6492. }
  6493. return $this->baseDir . '/' . $path;
  6494. }
  6495. private function getComposerEnv($var)
  6496. {
  6497. if ($this->useEnvironment) {
  6498. return getenv($var);
  6499. }
  6500. return false;
  6501. }
  6502. private function disableRepoByName($name)
  6503. {
  6504. if (isset($this->repositories[$name])) {
  6505. unset($this->repositories[$name]);
  6506. } elseif ($name === 'packagist') {
  6507. unset($this->repositories['packagist.org']);
  6508. }
  6509. }
  6510. public function prohibitUrlByConfig($url, IOInterface $io = null)
  6511. {
  6512. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  6513. return;
  6514. }
  6515. $scheme = parse_url($url, PHP_URL_SCHEME);
  6516. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  6517. if ($this->get('secure-http')) {
  6518. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  6519. } elseif ($io) {
  6520. $host = parse_url($url, PHP_URL_HOST);
  6521. if (!isset($this->warnedHosts[$host])) {
  6522. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  6523. }
  6524. $this->warnedHosts[$host] = true;
  6525. }
  6526. }
  6527. }
  6528. }
  6529. <?php
  6530. namespace Composer\Config;
  6531. interface ConfigSourceInterface
  6532. {
  6533. public function addRepository($name, $config);
  6534. public function removeRepository($name);
  6535. public function addConfigSetting($name, $value);
  6536. public function removeConfigSetting($name);
  6537. public function addProperty($name, $value);
  6538. public function removeProperty($name);
  6539. public function addLink($type, $name, $value);
  6540. public function removeLink($type, $name);
  6541. public function getName();
  6542. }
  6543. <?php
  6544. namespace Composer\Config;
  6545. use Composer\Json\JsonFile;
  6546. use Composer\Json\JsonManipulator;
  6547. use Composer\Util\Silencer;
  6548. class JsonConfigSource implements ConfigSourceInterface
  6549. {
  6550. private $file;
  6551. private $authConfig;
  6552. public function __construct(JsonFile $file, $authConfig = false)
  6553. {
  6554. $this->file = $file;
  6555. $this->authConfig = $authConfig;
  6556. }
  6557. public function getName()
  6558. {
  6559. return $this->file->getPath();
  6560. }
  6561. public function addRepository($name, $config)
  6562. {
  6563. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  6564. if (isset($config['repositories'])) {
  6565. foreach ($config['repositories'] as $index => $val) {
  6566. if ($index === $repo) {
  6567. continue;
  6568. }
  6569. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  6570. unset($config['repositories'][$index]);
  6571. $config['repositories']['packagist.org'] = false;
  6572. break;
  6573. }
  6574. }
  6575. }
  6576. $config['repositories'][$repo] = $repoConfig;
  6577. });
  6578. }
  6579. public function removeRepository($name)
  6580. {
  6581. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  6582. unset($config['repositories'][$repo]);
  6583. });
  6584. }
  6585. public function addConfigSetting($name, $value)
  6586. {
  6587. $authConfig = $this->authConfig;
  6588. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  6589. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6590. list($key, $host) = explode('.', $key, 2);
  6591. if ($authConfig) {
  6592. $config[$key][$host] = $val;
  6593. } else {
  6594. $config['config'][$key][$host] = $val;
  6595. }
  6596. } else {
  6597. $config['config'][$key] = $val;
  6598. }
  6599. });
  6600. }
  6601. public function removeConfigSetting($name)
  6602. {
  6603. $authConfig = $this->authConfig;
  6604. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  6605. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  6606. list($key, $host) = explode('.', $key, 2);
  6607. if ($authConfig) {
  6608. unset($config[$key][$host]);
  6609. } else {
  6610. unset($config['config'][$key][$host]);
  6611. }
  6612. } else {
  6613. unset($config['config'][$key]);
  6614. }
  6615. });
  6616. }
  6617. public function addProperty($name, $value)
  6618. {
  6619. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  6620. if (substr($key, 0, 6) === 'extra.') {
  6621. $bits = explode('.', $key);
  6622. $last = array_pop($bits);
  6623. $arr = &$config['extra'];
  6624. foreach ($bits as $bit) {
  6625. if (!isset($arr[$bit])) {
  6626. $arr[$bit] = array();
  6627. }
  6628. $arr = &$arr[$bit];
  6629. }
  6630. $arr[$last] = $val;
  6631. } else {
  6632. $config[$key] = $val;
  6633. }
  6634. });
  6635. }
  6636. public function removeProperty($name)
  6637. {
  6638. $authConfig = $this->authConfig;
  6639. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  6640. if (substr($key, 0, 6) === 'extra.') {
  6641. $bits = explode('.', $key);
  6642. $last = array_pop($bits);
  6643. $arr = &$config['extra'];
  6644. foreach ($bits as $bit) {
  6645. if (!isset($arr[$bit])) {
  6646. return;
  6647. }
  6648. $arr = &$arr[$bit];
  6649. }
  6650. unset($arr[$last]);
  6651. } else {
  6652. unset($config[$key]);
  6653. }
  6654. });
  6655. }
  6656. public function addLink($type, $name, $value)
  6657. {
  6658. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  6659. $config[$type][$name] = $value;
  6660. });
  6661. }
  6662. public function removeLink($type, $name)
  6663. {
  6664. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  6665. unset($config[$type][$name]);
  6666. });
  6667. }
  6668. protected function manipulateJson($method, $args, $fallback)
  6669. {
  6670. $args = func_get_args();
  6671. array_shift($args);
  6672. $fallback = array_pop($args);
  6673. if ($this->file->exists()) {
  6674. if (!is_writable($this->file->getPath())) {
  6675. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  6676. }
  6677. if (!is_readable($this->file->getPath())) {
  6678. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  6679. }
  6680. $contents = file_get_contents($this->file->getPath());
  6681. } elseif ($this->authConfig) {
  6682. $contents = "{\n}\n";
  6683. } else {
  6684. $contents = "{\n \"config\": {\n }\n}\n";
  6685. }
  6686. $manipulator = new JsonManipulator($contents);
  6687. $newFile = !$this->file->exists();
  6688. if ($this->authConfig && $method === 'addConfigSetting') {
  6689. $method = 'addSubNode';
  6690. list($mainNode, $name) = explode('.', $args[0], 2);
  6691. $args = array($mainNode, $name, $args[1]);
  6692. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  6693. $method = 'removeSubNode';
  6694. list($mainNode, $name) = explode('.', $args[0], 2);
  6695. $args = array($mainNode, $name);
  6696. }
  6697. if (call_user_func_array(array($manipulator, $method), $args)) {
  6698. file_put_contents($this->file->getPath(), $manipulator->getContents());
  6699. } else {
  6700. $config = $this->file->read();
  6701. $this->arrayUnshiftRef($args, $config);
  6702. call_user_func_array($fallback, $args);
  6703. $this->file->write($config);
  6704. }
  6705. if ($newFile) {
  6706. Silencer::call('chmod', $this->file->getPath(), 0600);
  6707. }
  6708. }
  6709. private function arrayUnshiftRef(&$array, &$value)
  6710. {
  6711. $return = array_unshift($array, '');
  6712. $array[0] = &$value;
  6713. return $return;
  6714. }
  6715. }
  6716. <?php
  6717. namespace Composer\Console;
  6718. use Composer\Util\Platform;
  6719. use Composer\Util\Silencer;
  6720. use Symfony\Component\Console\Application as BaseApplication;
  6721. use Symfony\Component\Console\Input\InputInterface;
  6722. use Symfony\Component\Console\Input\InputOption;
  6723. use Symfony\Component\Console\Output\OutputInterface;
  6724. use Composer\Command;
  6725. use Composer\Composer;
  6726. use Composer\Factory;
  6727. use Composer\IO\IOInterface;
  6728. use Composer\IO\ConsoleIO;
  6729. use Composer\Json\JsonValidationException;
  6730. use Composer\Util\ErrorHandler;
  6731. use Composer\EventDispatcher\ScriptExecutionException;
  6732. use Composer\Exception\NoSslException;
  6733. class Application extends BaseApplication
  6734. {
  6735. protected $composer;
  6736. protected $io;
  6737. private static $logo = ' ______
  6738. / ____/___ ____ ___ ____ ____ ________ _____
  6739. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  6740. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  6741. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  6742. /_/
  6743. ';
  6744. private $hasPluginCommands = false;
  6745. private $disablePluginsByDefault = false;
  6746. public function __construct()
  6747. {
  6748. static $shutdownRegistered = false;
  6749. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  6750. ini_set('xdebug.show_exception_trace', false);
  6751. ini_set('xdebug.scream', false);
  6752. }
  6753. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  6754. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  6755. }
  6756. if (!$shutdownRegistered) {
  6757. $shutdownRegistered = true;
  6758. register_shutdown_function(function () {
  6759. $lastError = error_get_last();
  6760. if ($lastError && $lastError['message'] &&
  6761. (strpos($lastError['message'], 'Allowed memory') !== false ||
  6762. strpos($lastError['message'], 'exceeded memory') !== false )) {
  6763. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  6764. }
  6765. });
  6766. }
  6767. parent::__construct('Composer', Composer::VERSION);
  6768. }
  6769. public function run(InputInterface $input = null, OutputInterface $output = null)
  6770. {
  6771. if (null === $output) {
  6772. $output = Factory::createOutput();
  6773. }
  6774. return parent::run($input, $output);
  6775. }
  6776. public function doRun(InputInterface $input, OutputInterface $output)
  6777. {
  6778. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  6779. $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
  6780. ErrorHandler::register($io);
  6781. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  6782. $oldWorkingDir = getcwd();
  6783. chdir($newWorkDir);
  6784. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  6785. }
  6786. $commandName = '';
  6787. if ($name = $this->getCommandName($input)) {
  6788. try {
  6789. $commandName = $this->find($name)->getName();
  6790. } catch (\InvalidArgumentException $e) {
  6791. }
  6792. }
  6793. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) {
  6794. $dir = dirname(getcwd());
  6795. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  6796. while (dirname($dir) !== $dir && $dir !== $home) {
  6797. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  6798. if ($io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ', true)) {
  6799. $oldWorkingDir = getcwd();
  6800. chdir($dir);
  6801. }
  6802. break;
  6803. }
  6804. $dir = dirname($dir);
  6805. }
  6806. }
  6807. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  6808. try {
  6809. foreach ($this->getPluginCommands() as $command) {
  6810. if ($this->has($command->getName())) {
  6811. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  6812. } else {
  6813. $this->add($command);
  6814. }
  6815. }
  6816. } catch (NoSslException $e) {
  6817. }
  6818. $this->hasPluginCommands = true;
  6819. }
  6820. $isProxyCommand = false;
  6821. if ($name = $this->getCommandName($input)) {
  6822. try {
  6823. $command = $this->find($name);
  6824. $commandName = $command->getName();
  6825. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  6826. } catch (\InvalidArgumentException $e) {
  6827. }
  6828. }
  6829. if (!$isProxyCommand) {
  6830. $io->writeError(sprintf(
  6831. 'Running %s (%s) with %s on %s',
  6832. Composer::VERSION,
  6833. Composer::RELEASE_DATE,
  6834. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  6835. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  6836. ), true, IOInterface::DEBUG);
  6837. if (PHP_VERSION_ID < 50302) {
  6838. $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
  6839. }
  6840. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  6841. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  6842. }
  6843. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  6844. $io->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
  6845. }
  6846. if (getenv('COMPOSER_NO_INTERACTION')) {
  6847. $input->setInteractive(false);
  6848. }
  6849. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
  6850. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  6851. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  6852. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  6853. }
  6854. if ($uid = (int) getenv('SUDO_UID')) {
  6855. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  6856. }
  6857. }
  6858. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  6859. }
  6860. Silencer::call(function () use ($io) {
  6861. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  6862. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  6863. $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
  6864. }
  6865. });
  6866. $file = Factory::getComposerFile();
  6867. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  6868. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  6869. foreach ($composer['scripts'] as $script => $dummy) {
  6870. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  6871. if ($this->has($script)) {
  6872. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  6873. } else {
  6874. $description = null;
  6875. if (isset($composer['scripts-descriptions'][$script])) {
  6876. $description = $composer['scripts-descriptions'][$script];
  6877. }
  6878. $this->add(new Command\ScriptAliasCommand($script, $description));
  6879. }
  6880. }
  6881. }
  6882. }
  6883. }
  6884. }
  6885. try {
  6886. if ($input->hasParameterOption('--profile')) {
  6887. $startTime = microtime(true);
  6888. $this->io->enableDebugging($startTime);
  6889. }
  6890. $result = parent::doRun($input, $output);
  6891. if (isset($oldWorkingDir)) {
  6892. chdir($oldWorkingDir);
  6893. }
  6894. if (isset($startTime)) {
  6895. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MB), time: '.round(microtime(true) - $startTime, 2).'s');
  6896. }
  6897. restore_error_handler();
  6898. return $result;
  6899. } catch (ScriptExecutionException $e) {
  6900. return $e->getCode();
  6901. } catch (\Exception $e) {
  6902. $this->hintCommonErrors($e);
  6903. restore_error_handler();
  6904. throw $e;
  6905. }
  6906. }
  6907. private function getNewWorkingDir(InputInterface $input)
  6908. {
  6909. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  6910. if (false !== $workingDir && !is_dir($workingDir)) {
  6911. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  6912. }
  6913. return $workingDir;
  6914. }
  6915. private function hintCommonErrors($exception)
  6916. {
  6917. $io = $this->getIO();
  6918. Silencer::suppress();
  6919. try {
  6920. $composer = $this->getComposer(false, true);
  6921. if ($composer) {
  6922. $config = $composer->getConfig();
  6923. $minSpaceFree = 1024 * 1024;
  6924. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  6925. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  6926. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  6927. ) {
  6928. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  6929. }
  6930. }
  6931. } catch (\Exception $e) {
  6932. }
  6933. Silencer::restore();
  6934. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  6935. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  6936. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>', true, IOInterface::QUIET);
  6937. }
  6938. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  6939. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  6940. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  6941. }
  6942. }
  6943. public function getComposer($required = true, $disablePlugins = null)
  6944. {
  6945. if (null === $disablePlugins) {
  6946. $disablePlugins = $this->disablePluginsByDefault;
  6947. }
  6948. if (null === $this->composer) {
  6949. try {
  6950. $this->composer = Factory::create($this->io, null, $disablePlugins);
  6951. } catch (\InvalidArgumentException $e) {
  6952. if ($required) {
  6953. $this->io->writeError($e->getMessage());
  6954. exit(1);
  6955. }
  6956. } catch (JsonValidationException $e) {
  6957. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  6958. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  6959. throw new JsonValidationException($message);
  6960. }
  6961. }
  6962. return $this->composer;
  6963. }
  6964. public function resetComposer()
  6965. {
  6966. $this->composer = null;
  6967. }
  6968. public function getIO()
  6969. {
  6970. return $this->io;
  6971. }
  6972. public function getHelp()
  6973. {
  6974. return self::$logo . parent::getHelp();
  6975. }
  6976. protected function getDefaultCommands()
  6977. {
  6978. $commands = array_merge(parent::getDefaultCommands(), array(
  6979. new Command\AboutCommand(),
  6980. new Command\ConfigCommand(),
  6981. new Command\DependsCommand(),
  6982. new Command\ProhibitsCommand(),
  6983. new Command\InitCommand(),
  6984. new Command\InstallCommand(),
  6985. new Command\CreateProjectCommand(),
  6986. new Command\UpdateCommand(),
  6987. new Command\SearchCommand(),
  6988. new Command\ValidateCommand(),
  6989. new Command\ShowCommand(),
  6990. new Command\SuggestsCommand(),
  6991. new Command\RequireCommand(),
  6992. new Command\DumpAutoloadCommand(),
  6993. new Command\StatusCommand(),
  6994. new Command\ArchiveCommand(),
  6995. new Command\DiagnoseCommand(),
  6996. new Command\RunScriptCommand(),
  6997. new Command\LicensesCommand(),
  6998. new Command\GlobalCommand(),
  6999. new Command\ClearCacheCommand(),
  7000. new Command\RemoveCommand(),
  7001. new Command\HomeCommand(),
  7002. new Command\ExecCommand(),
  7003. new Command\OutdatedCommand(),
  7004. new Command\CheckPlatformReqsCommand(),
  7005. ));
  7006. if ('phar:' === substr(__FILE__, 0, 5)) {
  7007. $commands[] = new Command\SelfUpdateCommand();
  7008. }
  7009. return $commands;
  7010. }
  7011. public function getLongVersion()
  7012. {
  7013. if (Composer::BRANCH_ALIAS_VERSION) {
  7014. return sprintf(
  7015. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  7016. $this->getName(),
  7017. Composer::BRANCH_ALIAS_VERSION,
  7018. $this->getVersion(),
  7019. Composer::RELEASE_DATE
  7020. );
  7021. }
  7022. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  7023. }
  7024. protected function getDefaultInputDefinition()
  7025. {
  7026. $definition = parent::getDefaultInputDefinition();
  7027. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  7028. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  7029. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  7030. return $definition;
  7031. }
  7032. private function getPluginCommands()
  7033. {
  7034. $commands = array();
  7035. $composer = $this->getComposer(false, false);
  7036. if (null === $composer) {
  7037. $composer = Factory::createGlobal($this->io, false);
  7038. }
  7039. if (null !== $composer) {
  7040. $pm = $composer->getPluginManager();
  7041. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  7042. $newCommands = $capability->getCommands();
  7043. if (!is_array($newCommands)) {
  7044. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  7045. }
  7046. foreach ($newCommands as $command) {
  7047. if (!$command instanceof Command\BaseCommand) {
  7048. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  7049. }
  7050. }
  7051. $commands = array_merge($commands, $newCommands);
  7052. }
  7053. }
  7054. return $commands;
  7055. }
  7056. }
  7057. <?php
  7058. namespace Composer\Console;
  7059. use Symfony\Component\Console\Formatter\OutputFormatter;
  7060. class HtmlOutputFormatter extends OutputFormatter
  7061. {
  7062. private static $availableForegroundColors = array(
  7063. 30 => 'black',
  7064. 31 => 'red',
  7065. 32 => 'green',
  7066. 33 => 'yellow',
  7067. 34 => 'blue',
  7068. 35 => 'magenta',
  7069. 36 => 'cyan',
  7070. 37 => 'white',
  7071. );
  7072. private static $availableBackgroundColors = array(
  7073. 40 => 'black',
  7074. 41 => 'red',
  7075. 42 => 'green',
  7076. 43 => 'yellow',
  7077. 44 => 'blue',
  7078. 45 => 'magenta',
  7079. 46 => 'cyan',
  7080. 47 => 'white',
  7081. );
  7082. private static $availableOptions = array(
  7083. 1 => 'bold',
  7084. 4 => 'underscore',
  7085. );
  7086. public function __construct(array $styles = array())
  7087. {
  7088. parent::__construct(true, $styles);
  7089. }
  7090. public function format($message)
  7091. {
  7092. $formatted = parent::format($message);
  7093. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  7094. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  7095. }
  7096. private function formatHtml($matches)
  7097. {
  7098. $out = '<span style="';
  7099. foreach (explode(';', $matches[1]) as $code) {
  7100. if (isset(self::$availableForegroundColors[$code])) {
  7101. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  7102. } elseif (isset(self::$availableBackgroundColors[$code])) {
  7103. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  7104. } elseif (isset(self::$availableOptions[$code])) {
  7105. switch (self::$availableOptions[$code]) {
  7106. case 'bold':
  7107. $out .= 'font-weight:bold;';
  7108. break;
  7109. case 'underscore':
  7110. $out .= 'text-decoration:underline;';
  7111. break;
  7112. }
  7113. }
  7114. }
  7115. return $out.'">'.$matches[2].'</span>';
  7116. }
  7117. }
  7118. <?php
  7119. namespace Composer\DependencyResolver;
  7120. class Decisions implements \Iterator, \Countable
  7121. {
  7122. const DECISION_LITERAL = 0;
  7123. const DECISION_REASON = 1;
  7124. protected $pool;
  7125. protected $decisionMap;
  7126. protected $decisionQueue = array();
  7127. public function __construct($pool)
  7128. {
  7129. $this->pool = $pool;
  7130. $this->decisionMap = array();
  7131. }
  7132. public function decide($literal, $level, $why)
  7133. {
  7134. $this->addDecision($literal, $level);
  7135. $this->decisionQueue[] = array(
  7136. self::DECISION_LITERAL => $literal,
  7137. self::DECISION_REASON => $why,
  7138. );
  7139. }
  7140. public function satisfy($literal)
  7141. {
  7142. $packageId = abs($literal);
  7143. return (
  7144. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  7145. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  7146. );
  7147. }
  7148. public function conflict($literal)
  7149. {
  7150. $packageId = abs($literal);
  7151. return (
  7152. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  7153. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  7154. );
  7155. }
  7156. public function decided($literalOrPackageId)
  7157. {
  7158. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  7159. }
  7160. public function undecided($literalOrPackageId)
  7161. {
  7162. return empty($this->decisionMap[abs($literalOrPackageId)]);
  7163. }
  7164. public function decidedInstall($literalOrPackageId)
  7165. {
  7166. $packageId = abs($literalOrPackageId);
  7167. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  7168. }
  7169. public function decisionLevel($literalOrPackageId)
  7170. {
  7171. $packageId = abs($literalOrPackageId);
  7172. if (isset($this->decisionMap[$packageId])) {
  7173. return abs($this->decisionMap[$packageId]);
  7174. }
  7175. return 0;
  7176. }
  7177. public function decisionRule($literalOrPackageId)
  7178. {
  7179. $packageId = abs($literalOrPackageId);
  7180. foreach ($this->decisionQueue as $i => $decision) {
  7181. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  7182. return $decision[self::DECISION_REASON];
  7183. }
  7184. }
  7185. return null;
  7186. }
  7187. public function atOffset($queueOffset)
  7188. {
  7189. return $this->decisionQueue[$queueOffset];
  7190. }
  7191. public function validOffset($queueOffset)
  7192. {
  7193. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  7194. }
  7195. public function lastReason()
  7196. {
  7197. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  7198. }
  7199. public function lastLiteral()
  7200. {
  7201. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  7202. }
  7203. public function reset()
  7204. {
  7205. while ($decision = array_pop($this->decisionQueue)) {
  7206. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7207. }
  7208. }
  7209. public function resetToOffset($offset)
  7210. {
  7211. while (count($this->decisionQueue) > $offset + 1) {
  7212. $decision = array_pop($this->decisionQueue);
  7213. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7214. }
  7215. }
  7216. public function revertLast()
  7217. {
  7218. $this->decisionMap[abs($this->lastLiteral())] = 0;
  7219. array_pop($this->decisionQueue);
  7220. }
  7221. public function count()
  7222. {
  7223. return count($this->decisionQueue);
  7224. }
  7225. public function rewind()
  7226. {
  7227. end($this->decisionQueue);
  7228. }
  7229. public function current()
  7230. {
  7231. return current($this->decisionQueue);
  7232. }
  7233. public function key()
  7234. {
  7235. return key($this->decisionQueue);
  7236. }
  7237. public function next()
  7238. {
  7239. return prev($this->decisionQueue);
  7240. }
  7241. public function valid()
  7242. {
  7243. return false !== current($this->decisionQueue);
  7244. }
  7245. public function isEmpty()
  7246. {
  7247. return count($this->decisionQueue) === 0;
  7248. }
  7249. protected function addDecision($literal, $level)
  7250. {
  7251. $packageId = abs($literal);
  7252. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  7253. if ($previousDecision != 0) {
  7254. $literalString = $this->pool->literalToString($literal);
  7255. $package = $this->pool->literalToPackage($literal);
  7256. throw new SolverBugException(
  7257. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  7258. );
  7259. }
  7260. if ($literal > 0) {
  7261. $this->decisionMap[$packageId] = $level;
  7262. } else {
  7263. $this->decisionMap[$packageId] = -$level;
  7264. }
  7265. }
  7266. }
  7267. <?php
  7268. namespace Composer\DependencyResolver;
  7269. use Composer\Package\PackageInterface;
  7270. use Composer\Package\AliasPackage;
  7271. use Composer\Package\BasePackage;
  7272. use Composer\Semver\Constraint\Constraint;
  7273. class DefaultPolicy implements PolicyInterface
  7274. {
  7275. private $preferStable;
  7276. private $preferLowest;
  7277. public function __construct($preferStable = false, $preferLowest = false)
  7278. {
  7279. $this->preferStable = $preferStable;
  7280. $this->preferLowest = $preferLowest;
  7281. }
  7282. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  7283. {
  7284. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  7285. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  7286. }
  7287. $constraint = new Constraint($operator, $b->getVersion());
  7288. $version = new Constraint('==', $a->getVersion());
  7289. return $constraint->matchSpecific($version, true);
  7290. }
  7291. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  7292. {
  7293. $packages = array();
  7294. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  7295. if ($candidate !== $package) {
  7296. $packages[] = $candidate;
  7297. }
  7298. }
  7299. return $packages;
  7300. }
  7301. public function getPriority(Pool $pool, PackageInterface $package)
  7302. {
  7303. return $pool->getPriority($package->getRepository());
  7304. }
  7305. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  7306. {
  7307. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  7308. foreach ($packages as &$literals) {
  7309. $policy = $this;
  7310. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7311. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  7312. });
  7313. }
  7314. foreach ($packages as &$literals) {
  7315. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  7316. $literals = $this->pruneToBestVersion($pool, $literals);
  7317. $literals = $this->pruneRemoteAliases($pool, $literals);
  7318. }
  7319. $selected = call_user_func_array('array_merge', $packages);
  7320. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7321. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  7322. });
  7323. return $selected;
  7324. }
  7325. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  7326. {
  7327. $packages = array();
  7328. foreach ($literals as $literal) {
  7329. $packageName = $pool->literalToPackage($literal)->getName();
  7330. if (!isset($packages[$packageName])) {
  7331. $packages[$packageName] = array();
  7332. }
  7333. if (isset($installedMap[abs($literal)])) {
  7334. array_unshift($packages[$packageName], $literal);
  7335. } else {
  7336. $packages[$packageName][] = $literal;
  7337. }
  7338. }
  7339. return $packages;
  7340. }
  7341. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  7342. {
  7343. if ($a->getRepository() === $b->getRepository()) {
  7344. if ($a->getName() === $b->getName()) {
  7345. $aAliased = $a instanceof AliasPackage;
  7346. $bAliased = $b instanceof AliasPackage;
  7347. if ($aAliased && !$bAliased) {
  7348. return -1;
  7349. }
  7350. if (!$aAliased && $bAliased) {
  7351. return 1;
  7352. }
  7353. }
  7354. if (!$ignoreReplace) {
  7355. if ($this->replaces($a, $b)) {
  7356. return 1;
  7357. }
  7358. if ($this->replaces($b, $a)) {
  7359. return -1;
  7360. }
  7361. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  7362. $requiredVendor = substr($requiredPackage, 0, $pos);
  7363. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  7364. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  7365. if ($bIsSameVendor !== $aIsSameVendor) {
  7366. return $aIsSameVendor ? -1 : 1;
  7367. }
  7368. }
  7369. }
  7370. if ($a->id === $b->id) {
  7371. return 0;
  7372. }
  7373. return ($a->id < $b->id) ? -1 : 1;
  7374. }
  7375. if (isset($installedMap[$a->id])) {
  7376. return -1;
  7377. }
  7378. if (isset($installedMap[$b->id])) {
  7379. return 1;
  7380. }
  7381. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  7382. }
  7383. protected function replaces(PackageInterface $source, PackageInterface $target)
  7384. {
  7385. foreach ($source->getReplaces() as $link) {
  7386. if ($link->getTarget() === $target->getName()
  7387. ) {
  7388. return true;
  7389. }
  7390. }
  7391. return false;
  7392. }
  7393. protected function pruneToBestVersion(Pool $pool, $literals)
  7394. {
  7395. $operator = $this->preferLowest ? '<' : '>';
  7396. $bestLiterals = array($literals[0]);
  7397. $bestPackage = $pool->literalToPackage($literals[0]);
  7398. foreach ($literals as $i => $literal) {
  7399. if (0 === $i) {
  7400. continue;
  7401. }
  7402. $package = $pool->literalToPackage($literal);
  7403. if ($this->versionCompare($package, $bestPackage, $operator)) {
  7404. $bestPackage = $package;
  7405. $bestLiterals = array($literal);
  7406. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  7407. $bestLiterals[] = $literal;
  7408. }
  7409. }
  7410. return $bestLiterals;
  7411. }
  7412. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  7413. {
  7414. $selected = array();
  7415. $priority = null;
  7416. foreach ($literals as $literal) {
  7417. $package = $pool->literalToPackage($literal);
  7418. if (isset($installedMap[$package->id])) {
  7419. $selected[] = $literal;
  7420. continue;
  7421. }
  7422. if (null === $priority) {
  7423. $priority = $this->getPriority($pool, $package);
  7424. }
  7425. if ($this->getPriority($pool, $package) != $priority) {
  7426. break;
  7427. }
  7428. $selected[] = $literal;
  7429. }
  7430. return $selected;
  7431. }
  7432. protected function pruneRemoteAliases(Pool $pool, array $literals)
  7433. {
  7434. $hasLocalAlias = false;
  7435. foreach ($literals as $literal) {
  7436. $package = $pool->literalToPackage($literal);
  7437. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7438. $hasLocalAlias = true;
  7439. break;
  7440. }
  7441. }
  7442. if (!$hasLocalAlias) {
  7443. return $literals;
  7444. }
  7445. $selected = array();
  7446. foreach ($literals as $literal) {
  7447. $package = $pool->literalToPackage($literal);
  7448. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7449. $selected[] = $literal;
  7450. }
  7451. }
  7452. return $selected;
  7453. }
  7454. }
  7455. <?php
  7456. namespace Composer\DependencyResolver;
  7457. use Composer\Package\PackageInterface;
  7458. use Composer\Package\Link;
  7459. class GenericRule extends Rule
  7460. {
  7461. protected $literals;
  7462. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7463. {
  7464. parent::__construct($reason, $reasonData, $job);
  7465. sort($literals);
  7466. $this->literals = $literals;
  7467. }
  7468. public function getLiterals()
  7469. {
  7470. return $this->literals;
  7471. }
  7472. public function getHash()
  7473. {
  7474. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7475. return $data['hash'];
  7476. }
  7477. public function equals(Rule $rule)
  7478. {
  7479. return $this->literals === $rule->getLiterals();
  7480. }
  7481. public function isAssertion()
  7482. {
  7483. return 1 === count($this->literals);
  7484. }
  7485. public function __toString()
  7486. {
  7487. $result = ($this->isDisabled()) ? 'disabled(' : '(';
  7488. foreach ($this->literals as $i => $literal) {
  7489. if ($i != 0) {
  7490. $result .= '|';
  7491. }
  7492. $result .= $literal;
  7493. }
  7494. $result .= ')';
  7495. return $result;
  7496. }
  7497. }
  7498. <?php
  7499. namespace Composer\DependencyResolver\Operation;
  7500. use Composer\Package\PackageInterface;
  7501. class InstallOperation extends SolverOperation
  7502. {
  7503. protected $package;
  7504. public function __construct(PackageInterface $package, $reason = null)
  7505. {
  7506. parent::__construct($reason);
  7507. $this->package = $package;
  7508. }
  7509. public function getPackage()
  7510. {
  7511. return $this->package;
  7512. }
  7513. public function getJobType()
  7514. {
  7515. return 'install';
  7516. }
  7517. public function __toString()
  7518. {
  7519. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7520. }
  7521. }
  7522. <?php
  7523. namespace Composer\DependencyResolver\Operation;
  7524. use Composer\Package\AliasPackage;
  7525. use Composer\Package\PackageInterface;
  7526. class MarkAliasInstalledOperation extends SolverOperation
  7527. {
  7528. protected $package;
  7529. public function __construct(AliasPackage $package, $reason = null)
  7530. {
  7531. parent::__construct($reason);
  7532. $this->package = $package;
  7533. }
  7534. public function getPackage()
  7535. {
  7536. return $this->package;
  7537. }
  7538. public function getJobType()
  7539. {
  7540. return 'markAliasInstalled';
  7541. }
  7542. public function __toString()
  7543. {
  7544. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7545. }
  7546. }
  7547. <?php
  7548. namespace Composer\DependencyResolver\Operation;
  7549. use Composer\Package\AliasPackage;
  7550. use Composer\Package\PackageInterface;
  7551. class MarkAliasUninstalledOperation extends SolverOperation
  7552. {
  7553. protected $package;
  7554. public function __construct(AliasPackage $package, $reason = null)
  7555. {
  7556. parent::__construct($reason);
  7557. $this->package = $package;
  7558. }
  7559. public function getPackage()
  7560. {
  7561. return $this->package;
  7562. }
  7563. public function getJobType()
  7564. {
  7565. return 'markAliasUninstalled';
  7566. }
  7567. public function __toString()
  7568. {
  7569. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  7570. }
  7571. }
  7572. <?php
  7573. namespace Composer\DependencyResolver\Operation;
  7574. interface OperationInterface
  7575. {
  7576. public function getJobType();
  7577. public function getReason();
  7578. public function __toString();
  7579. }
  7580. <?php
  7581. namespace Composer\DependencyResolver\Operation;
  7582. use Composer\Package\PackageInterface;
  7583. abstract class SolverOperation implements OperationInterface
  7584. {
  7585. protected $reason;
  7586. public function __construct($reason = null)
  7587. {
  7588. $this->reason = $reason;
  7589. }
  7590. public function getReason()
  7591. {
  7592. return $this->reason;
  7593. }
  7594. protected function formatVersion(PackageInterface $package)
  7595. {
  7596. return $package->getFullPrettyVersion();
  7597. }
  7598. }
  7599. <?php
  7600. namespace Composer\DependencyResolver\Operation;
  7601. use Composer\Package\PackageInterface;
  7602. class UninstallOperation extends SolverOperation
  7603. {
  7604. protected $package;
  7605. public function __construct(PackageInterface $package, $reason = null)
  7606. {
  7607. parent::__construct($reason);
  7608. $this->package = $package;
  7609. }
  7610. public function getPackage()
  7611. {
  7612. return $this->package;
  7613. }
  7614. public function getJobType()
  7615. {
  7616. return 'uninstall';
  7617. }
  7618. public function __toString()
  7619. {
  7620. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  7621. }
  7622. }
  7623. <?php
  7624. namespace Composer\DependencyResolver\Operation;
  7625. use Composer\Package\PackageInterface;
  7626. class UpdateOperation extends SolverOperation
  7627. {
  7628. protected $initialPackage;
  7629. protected $targetPackage;
  7630. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  7631. {
  7632. parent::__construct($reason);
  7633. $this->initialPackage = $initial;
  7634. $this->targetPackage = $target;
  7635. }
  7636. public function getInitialPackage()
  7637. {
  7638. return $this->initialPackage;
  7639. }
  7640. public function getTargetPackage()
  7641. {
  7642. return $this->targetPackage;
  7643. }
  7644. public function getJobType()
  7645. {
  7646. return 'update';
  7647. }
  7648. public function __toString()
  7649. {
  7650. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  7651. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  7652. }
  7653. }
  7654. <?php
  7655. namespace Composer\DependencyResolver;
  7656. use Composer\Package\PackageInterface;
  7657. interface PolicyInterface
  7658. {
  7659. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  7660. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  7661. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  7662. }
  7663. <?php
  7664. namespace Composer\DependencyResolver;
  7665. use Composer\Package\BasePackage;
  7666. use Composer\Package\AliasPackage;
  7667. use Composer\Package\Version\VersionParser;
  7668. use Composer\Semver\Constraint\ConstraintInterface;
  7669. use Composer\Semver\Constraint\Constraint;
  7670. use Composer\Semver\Constraint\EmptyConstraint;
  7671. use Composer\Repository\RepositoryInterface;
  7672. use Composer\Repository\CompositeRepository;
  7673. use Composer\Repository\ComposerRepository;
  7674. use Composer\Repository\InstalledRepositoryInterface;
  7675. use Composer\Repository\PlatformRepository;
  7676. use Composer\Package\PackageInterface;
  7677. class Pool implements \Countable
  7678. {
  7679. const MATCH_NAME = -1;
  7680. const MATCH_NONE = 0;
  7681. const MATCH = 1;
  7682. const MATCH_PROVIDE = 2;
  7683. const MATCH_REPLACE = 3;
  7684. const MATCH_FILTERED = 4;
  7685. protected $repositories = array();
  7686. protected $providerRepos = array();
  7687. protected $packages = array();
  7688. protected $packageByName = array();
  7689. protected $packageByExactName = array();
  7690. protected $acceptableStabilities;
  7691. protected $stabilityFlags;
  7692. protected $versionParser;
  7693. protected $providerCache = array();
  7694. protected $filterRequires;
  7695. protected $whitelist = null;
  7696. protected $id = 1;
  7697. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  7698. {
  7699. $this->versionParser = new VersionParser;
  7700. $this->acceptableStabilities = array();
  7701. foreach (BasePackage::$stabilities as $stability => $value) {
  7702. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  7703. $this->acceptableStabilities[$stability] = $value;
  7704. }
  7705. }
  7706. $this->stabilityFlags = $stabilityFlags;
  7707. $this->filterRequires = $filterRequires;
  7708. foreach ($filterRequires as $name => $constraint) {
  7709. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  7710. unset($this->filterRequires[$name]);
  7711. }
  7712. }
  7713. }
  7714. public function setWhitelist($whitelist)
  7715. {
  7716. $this->whitelist = $whitelist;
  7717. $this->providerCache = array();
  7718. }
  7719. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  7720. {
  7721. if ($repo instanceof CompositeRepository) {
  7722. $repos = $repo->getRepositories();
  7723. } else {
  7724. $repos = array($repo);
  7725. }
  7726. foreach ($repos as $repo) {
  7727. $this->repositories[] = $repo;
  7728. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  7729. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  7730. $this->providerRepos[] = $repo;
  7731. $repo->setRootAliases($rootAliases);
  7732. $repo->resetPackageIds();
  7733. } else {
  7734. foreach ($repo->getPackages() as $package) {
  7735. $names = $package->getNames();
  7736. $stability = $package->getStability();
  7737. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  7738. $package->setId($this->id++);
  7739. $this->packages[] = $package;
  7740. $this->packageByExactName[$package->getName()][$package->id] = $package;
  7741. foreach ($names as $provided) {
  7742. $this->packageByName[$provided][] = $package;
  7743. }
  7744. $name = $package->getName();
  7745. if (isset($rootAliases[$name][$package->getVersion()])) {
  7746. $alias = $rootAliases[$name][$package->getVersion()];
  7747. if ($package instanceof AliasPackage) {
  7748. $package = $package->getAliasOf();
  7749. }
  7750. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  7751. $aliasPackage->setRootPackageAlias(true);
  7752. $aliasPackage->setId($this->id++);
  7753. $package->getRepository()->addPackage($aliasPackage);
  7754. $this->packages[] = $aliasPackage;
  7755. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  7756. foreach ($aliasPackage->getNames() as $name) {
  7757. $this->packageByName[$name][] = $aliasPackage;
  7758. }
  7759. }
  7760. }
  7761. }
  7762. }
  7763. }
  7764. }
  7765. public function getPriority(RepositoryInterface $repo)
  7766. {
  7767. $priority = array_search($repo, $this->repositories, true);
  7768. if (false === $priority) {
  7769. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  7770. }
  7771. return -$priority;
  7772. }
  7773. public function packageById($id)
  7774. {
  7775. return $this->packages[$id - 1];
  7776. }
  7777. public function count()
  7778. {
  7779. return count($this->packages);
  7780. }
  7781. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  7782. {
  7783. if ($bypassFilters) {
  7784. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  7785. }
  7786. $key = ((int) $mustMatchName).$constraint;
  7787. if (isset($this->providerCache[$name][$key])) {
  7788. return $this->providerCache[$name][$key];
  7789. }
  7790. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  7791. }
  7792. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  7793. {
  7794. $candidates = array();
  7795. foreach ($this->providerRepos as $repo) {
  7796. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  7797. $candidates[] = $candidate;
  7798. if ($candidate->id < 1) {
  7799. $candidate->setId($this->id++);
  7800. $this->packages[$this->id - 2] = $candidate;
  7801. }
  7802. }
  7803. }
  7804. if ($mustMatchName) {
  7805. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  7806. return $candidate->getName() == $name;
  7807. });
  7808. if (isset($this->packageByExactName[$name])) {
  7809. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  7810. }
  7811. } elseif (isset($this->packageByName[$name])) {
  7812. $candidates = array_merge($candidates, $this->packageByName[$name]);
  7813. }
  7814. $matches = $provideMatches = array();
  7815. $nameMatch = false;
  7816. foreach ($candidates as $candidate) {
  7817. $aliasOfCandidate = null;
  7818. if ($candidate instanceof AliasPackage) {
  7819. $aliasOfCandidate = $candidate->getAliasOf();
  7820. }
  7821. if ($this->whitelist !== null && !$bypassFilters && (
  7822. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  7823. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  7824. )) {
  7825. continue;
  7826. }
  7827. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  7828. case self::MATCH_NONE:
  7829. break;
  7830. case self::MATCH_NAME:
  7831. $nameMatch = true;
  7832. break;
  7833. case self::MATCH:
  7834. $nameMatch = true;
  7835. $matches[] = $candidate;
  7836. break;
  7837. case self::MATCH_PROVIDE:
  7838. $provideMatches[] = $candidate;
  7839. break;
  7840. case self::MATCH_REPLACE:
  7841. $matches[] = $candidate;
  7842. break;
  7843. case self::MATCH_FILTERED:
  7844. break;
  7845. default:
  7846. throw new \UnexpectedValueException('Unexpected match type');
  7847. }
  7848. }
  7849. if ($nameMatch) {
  7850. return $matches;
  7851. }
  7852. return array_merge($matches, $provideMatches);
  7853. }
  7854. public function literalToPackage($literal)
  7855. {
  7856. $packageId = abs($literal);
  7857. return $this->packageById($packageId);
  7858. }
  7859. public function literalToPrettyString($literal, $installedMap)
  7860. {
  7861. $package = $this->literalToPackage($literal);
  7862. if (isset($installedMap[$package->id])) {
  7863. $prefix = ($literal > 0 ? 'keep' : 'remove');
  7864. } else {
  7865. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  7866. }
  7867. return $prefix.' '.$package->getPrettyString();
  7868. }
  7869. public function isPackageAcceptable($name, $stability)
  7870. {
  7871. foreach ((array) $name as $n) {
  7872. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  7873. return true;
  7874. }
  7875. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  7876. return true;
  7877. }
  7878. }
  7879. return false;
  7880. }
  7881. private function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  7882. {
  7883. $candidateName = $candidate->getName();
  7884. $candidateVersion = $candidate->getVersion();
  7885. $isDev = $candidate->getStability() === 'dev';
  7886. $isAlias = $candidate instanceof AliasPackage;
  7887. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  7888. $requireFilter = $this->filterRequires[$name];
  7889. } else {
  7890. $requireFilter = new EmptyConstraint;
  7891. }
  7892. if ($candidateName === $name) {
  7893. $pkgConstraint = new Constraint('==', $candidateVersion);
  7894. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  7895. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  7896. }
  7897. return self::MATCH_NAME;
  7898. }
  7899. $provides = $candidate->getProvides();
  7900. $replaces = $candidate->getReplaces();
  7901. if (isset($replaces[0]) || isset($provides[0])) {
  7902. foreach ($provides as $link) {
  7903. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  7904. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  7905. }
  7906. }
  7907. foreach ($replaces as $link) {
  7908. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  7909. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  7910. }
  7911. }
  7912. return self::MATCH_NONE;
  7913. }
  7914. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  7915. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  7916. }
  7917. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  7918. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  7919. }
  7920. return self::MATCH_NONE;
  7921. }
  7922. }
  7923. <?php
  7924. namespace Composer\DependencyResolver;
  7925. use Composer\Package\CompletePackageInterface;
  7926. class Problem
  7927. {
  7928. protected $reasonSeen;
  7929. protected $reasons = array();
  7930. protected $section = 0;
  7931. protected $pool;
  7932. public function __construct(Pool $pool)
  7933. {
  7934. $this->pool = $pool;
  7935. }
  7936. public function addRule(Rule $rule)
  7937. {
  7938. $this->addReason(spl_object_hash($rule), array(
  7939. 'rule' => $rule,
  7940. 'job' => $rule->getJob(),
  7941. ));
  7942. }
  7943. public function getReasons()
  7944. {
  7945. return $this->reasons;
  7946. }
  7947. public function getPrettyString(array $installedMap = array())
  7948. {
  7949. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  7950. if (count($reasons) === 1) {
  7951. reset($reasons);
  7952. $reason = current($reasons);
  7953. $rule = $reason['rule'];
  7954. $job = $reason['job'];
  7955. if (isset($job['constraint'])) {
  7956. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  7957. } else {
  7958. $packages = array();
  7959. }
  7960. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  7961. if ($job['packageName'] === 'php' || $job['packageName'] === 'php-64bit' || $job['packageName'] === 'hhvm') {
  7962. $version = phpversion();
  7963. $available = $this->pool->whatProvides($job['packageName']);
  7964. if (count($available)) {
  7965. $firstAvailable = reset($available);
  7966. $version = $firstAvailable->getPrettyVersion();
  7967. $extra = $firstAvailable->getExtra();
  7968. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  7969. $version .= '; ' . $firstAvailable->getDescription();
  7970. }
  7971. }
  7972. $msg = "\n - This package requires ".$job['packageName'].$this->constraintToText($job['constraint']).' but ';
  7973. if (defined('HHVM_VERSION')) {
  7974. return $msg . 'your HHVM version does not satisfy that requirement.';
  7975. }
  7976. if ($job['packageName'] === 'hhvm') {
  7977. return $msg . 'you are running this with PHP and not HHVM.';
  7978. }
  7979. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  7980. }
  7981. if (0 === stripos($job['packageName'], 'ext-')) {
  7982. if (false !== strpos($job['packageName'], ' ')) {
  7983. return "\n - The requested PHP extension ".$job['packageName'].' should be required as '.str_replace(' ', '-', $job['packageName']).'.';
  7984. }
  7985. $ext = substr($job['packageName'], 4);
  7986. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  7987. return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  7988. }
  7989. if (0 === stripos($job['packageName'], 'lib-')) {
  7990. if (strtolower($job['packageName']) === 'lib-icu') {
  7991. $error = extension_loaded('intl') ? 'has the wrong version installed, try upgrading the intl extension.' : 'is missing from your system, make sure the intl extension is loaded.';
  7992. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error;
  7993. }
  7994. return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  7995. }
  7996. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $job['packageName'])) {
  7997. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $job['packageName']);
  7998. return "\n - The requested package ".$job['packageName'].' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  7999. }
  8000. if ($providers = $this->pool->whatProvides($job['packageName'], $job['constraint'], true, true)) {
  8001. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  8002. }
  8003. if ($providers = $this->pool->whatProvides($job['packageName'], null, true, true)) {
  8004. return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  8005. }
  8006. return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';
  8007. }
  8008. }
  8009. $messages = array();
  8010. foreach ($reasons as $reason) {
  8011. $rule = $reason['rule'];
  8012. $job = $reason['job'];
  8013. if ($job) {
  8014. $messages[] = $this->jobToText($job);
  8015. } elseif ($rule) {
  8016. if ($rule instanceof Rule) {
  8017. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  8018. }
  8019. }
  8020. }
  8021. return "\n - ".implode("\n - ", $messages);
  8022. }
  8023. protected function addReason($id, $reason)
  8024. {
  8025. if (!isset($this->reasonSeen[$id])) {
  8026. $this->reasonSeen[$id] = true;
  8027. $this->reasons[$this->section][] = $reason;
  8028. }
  8029. }
  8030. public function nextSection()
  8031. {
  8032. $this->section++;
  8033. }
  8034. protected function jobToText($job)
  8035. {
  8036. switch ($job['cmd']) {
  8037. case 'install':
  8038. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8039. if (!$packages) {
  8040. return 'No package found to satisfy install request for '.$job['packageName'].$this->constraintToText($job['constraint']);
  8041. }
  8042. return 'Installation request for '.$job['packageName'].$this->constraintToText($job['constraint']).' -> satisfiable by '.$this->getPackageList($packages).'.';
  8043. case 'update':
  8044. return 'Update request for '.$job['packageName'].$this->constraintToText($job['constraint']).'.';
  8045. case 'remove':
  8046. return 'Removal request for '.$job['packageName'].$this->constraintToText($job['constraint']).'';
  8047. }
  8048. if (isset($job['constraint'])) {
  8049. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8050. } else {
  8051. $packages = array();
  8052. }
  8053. return 'Job(cmd='.$job['cmd'].', target='.$job['packageName'].', packages=['.$this->getPackageList($packages).'])';
  8054. }
  8055. protected function getPackageList($packages)
  8056. {
  8057. $prepared = array();
  8058. foreach ($packages as $package) {
  8059. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8060. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8061. }
  8062. foreach ($prepared as $name => $package) {
  8063. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8064. }
  8065. return implode(', ', $prepared);
  8066. }
  8067. protected function constraintToText($constraint)
  8068. {
  8069. return ($constraint) ? ' '.$constraint->getPrettyString() : '';
  8070. }
  8071. }
  8072. <?php
  8073. namespace Composer\DependencyResolver;
  8074. use Composer\Semver\Constraint\ConstraintInterface;
  8075. class Request
  8076. {
  8077. protected $jobs;
  8078. public function __construct()
  8079. {
  8080. $this->jobs = array();
  8081. }
  8082. public function install($packageName, ConstraintInterface $constraint = null)
  8083. {
  8084. $this->addJob($packageName, 'install', $constraint);
  8085. }
  8086. public function update($packageName, ConstraintInterface $constraint = null)
  8087. {
  8088. $this->addJob($packageName, 'update', $constraint);
  8089. }
  8090. public function remove($packageName, ConstraintInterface $constraint = null)
  8091. {
  8092. $this->addJob($packageName, 'remove', $constraint);
  8093. }
  8094. public function fix($packageName, ConstraintInterface $constraint = null)
  8095. {
  8096. $this->addJob($packageName, 'install', $constraint, true);
  8097. }
  8098. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  8099. {
  8100. $packageName = strtolower($packageName);
  8101. $this->jobs[] = array(
  8102. 'cmd' => $cmd,
  8103. 'packageName' => $packageName,
  8104. 'constraint' => $constraint,
  8105. 'fixed' => $fixed,
  8106. );
  8107. }
  8108. public function updateAll()
  8109. {
  8110. $this->jobs[] = array('cmd' => 'update-all');
  8111. }
  8112. public function getJobs()
  8113. {
  8114. return $this->jobs;
  8115. }
  8116. }
  8117. <?php
  8118. namespace Composer\DependencyResolver;
  8119. use Composer\Package\CompletePackage;
  8120. use Composer\Package\Link;
  8121. use Composer\Package\PackageInterface;
  8122. abstract class Rule
  8123. {
  8124. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  8125. const RULE_JOB_INSTALL = 2;
  8126. const RULE_JOB_REMOVE = 3;
  8127. const RULE_PACKAGE_CONFLICT = 6;
  8128. const RULE_PACKAGE_REQUIRES = 7;
  8129. const RULE_PACKAGE_OBSOLETES = 8;
  8130. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  8131. const RULE_PACKAGE_SAME_NAME = 10;
  8132. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  8133. const RULE_LEARNED = 12;
  8134. const RULE_PACKAGE_ALIAS = 13;
  8135. const BITFIELD_TYPE = 0;
  8136. const BITFIELD_REASON = 8;
  8137. const BITFIELD_DISABLED = 16;
  8138. protected $bitfield;
  8139. protected $reasonData;
  8140. public function __construct($reason, $reasonData, $job = null)
  8141. {
  8142. $this->reasonData = $reasonData;
  8143. if ($job) {
  8144. $this->job = $job;
  8145. }
  8146. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  8147. ($reason << self::BITFIELD_REASON) |
  8148. (255 << self::BITFIELD_TYPE);
  8149. }
  8150. abstract public function getLiterals();
  8151. abstract public function getHash();
  8152. public function getJob()
  8153. {
  8154. return isset($this->job) ? $this->job : null;
  8155. }
  8156. abstract public function equals(Rule $rule);
  8157. public function getReason()
  8158. {
  8159. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  8160. }
  8161. public function getReasonData()
  8162. {
  8163. return $this->reasonData;
  8164. }
  8165. public function getRequiredPackage()
  8166. {
  8167. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  8168. return $this->reasonData;
  8169. }
  8170. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  8171. return $this->reasonData->getTarget();
  8172. }
  8173. }
  8174. public function setType($type)
  8175. {
  8176. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  8177. }
  8178. public function getType()
  8179. {
  8180. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  8181. }
  8182. public function disable()
  8183. {
  8184. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  8185. }
  8186. public function enable()
  8187. {
  8188. $this->bitfield = $this->bitfield & ~(255 << self::BITFIELD_DISABLED);
  8189. }
  8190. public function isDisabled()
  8191. {
  8192. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8193. }
  8194. public function isEnabled()
  8195. {
  8196. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8197. }
  8198. abstract public function isAssertion();
  8199. public function getPrettyString(Pool $pool, array $installedMap = array())
  8200. {
  8201. $literals = $this->getLiterals();
  8202. $ruleText = '';
  8203. foreach ($literals as $i => $literal) {
  8204. if ($i != 0) {
  8205. $ruleText .= '|';
  8206. }
  8207. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  8208. }
  8209. switch ($this->getReason()) {
  8210. case self::RULE_INTERNAL_ALLOW_UPDATE:
  8211. return $ruleText;
  8212. case self::RULE_JOB_INSTALL:
  8213. return "Install command rule ($ruleText)";
  8214. case self::RULE_JOB_REMOVE:
  8215. return "Remove command rule ($ruleText)";
  8216. case self::RULE_PACKAGE_CONFLICT:
  8217. $package1 = $pool->literalToPackage($literals[0]);
  8218. $package2 = $pool->literalToPackage($literals[1]);
  8219. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  8220. case self::RULE_PACKAGE_REQUIRES:
  8221. $sourceLiteral = array_shift($literals);
  8222. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  8223. $requires = array();
  8224. foreach ($literals as $literal) {
  8225. $requires[] = $pool->literalToPackage($literal);
  8226. }
  8227. $text = $this->reasonData->getPrettyString($sourcePackage);
  8228. if ($requires) {
  8229. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  8230. } else {
  8231. $targetName = $this->reasonData->getTarget();
  8232. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  8233. if (defined('HHVM_VERSION')) {
  8234. return $text . ' -> your HHVM version does not satisfy that requirement.';
  8235. }
  8236. if ($targetName === 'hhvm') {
  8237. return $text . ' -> you are running this with PHP and not HHVM.';
  8238. }
  8239. $packages = $pool->whatProvides($targetName);
  8240. $package = count($packages) ? current($packages) : phpversion();
  8241. if (!($package instanceof CompletePackage)) {
  8242. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  8243. }
  8244. $extra = $package->getExtra();
  8245. if (!empty($extra['config.platform'])) {
  8246. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8247. } else {
  8248. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8249. }
  8250. return $text;
  8251. }
  8252. if (0 === strpos($targetName, 'ext-')) {
  8253. $ext = substr($targetName, 4);
  8254. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8255. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  8256. }
  8257. if (0 === strpos($targetName, 'lib-')) {
  8258. $lib = substr($targetName, 4);
  8259. return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
  8260. }
  8261. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  8262. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  8263. }
  8264. return $text . ' -> no matching package found.';
  8265. }
  8266. return $text;
  8267. case self::RULE_PACKAGE_OBSOLETES:
  8268. return $ruleText;
  8269. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  8270. return $ruleText;
  8271. case self::RULE_PACKAGE_SAME_NAME:
  8272. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  8273. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  8274. return $ruleText;
  8275. case self::RULE_LEARNED:
  8276. return 'Conclusion: '.$ruleText;
  8277. case self::RULE_PACKAGE_ALIAS:
  8278. return $ruleText;
  8279. default:
  8280. return '('.$ruleText.')';
  8281. }
  8282. }
  8283. protected function formatPackagesUnique($pool, array $packages)
  8284. {
  8285. $prepared = array();
  8286. foreach ($packages as $package) {
  8287. if (!is_object($package)) {
  8288. $package = $pool->literalToPackage($package);
  8289. }
  8290. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8291. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8292. }
  8293. foreach ($prepared as $name => $package) {
  8294. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8295. }
  8296. return implode(', ', $prepared);
  8297. }
  8298. }
  8299. <?php
  8300. namespace Composer\DependencyResolver;
  8301. use Composer\Package\PackageInterface;
  8302. use Composer\Package\Link;
  8303. class Rule2Literals extends Rule
  8304. {
  8305. protected $literal1;
  8306. protected $literal2;
  8307. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  8308. {
  8309. parent::__construct($reason, $reasonData, $job);
  8310. if ($literal1 < $literal2) {
  8311. $this->literal1 = $literal1;
  8312. $this->literal2 = $literal2;
  8313. } else {
  8314. $this->literal1 = $literal2;
  8315. $this->literal2 = $literal1;
  8316. }
  8317. }
  8318. public function getLiterals()
  8319. {
  8320. return array($this->literal1, $this->literal2);
  8321. }
  8322. public function getHash()
  8323. {
  8324. $data = unpack('ihash', md5($this->literal1.','.$this->literal2, true));
  8325. return $data['hash'];
  8326. }
  8327. public function equals(Rule $rule)
  8328. {
  8329. $literals = $rule->getLiterals();
  8330. if (2 != count($literals)) {
  8331. return false;
  8332. }
  8333. if ($this->literal1 !== $literals[0]) {
  8334. return false;
  8335. }
  8336. if ($this->literal2 !== $literals[1]) {
  8337. return false;
  8338. }
  8339. return true;
  8340. }
  8341. public function isAssertion()
  8342. {
  8343. return false;
  8344. }
  8345. public function __toString()
  8346. {
  8347. $result = ($this->isDisabled()) ? 'disabled(' : '(';
  8348. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  8349. return $result;
  8350. }
  8351. }
  8352. <?php
  8353. namespace Composer\DependencyResolver;
  8354. class RuleSet implements \IteratorAggregate, \Countable
  8355. {
  8356. const TYPE_PACKAGE = 0;
  8357. const TYPE_JOB = 1;
  8358. const TYPE_LEARNED = 4;
  8359. public $ruleById;
  8360. protected static $types = array(
  8361. 255 => 'UNKNOWN',
  8362. self::TYPE_PACKAGE => 'PACKAGE',
  8363. self::TYPE_JOB => 'JOB',
  8364. self::TYPE_LEARNED => 'LEARNED',
  8365. );
  8366. protected $rules;
  8367. protected $nextRuleId;
  8368. protected $rulesByHash;
  8369. public function __construct()
  8370. {
  8371. $this->nextRuleId = 0;
  8372. foreach ($this->getTypes() as $type) {
  8373. $this->rules[$type] = array();
  8374. }
  8375. $this->rulesByHash = array();
  8376. }
  8377. public function add(Rule $rule, $type)
  8378. {
  8379. if (!isset(self::$types[$type])) {
  8380. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  8381. }
  8382. $hash = $rule->getHash();
  8383. if (isset($this->rulesByHash[$hash])) {
  8384. $potentialDuplicates = $this->rulesByHash[$hash];
  8385. if (is_array($potentialDuplicates)) {
  8386. foreach ($potentialDuplicates as $potentialDuplicate) {
  8387. if ($rule->equals($potentialDuplicate)) {
  8388. return;
  8389. }
  8390. }
  8391. } else {
  8392. if ($rule->equals($potentialDuplicates)) {
  8393. return;
  8394. }
  8395. }
  8396. }
  8397. if (!isset($this->rules[$type])) {
  8398. $this->rules[$type] = array();
  8399. }
  8400. $this->rules[$type][] = $rule;
  8401. $this->ruleById[$this->nextRuleId] = $rule;
  8402. $rule->setType($type);
  8403. $this->nextRuleId++;
  8404. if (!isset($this->rulesByHash[$hash])) {
  8405. $this->rulesByHash[$hash] = $rule;
  8406. } elseif (is_array($this->rulesByHash[$hash])) {
  8407. $this->rulesByHash[$hash][] = $rule;
  8408. } else {
  8409. $originalRule = $this->rulesByHash[$hash];
  8410. $this->rulesByHash[$hash] = array($originalRule, $rule);
  8411. }
  8412. }
  8413. public function count()
  8414. {
  8415. return $this->nextRuleId;
  8416. }
  8417. public function ruleById($id)
  8418. {
  8419. return $this->ruleById[$id];
  8420. }
  8421. public function getRules()
  8422. {
  8423. return $this->rules;
  8424. }
  8425. public function getIterator()
  8426. {
  8427. return new RuleSetIterator($this->getRules());
  8428. }
  8429. public function getIteratorFor($types)
  8430. {
  8431. if (!is_array($types)) {
  8432. $types = array($types);
  8433. }
  8434. $allRules = $this->getRules();
  8435. $rules = array();
  8436. foreach ($types as $type) {
  8437. $rules[$type] = $allRules[$type];
  8438. }
  8439. return new RuleSetIterator($rules);
  8440. }
  8441. public function getIteratorWithout($types)
  8442. {
  8443. if (!is_array($types)) {
  8444. $types = array($types);
  8445. }
  8446. $rules = $this->getRules();
  8447. foreach ($types as $type) {
  8448. unset($rules[$type]);
  8449. }
  8450. return new RuleSetIterator($rules);
  8451. }
  8452. public function getTypes()
  8453. {
  8454. $types = self::$types;
  8455. unset($types[255]);
  8456. return array_keys($types);
  8457. }
  8458. public function getPrettyString(Pool $pool = null)
  8459. {
  8460. $string = "\n";
  8461. foreach ($this->rules as $type => $rules) {
  8462. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  8463. foreach ($rules as $rule) {
  8464. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  8465. }
  8466. $string .= "\n\n";
  8467. }
  8468. return $string;
  8469. }
  8470. public function __toString()
  8471. {
  8472. return $this->getPrettyString(null);
  8473. }
  8474. }
  8475. <?php
  8476. namespace Composer\DependencyResolver;
  8477. use Composer\Package\PackageInterface;
  8478. use Composer\Package\AliasPackage;
  8479. use Composer\Repository\PlatformRepository;
  8480. class RuleSetGenerator
  8481. {
  8482. protected $policy;
  8483. protected $pool;
  8484. protected $rules;
  8485. protected $jobs;
  8486. protected $installedMap;
  8487. protected $whitelistedMap;
  8488. protected $addedMap;
  8489. public function __construct(PolicyInterface $policy, Pool $pool)
  8490. {
  8491. $this->policy = $policy;
  8492. $this->pool = $pool;
  8493. }
  8494. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  8495. {
  8496. $literals = array(-$package->id);
  8497. foreach ($providers as $provider) {
  8498. if ($provider === $package) {
  8499. return null;
  8500. }
  8501. $literals[] = $provider->id;
  8502. }
  8503. return new GenericRule($literals, $reason, $reasonData);
  8504. }
  8505. protected function createInstallOneOfRule(array $packages, $reason, $job)
  8506. {
  8507. $literals = array();
  8508. foreach ($packages as $package) {
  8509. $literals[] = $package->id;
  8510. }
  8511. return new GenericRule($literals, $reason, $job['packageName'], $job);
  8512. }
  8513. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  8514. {
  8515. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  8516. }
  8517. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  8518. {
  8519. if ($issuer === $provider) {
  8520. return null;
  8521. }
  8522. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  8523. }
  8524. private function addRule($type, Rule $newRule = null)
  8525. {
  8526. if (!$newRule) {
  8527. return;
  8528. }
  8529. $this->rules->add($newRule, $type);
  8530. }
  8531. protected function whitelistFromPackage(PackageInterface $package)
  8532. {
  8533. $workQueue = new \SplQueue;
  8534. $workQueue->enqueue($package);
  8535. while (!$workQueue->isEmpty()) {
  8536. $package = $workQueue->dequeue();
  8537. if (isset($this->whitelistedMap[$package->id])) {
  8538. continue;
  8539. }
  8540. $this->whitelistedMap[$package->id] = true;
  8541. foreach ($package->getRequires() as $link) {
  8542. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  8543. foreach ($possibleRequires as $require) {
  8544. $workQueue->enqueue($require);
  8545. }
  8546. }
  8547. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  8548. foreach ($obsoleteProviders as $provider) {
  8549. if ($provider === $package) {
  8550. continue;
  8551. }
  8552. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8553. $workQueue->enqueue($provider);
  8554. }
  8555. }
  8556. }
  8557. }
  8558. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  8559. {
  8560. $workQueue = new \SplQueue;
  8561. $workQueue->enqueue($package);
  8562. while (!$workQueue->isEmpty()) {
  8563. $package = $workQueue->dequeue();
  8564. if (isset($this->addedMap[$package->id])) {
  8565. continue;
  8566. }
  8567. $this->addedMap[$package->id] = true;
  8568. foreach ($package->getRequires() as $link) {
  8569. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  8570. continue;
  8571. }
  8572. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8573. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  8574. foreach ($possibleRequires as $require) {
  8575. $workQueue->enqueue($require);
  8576. }
  8577. }
  8578. foreach ($package->getConflicts() as $link) {
  8579. $possibleConflicts = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8580. foreach ($possibleConflicts as $conflict) {
  8581. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  8582. }
  8583. }
  8584. $isInstalled = (isset($this->installedMap[$package->id]));
  8585. foreach ($package->getReplaces() as $link) {
  8586. $obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  8587. foreach ($obsoleteProviders as $provider) {
  8588. if ($provider === $package) {
  8589. continue;
  8590. }
  8591. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8592. $reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  8593. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  8594. }
  8595. }
  8596. }
  8597. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null);
  8598. foreach ($obsoleteProviders as $provider) {
  8599. if ($provider === $package) {
  8600. continue;
  8601. }
  8602. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  8603. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  8604. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  8605. $reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  8606. $this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRule2Literals($package, $provider, $reason, $package));
  8607. }
  8608. }
  8609. }
  8610. }
  8611. protected function obsoleteImpossibleForAlias($package, $provider)
  8612. {
  8613. $packageIsAlias = $package instanceof AliasPackage;
  8614. $providerIsAlias = $provider instanceof AliasPackage;
  8615. $impossible = (
  8616. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  8617. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  8618. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  8619. );
  8620. return $impossible;
  8621. }
  8622. protected function whitelistFromJobs()
  8623. {
  8624. foreach ($this->jobs as $job) {
  8625. switch ($job['cmd']) {
  8626. case 'install':
  8627. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  8628. foreach ($packages as $package) {
  8629. $this->whitelistFromPackage($package);
  8630. }
  8631. break;
  8632. }
  8633. }
  8634. }
  8635. protected function addRulesForJobs($ignorePlatformReqs)
  8636. {
  8637. foreach ($this->jobs as $job) {
  8638. switch ($job['cmd']) {
  8639. case 'install':
  8640. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8641. break;
  8642. }
  8643. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8644. if ($packages) {
  8645. foreach ($packages as $package) {
  8646. if (!isset($this->installedMap[$package->id])) {
  8647. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8648. }
  8649. }
  8650. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  8651. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8652. }
  8653. break;
  8654. case 'remove':
  8655. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8656. foreach ($packages as $package) {
  8657. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  8658. $this->addRule(RuleSet::TYPE_JOB, $rule);
  8659. }
  8660. break;
  8661. }
  8662. }
  8663. }
  8664. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  8665. {
  8666. $this->jobs = $jobs;
  8667. $this->rules = new RuleSet;
  8668. $this->installedMap = $installedMap;
  8669. $this->whitelistedMap = array();
  8670. foreach ($this->installedMap as $package) {
  8671. $this->whitelistFromPackage($package);
  8672. }
  8673. $this->whitelistFromJobs();
  8674. $this->pool->setWhitelist($this->whitelistedMap);
  8675. $this->addedMap = array();
  8676. foreach ($this->installedMap as $package) {
  8677. $this->addRulesForPackage($package, $ignorePlatformReqs);
  8678. }
  8679. $this->addRulesForJobs($ignorePlatformReqs);
  8680. return $this->rules;
  8681. }
  8682. }
  8683. <?php
  8684. namespace Composer\DependencyResolver;
  8685. class RuleSetIterator implements \Iterator
  8686. {
  8687. protected $rules;
  8688. protected $types;
  8689. protected $currentOffset;
  8690. protected $currentType;
  8691. protected $currentTypeOffset;
  8692. public function __construct(array $rules)
  8693. {
  8694. $this->rules = $rules;
  8695. $this->types = array_keys($rules);
  8696. sort($this->types);
  8697. $this->rewind();
  8698. }
  8699. public function current()
  8700. {
  8701. return $this->rules[$this->currentType][$this->currentOffset];
  8702. }
  8703. public function key()
  8704. {
  8705. return $this->currentType;
  8706. }
  8707. public function next()
  8708. {
  8709. $this->currentOffset++;
  8710. if (!isset($this->rules[$this->currentType])) {
  8711. return;
  8712. }
  8713. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  8714. $this->currentOffset = 0;
  8715. do {
  8716. $this->currentTypeOffset++;
  8717. if (!isset($this->types[$this->currentTypeOffset])) {
  8718. $this->currentType = -1;
  8719. break;
  8720. }
  8721. $this->currentType = $this->types[$this->currentTypeOffset];
  8722. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  8723. }
  8724. }
  8725. public function rewind()
  8726. {
  8727. $this->currentOffset = 0;
  8728. $this->currentTypeOffset = -1;
  8729. $this->currentType = -1;
  8730. do {
  8731. $this->currentTypeOffset++;
  8732. if (!isset($this->types[$this->currentTypeOffset])) {
  8733. $this->currentType = -1;
  8734. break;
  8735. }
  8736. $this->currentType = $this->types[$this->currentTypeOffset];
  8737. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  8738. }
  8739. public function valid()
  8740. {
  8741. return isset($this->rules[$this->currentType])
  8742. && isset($this->rules[$this->currentType][$this->currentOffset]);
  8743. }
  8744. }
  8745. <?php
  8746. namespace Composer\DependencyResolver;
  8747. class RuleWatchChain extends \SplDoublyLinkedList
  8748. {
  8749. protected $offset = 0;
  8750. public function seek($offset)
  8751. {
  8752. $this->rewind();
  8753. for ($i = 0; $i < $offset; $i++, $this->next());
  8754. }
  8755. public function remove()
  8756. {
  8757. $offset = $this->key();
  8758. $this->offsetUnset($offset);
  8759. $this->seek($offset);
  8760. }
  8761. }
  8762. <?php
  8763. namespace Composer\DependencyResolver;
  8764. class RuleWatchGraph
  8765. {
  8766. protected $watchChains = array();
  8767. public function insert(RuleWatchNode $node)
  8768. {
  8769. if ($node->getRule()->isAssertion()) {
  8770. return;
  8771. }
  8772. foreach (array($node->watch1, $node->watch2) as $literal) {
  8773. if (!isset($this->watchChains[$literal])) {
  8774. $this->watchChains[$literal] = new RuleWatchChain;
  8775. }
  8776. $this->watchChains[$literal]->unshift($node);
  8777. }
  8778. }
  8779. public function propagateLiteral($decidedLiteral, $level, $decisions)
  8780. {
  8781. $literal = -$decidedLiteral;
  8782. if (!isset($this->watchChains[$literal])) {
  8783. return null;
  8784. }
  8785. $chain = $this->watchChains[$literal];
  8786. $chain->rewind();
  8787. while ($chain->valid()) {
  8788. $node = $chain->current();
  8789. $otherWatch = $node->getOtherWatch($literal);
  8790. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  8791. $ruleLiterals = $node->getRule()->getLiterals();
  8792. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  8793. return $literal !== $ruleLiteral &&
  8794. $otherWatch !== $ruleLiteral &&
  8795. !$decisions->conflict($ruleLiteral);
  8796. });
  8797. if ($alternativeLiterals) {
  8798. reset($alternativeLiterals);
  8799. $this->moveWatch($literal, current($alternativeLiterals), $node);
  8800. continue;
  8801. }
  8802. if ($decisions->conflict($otherWatch)) {
  8803. return $node->getRule();
  8804. }
  8805. $decisions->decide($otherWatch, $level, $node->getRule());
  8806. }
  8807. $chain->next();
  8808. }
  8809. return null;
  8810. }
  8811. protected function moveWatch($fromLiteral, $toLiteral, $node)
  8812. {
  8813. if (!isset($this->watchChains[$toLiteral])) {
  8814. $this->watchChains[$toLiteral] = new RuleWatchChain;
  8815. }
  8816. $node->moveWatch($fromLiteral, $toLiteral);
  8817. $this->watchChains[$fromLiteral]->remove();
  8818. $this->watchChains[$toLiteral]->unshift($node);
  8819. }
  8820. }
  8821. <?php
  8822. namespace Composer\DependencyResolver;
  8823. class RuleWatchNode
  8824. {
  8825. public $watch1;
  8826. public $watch2;
  8827. protected $rule;
  8828. public function __construct($rule)
  8829. {
  8830. $this->rule = $rule;
  8831. $literals = $rule->getLiterals();
  8832. $this->watch1 = count($literals) > 0 ? $literals[0] : 0;
  8833. $this->watch2 = count($literals) > 1 ? $literals[1] : 0;
  8834. }
  8835. public function watch2OnHighest(Decisions $decisions)
  8836. {
  8837. $literals = $this->rule->getLiterals();
  8838. if (count($literals) < 3) {
  8839. return;
  8840. }
  8841. $watchLevel = 0;
  8842. foreach ($literals as $literal) {
  8843. $level = $decisions->decisionLevel($literal);
  8844. if ($level > $watchLevel) {
  8845. $this->watch2 = $literal;
  8846. $watchLevel = $level;
  8847. }
  8848. }
  8849. }
  8850. public function getRule()
  8851. {
  8852. return $this->rule;
  8853. }
  8854. public function getOtherWatch($literal)
  8855. {
  8856. if ($this->watch1 == $literal) {
  8857. return $this->watch2;
  8858. }
  8859. return $this->watch1;
  8860. }
  8861. public function moveWatch($from, $to)
  8862. {
  8863. if ($this->watch1 == $from) {
  8864. $this->watch1 = $to;
  8865. } else {
  8866. $this->watch2 = $to;
  8867. }
  8868. }
  8869. }
  8870. <?php
  8871. namespace Composer\DependencyResolver;
  8872. use Composer\IO\IOInterface;
  8873. use Composer\Repository\RepositoryInterface;
  8874. use Composer\Repository\PlatformRepository;
  8875. class Solver
  8876. {
  8877. const BRANCH_LITERALS = 0;
  8878. const BRANCH_LEVEL = 1;
  8879. protected $policy;
  8880. protected $pool;
  8881. protected $installed;
  8882. protected $rules;
  8883. protected $ruleSetGenerator;
  8884. protected $jobs;
  8885. protected $updateMap = array();
  8886. protected $watchGraph;
  8887. protected $decisions;
  8888. protected $installedMap;
  8889. protected $propagateIndex;
  8890. protected $branches = array();
  8891. protected $problems = array();
  8892. protected $learnedPool = array();
  8893. protected $learnedWhy = array();
  8894. protected $io;
  8895. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  8896. {
  8897. $this->io = $io;
  8898. $this->policy = $policy;
  8899. $this->pool = $pool;
  8900. $this->installed = $installed;
  8901. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  8902. }
  8903. public function getRuleSetSize()
  8904. {
  8905. return count($this->rules);
  8906. }
  8907. private function makeAssertionRuleDecisions()
  8908. {
  8909. $decisionStart = count($this->decisions) - 1;
  8910. $rulesCount = count($this->rules);
  8911. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  8912. $rule = $this->rules->ruleById[$ruleIndex];
  8913. if (!$rule->isAssertion() || $rule->isDisabled()) {
  8914. continue;
  8915. }
  8916. $literals = $rule->getLiterals();
  8917. $literal = $literals[0];
  8918. if (!$this->decisions->decided(abs($literal))) {
  8919. $this->decisions->decide($literal, 1, $rule);
  8920. continue;
  8921. }
  8922. if ($this->decisions->satisfy($literal)) {
  8923. continue;
  8924. }
  8925. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  8926. $rule->disable();
  8927. continue;
  8928. }
  8929. $conflict = $this->decisions->decisionRule($literal);
  8930. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  8931. $problem = new Problem($this->pool);
  8932. $problem->addRule($rule);
  8933. $problem->addRule($conflict);
  8934. $this->disableProblem($rule);
  8935. $this->problems[] = $problem;
  8936. continue;
  8937. }
  8938. $problem = new Problem($this->pool);
  8939. $problem->addRule($rule);
  8940. $problem->addRule($conflict);
  8941. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  8942. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  8943. continue;
  8944. }
  8945. $assertRuleLiterals = $assertRule->getLiterals();
  8946. $assertRuleLiteral = $assertRuleLiterals[0];
  8947. if (abs($literal) !== abs($assertRuleLiteral)) {
  8948. continue;
  8949. }
  8950. $problem->addRule($assertRule);
  8951. $this->disableProblem($assertRule);
  8952. }
  8953. $this->problems[] = $problem;
  8954. $this->decisions->resetToOffset($decisionStart);
  8955. $ruleIndex = -1;
  8956. }
  8957. }
  8958. protected function setupInstalledMap()
  8959. {
  8960. $this->installedMap = array();
  8961. foreach ($this->installed->getPackages() as $package) {
  8962. $this->installedMap[$package->id] = $package;
  8963. }
  8964. }
  8965. protected function checkForRootRequireProblems($ignorePlatformReqs)
  8966. {
  8967. foreach ($this->jobs as $job) {
  8968. switch ($job['cmd']) {
  8969. case 'update':
  8970. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  8971. foreach ($packages as $package) {
  8972. if (isset($this->installedMap[$package->id])) {
  8973. $this->updateMap[$package->id] = true;
  8974. }
  8975. }
  8976. break;
  8977. case 'update-all':
  8978. foreach ($this->installedMap as $package) {
  8979. $this->updateMap[$package->id] = true;
  8980. }
  8981. break;
  8982. case 'install':
  8983. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  8984. break;
  8985. }
  8986. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  8987. $problem = new Problem($this->pool);
  8988. $problem->addRule(new GenericRule(array(), null, null, $job));
  8989. $this->problems[] = $problem;
  8990. }
  8991. break;
  8992. }
  8993. }
  8994. }
  8995. public function solve(Request $request, $ignorePlatformReqs = false)
  8996. {
  8997. $this->jobs = $request->getJobs();
  8998. $this->setupInstalledMap();
  8999. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  9000. $this->checkForRootRequireProblems($ignorePlatformReqs);
  9001. $this->decisions = new Decisions($this->pool);
  9002. $this->watchGraph = new RuleWatchGraph;
  9003. foreach ($this->rules as $rule) {
  9004. $this->watchGraph->insert(new RuleWatchNode($rule));
  9005. }
  9006. $this->makeAssertionRuleDecisions();
  9007. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  9008. $before = microtime(true);
  9009. $this->runSat(true);
  9010. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  9011. foreach ($this->installedMap as $packageId => $void) {
  9012. if ($this->decisions->undecided($packageId)) {
  9013. $this->decisions->decide(-$packageId, 1, null);
  9014. }
  9015. }
  9016. if ($this->problems) {
  9017. throw new SolverProblemsException($this->problems, $this->installedMap);
  9018. }
  9019. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  9020. return $transaction->getOperations();
  9021. }
  9022. protected function propagate($level)
  9023. {
  9024. while ($this->decisions->validOffset($this->propagateIndex)) {
  9025. $decision = $this->decisions->atOffset($this->propagateIndex);
  9026. $conflict = $this->watchGraph->propagateLiteral(
  9027. $decision[Decisions::DECISION_LITERAL],
  9028. $level,
  9029. $this->decisions
  9030. );
  9031. $this->propagateIndex++;
  9032. if ($conflict) {
  9033. return $conflict;
  9034. }
  9035. }
  9036. return null;
  9037. }
  9038. private function revert($level)
  9039. {
  9040. while (!$this->decisions->isEmpty()) {
  9041. $literal = $this->decisions->lastLiteral();
  9042. if ($this->decisions->undecided($literal)) {
  9043. break;
  9044. }
  9045. $decisionLevel = $this->decisions->decisionLevel($literal);
  9046. if ($decisionLevel <= $level) {
  9047. break;
  9048. }
  9049. $this->decisions->revertLast();
  9050. $this->propagateIndex = count($this->decisions);
  9051. }
  9052. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  9053. array_pop($this->branches);
  9054. }
  9055. }
  9056. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  9057. {
  9058. $level++;
  9059. $this->decisions->decide($literal, $level, $rule);
  9060. while (true) {
  9061. $rule = $this->propagate($level);
  9062. if (!$rule) {
  9063. break;
  9064. }
  9065. if ($level == 1) {
  9066. return $this->analyzeUnsolvable($rule, $disableRules);
  9067. }
  9068. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  9069. if ($newLevel <= 0 || $newLevel >= $level) {
  9070. throw new SolverBugException(
  9071. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  9072. );
  9073. } elseif (!$newRule) {
  9074. throw new SolverBugException(
  9075. "No rule was learned from analyzing $rule at level $level."
  9076. );
  9077. }
  9078. $level = $newLevel;
  9079. $this->revert($level);
  9080. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  9081. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  9082. $ruleNode = new RuleWatchNode($newRule);
  9083. $ruleNode->watch2OnHighest($this->decisions);
  9084. $this->watchGraph->insert($ruleNode);
  9085. $this->decisions->decide($learnLiteral, $level, $newRule);
  9086. }
  9087. return $level;
  9088. }
  9089. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  9090. {
  9091. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  9092. $selectedLiteral = array_shift($literals);
  9093. if (count($literals)) {
  9094. $this->branches[] = array($literals, $level);
  9095. }
  9096. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  9097. }
  9098. protected function analyze($level, Rule $rule)
  9099. {
  9100. $analyzedRule = $rule;
  9101. $ruleLevel = 1;
  9102. $num = 0;
  9103. $l1num = 0;
  9104. $seen = array();
  9105. $learnedLiterals = array(null);
  9106. $decisionId = count($this->decisions);
  9107. $this->learnedPool[] = array();
  9108. while (true) {
  9109. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  9110. foreach ($rule->getLiterals() as $literal) {
  9111. if ($this->decisions->satisfy($literal)) {
  9112. continue;
  9113. }
  9114. if (isset($seen[abs($literal)])) {
  9115. continue;
  9116. }
  9117. $seen[abs($literal)] = true;
  9118. $l = $this->decisions->decisionLevel($literal);
  9119. if (1 === $l) {
  9120. $l1num++;
  9121. } elseif ($level === $l) {
  9122. $num++;
  9123. } else {
  9124. $learnedLiterals[] = $literal;
  9125. if ($l > $ruleLevel) {
  9126. $ruleLevel = $l;
  9127. }
  9128. }
  9129. }
  9130. $l1retry = true;
  9131. while ($l1retry) {
  9132. $l1retry = false;
  9133. if (!$num && !--$l1num) {
  9134. break 2;
  9135. }
  9136. while (true) {
  9137. if ($decisionId <= 0) {
  9138. throw new SolverBugException(
  9139. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  9140. );
  9141. }
  9142. $decisionId--;
  9143. $decision = $this->decisions->atOffset($decisionId);
  9144. $literal = $decision[Decisions::DECISION_LITERAL];
  9145. if (isset($seen[abs($literal)])) {
  9146. break;
  9147. }
  9148. }
  9149. unset($seen[abs($literal)]);
  9150. if ($num && 0 === --$num) {
  9151. $learnedLiterals[0] = -abs($literal);
  9152. if (!$l1num) {
  9153. break 2;
  9154. }
  9155. foreach ($learnedLiterals as $i => $learnedLiteral) {
  9156. if ($i !== 0) {
  9157. unset($seen[abs($learnedLiteral)]);
  9158. }
  9159. }
  9160. $l1num++;
  9161. $l1retry = true;
  9162. }
  9163. }
  9164. $decision = $this->decisions->atOffset($decisionId);
  9165. $rule = $decision[Decisions::DECISION_REASON];
  9166. }
  9167. $why = count($this->learnedPool) - 1;
  9168. if (!$learnedLiterals[0]) {
  9169. throw new SolverBugException(
  9170. "Did not find a learnable literal in analyzed rule $analyzedRule."
  9171. );
  9172. }
  9173. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  9174. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  9175. }
  9176. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  9177. {
  9178. $why = spl_object_hash($conflictRule);
  9179. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  9180. $learnedWhy = $this->learnedWhy[$why];
  9181. $problemRules = $this->learnedPool[$learnedWhy];
  9182. foreach ($problemRules as $problemRule) {
  9183. $this->analyzeUnsolvableRule($problem, $problemRule);
  9184. }
  9185. return;
  9186. }
  9187. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  9188. return;
  9189. }
  9190. $problem->nextSection();
  9191. $problem->addRule($conflictRule);
  9192. }
  9193. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  9194. {
  9195. $problem = new Problem($this->pool);
  9196. $problem->addRule($conflictRule);
  9197. $this->analyzeUnsolvableRule($problem, $conflictRule);
  9198. $this->problems[] = $problem;
  9199. $seen = array();
  9200. $literals = $conflictRule->getLiterals();
  9201. foreach ($literals as $literal) {
  9202. if ($this->decisions->satisfy($literal)) {
  9203. continue;
  9204. }
  9205. $seen[abs($literal)] = true;
  9206. }
  9207. foreach ($this->decisions as $decision) {
  9208. $literal = $decision[Decisions::DECISION_LITERAL];
  9209. if (!isset($seen[abs($literal)])) {
  9210. continue;
  9211. }
  9212. $why = $decision[Decisions::DECISION_REASON];
  9213. $problem->addRule($why);
  9214. $this->analyzeUnsolvableRule($problem, $why);
  9215. $literals = $why->getLiterals();
  9216. foreach ($literals as $literal) {
  9217. if ($this->decisions->satisfy($literal)) {
  9218. continue;
  9219. }
  9220. $seen[abs($literal)] = true;
  9221. }
  9222. }
  9223. if ($disableRules) {
  9224. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  9225. $this->disableProblem($reason['rule']);
  9226. }
  9227. $this->resetSolver();
  9228. return 1;
  9229. }
  9230. return 0;
  9231. }
  9232. private function disableProblem(Rule $why)
  9233. {
  9234. $job = $why->getJob();
  9235. if (!$job) {
  9236. $why->disable();
  9237. return;
  9238. }
  9239. foreach ($this->rules as $rule) {
  9240. if ($job === $rule->getJob()) {
  9241. $rule->disable();
  9242. }
  9243. }
  9244. }
  9245. private function resetSolver()
  9246. {
  9247. $this->decisions->reset();
  9248. $this->propagateIndex = 0;
  9249. $this->branches = array();
  9250. $this->enableDisableLearnedRules();
  9251. $this->makeAssertionRuleDecisions();
  9252. }
  9253. private function enableDisableLearnedRules()
  9254. {
  9255. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  9256. $why = $this->learnedWhy[spl_object_hash($rule)];
  9257. $problemRules = $this->learnedPool[$why];
  9258. $foundDisabled = false;
  9259. foreach ($problemRules as $problemRule) {
  9260. if ($problemRule->isDisabled()) {
  9261. $foundDisabled = true;
  9262. break;
  9263. }
  9264. }
  9265. if ($foundDisabled && $rule->isEnabled()) {
  9266. $rule->disable();
  9267. } elseif (!$foundDisabled && $rule->isDisabled()) {
  9268. $rule->enable();
  9269. }
  9270. }
  9271. }
  9272. private function runSat($disableRules = true)
  9273. {
  9274. $this->propagateIndex = 0;
  9275. $decisionQueue = array();
  9276. $decisionSupplementQueue = array();
  9277. $disableRules = array();
  9278. $level = 1;
  9279. $systemLevel = $level + 1;
  9280. $installedPos = 0;
  9281. while (true) {
  9282. if (1 === $level) {
  9283. $conflictRule = $this->propagate($level);
  9284. if (null !== $conflictRule) {
  9285. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  9286. continue;
  9287. }
  9288. return;
  9289. }
  9290. }
  9291. if ($level < $systemLevel) {
  9292. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  9293. foreach ($iterator as $rule) {
  9294. if ($rule->isEnabled()) {
  9295. $decisionQueue = array();
  9296. $noneSatisfied = true;
  9297. foreach ($rule->getLiterals() as $literal) {
  9298. if ($this->decisions->satisfy($literal)) {
  9299. $noneSatisfied = false;
  9300. break;
  9301. }
  9302. if ($literal > 0 && $this->decisions->undecided($literal)) {
  9303. $decisionQueue[] = $literal;
  9304. }
  9305. }
  9306. if ($noneSatisfied && count($decisionQueue)) {
  9307. if (count($this->installed) != count($this->updateMap)) {
  9308. $prunedQueue = array();
  9309. foreach ($decisionQueue as $literal) {
  9310. if (isset($this->installedMap[abs($literal)])) {
  9311. $prunedQueue[] = $literal;
  9312. if (isset($this->updateMap[abs($literal)])) {
  9313. $prunedQueue = $decisionQueue;
  9314. break;
  9315. }
  9316. }
  9317. }
  9318. $decisionQueue = $prunedQueue;
  9319. }
  9320. }
  9321. if ($noneSatisfied && count($decisionQueue)) {
  9322. $oLevel = $level;
  9323. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9324. if (0 === $level) {
  9325. return;
  9326. }
  9327. if ($level <= $oLevel) {
  9328. break;
  9329. }
  9330. }
  9331. }
  9332. }
  9333. $systemLevel = $level + 1;
  9334. $iterator->next();
  9335. if ($iterator->valid()) {
  9336. continue;
  9337. }
  9338. }
  9339. if ($level < $systemLevel) {
  9340. $systemLevel = $level;
  9341. }
  9342. $rulesCount = count($this->rules);
  9343. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  9344. if ($i == $rulesCount) {
  9345. $i = 0;
  9346. }
  9347. $rule = $this->rules->ruleById[$i];
  9348. $literals = $rule->getLiterals();
  9349. if ($rule->isDisabled()) {
  9350. continue;
  9351. }
  9352. $decisionQueue = array();
  9353. foreach ($literals as $literal) {
  9354. if ($literal <= 0) {
  9355. if (!$this->decisions->decidedInstall(abs($literal))) {
  9356. continue 2;
  9357. }
  9358. } else {
  9359. if ($this->decisions->decidedInstall(abs($literal))) {
  9360. continue 2;
  9361. }
  9362. if ($this->decisions->undecided(abs($literal))) {
  9363. $decisionQueue[] = $literal;
  9364. }
  9365. }
  9366. }
  9367. if (count($decisionQueue) < 2) {
  9368. continue;
  9369. }
  9370. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9371. if (0 === $level) {
  9372. return;
  9373. }
  9374. $rulesCount = count($this->rules);
  9375. $n = -1;
  9376. }
  9377. if ($level < $systemLevel) {
  9378. continue;
  9379. }
  9380. if (count($this->branches)) {
  9381. $lastLiteral = null;
  9382. $lastLevel = null;
  9383. $lastBranchIndex = 0;
  9384. $lastBranchOffset = 0;
  9385. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  9386. list($literals, $l) = $this->branches[$i];
  9387. foreach ($literals as $offset => $literal) {
  9388. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  9389. $lastLiteral = $literal;
  9390. $lastBranchIndex = $i;
  9391. $lastBranchOffset = $offset;
  9392. $lastLevel = $l;
  9393. }
  9394. }
  9395. }
  9396. if ($lastLiteral) {
  9397. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  9398. $level = $lastLevel;
  9399. $this->revert($level);
  9400. $why = $this->decisions->lastReason();
  9401. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  9402. if ($level == 0) {
  9403. return;
  9404. }
  9405. continue;
  9406. }
  9407. }
  9408. break;
  9409. }
  9410. }
  9411. }
  9412. <?php
  9413. namespace Composer\DependencyResolver;
  9414. class SolverBugException extends \RuntimeException
  9415. {
  9416. public function __construct($message)
  9417. {
  9418. parent::__construct(
  9419. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  9420. "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n");
  9421. }
  9422. }
  9423. <?php
  9424. namespace Composer\DependencyResolver;
  9425. use Composer\Util\IniHelper;
  9426. class SolverProblemsException extends \RuntimeException
  9427. {
  9428. protected $problems;
  9429. protected $installedMap;
  9430. public function __construct(array $problems, array $installedMap)
  9431. {
  9432. $this->problems = $problems;
  9433. $this->installedMap = $installedMap;
  9434. parent::__construct($this->createMessage(), 2);
  9435. }
  9436. protected function createMessage()
  9437. {
  9438. $text = "\n";
  9439. $hasExtensionProblems = false;
  9440. foreach ($this->problems as $i => $problem) {
  9441. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  9442. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  9443. $hasExtensionProblems = true;
  9444. }
  9445. }
  9446. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  9447. $text .= "\nPotential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n - It's a private package and you forgot to add a custom repository to find it\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  9448. }
  9449. if ($hasExtensionProblems) {
  9450. $text .= $this->createExtensionHint();
  9451. }
  9452. return $text;
  9453. }
  9454. public function getProblems()
  9455. {
  9456. return $this->problems;
  9457. }
  9458. private function createExtensionHint()
  9459. {
  9460. $paths = IniHelper::getAll();
  9461. if (count($paths) === 1 && empty($paths[0])) {
  9462. return '';
  9463. }
  9464. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  9465. $text .= implode("\n - ", $paths);
  9466. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  9467. return $text;
  9468. }
  9469. private function hasExtensionProblems(array $reasonSets)
  9470. {
  9471. foreach ($reasonSets as $reasonSet) {
  9472. foreach ($reasonSet as $reason) {
  9473. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  9474. return true;
  9475. }
  9476. }
  9477. }
  9478. return false;
  9479. }
  9480. }
  9481. <?php
  9482. namespace Composer\DependencyResolver;
  9483. use Composer\Package\AliasPackage;
  9484. class Transaction
  9485. {
  9486. protected $policy;
  9487. protected $pool;
  9488. protected $installedMap;
  9489. protected $decisions;
  9490. protected $transaction;
  9491. public function __construct($policy, $pool, $installedMap, $decisions)
  9492. {
  9493. $this->policy = $policy;
  9494. $this->pool = $pool;
  9495. $this->installedMap = $installedMap;
  9496. $this->decisions = $decisions;
  9497. $this->transaction = array();
  9498. }
  9499. public function getOperations()
  9500. {
  9501. $installMeansUpdateMap = $this->findUpdates();
  9502. $updateMap = array();
  9503. $installMap = array();
  9504. $uninstallMap = array();
  9505. foreach ($this->decisions as $i => $decision) {
  9506. $literal = $decision[Decisions::DECISION_LITERAL];
  9507. $reason = $decision[Decisions::DECISION_REASON];
  9508. $package = $this->pool->literalToPackage($literal);
  9509. if (($literal > 0) == (isset($this->installedMap[$package->id]))) {
  9510. continue;
  9511. }
  9512. if ($literal > 0) {
  9513. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  9514. $source = $installMeansUpdateMap[abs($literal)];
  9515. $updateMap[$package->id] = array(
  9516. 'package' => $package,
  9517. 'source' => $source,
  9518. 'reason' => $reason,
  9519. );
  9520. unset($installMeansUpdateMap[abs($literal)]);
  9521. $ignoreRemove[$source->id] = true;
  9522. } else {
  9523. $installMap[$package->id] = array(
  9524. 'package' => $package,
  9525. 'reason' => $reason,
  9526. );
  9527. }
  9528. }
  9529. }
  9530. foreach ($this->decisions as $i => $decision) {
  9531. $literal = $decision[Decisions::DECISION_LITERAL];
  9532. $reason = $decision[Decisions::DECISION_REASON];
  9533. $package = $this->pool->literalToPackage($literal);
  9534. if ($literal <= 0 &&
  9535. isset($this->installedMap[$package->id]) &&
  9536. !isset($ignoreRemove[$package->id])) {
  9537. $uninstallMap[$package->id] = array(
  9538. 'package' => $package,
  9539. 'reason' => $reason,
  9540. );
  9541. }
  9542. }
  9543. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  9544. return $this->transaction;
  9545. }
  9546. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  9547. {
  9548. $queue = array_map(
  9549. function ($operation) {
  9550. return $operation['package'];
  9551. },
  9552. $this->findRootPackages($installMap, $updateMap)
  9553. );
  9554. $visited = array();
  9555. while (!empty($queue)) {
  9556. $package = array_pop($queue);
  9557. $packageId = $package->id;
  9558. if (!isset($visited[$packageId])) {
  9559. $queue[] = $package;
  9560. if ($package instanceof AliasPackage) {
  9561. $queue[] = $package->getAliasOf();
  9562. } else {
  9563. foreach ($package->getRequires() as $link) {
  9564. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9565. foreach ($possibleRequires as $require) {
  9566. $queue[] = $require;
  9567. }
  9568. }
  9569. }
  9570. $visited[$package->id] = true;
  9571. } else {
  9572. if (isset($installMap[$packageId])) {
  9573. $this->install(
  9574. $installMap[$packageId]['package'],
  9575. $installMap[$packageId]['reason']
  9576. );
  9577. unset($installMap[$packageId]);
  9578. }
  9579. if (isset($updateMap[$packageId])) {
  9580. $this->update(
  9581. $updateMap[$packageId]['source'],
  9582. $updateMap[$packageId]['package'],
  9583. $updateMap[$packageId]['reason']
  9584. );
  9585. unset($updateMap[$packageId]);
  9586. }
  9587. }
  9588. }
  9589. foreach ($uninstallMap as $uninstall) {
  9590. $this->uninstall($uninstall['package'], $uninstall['reason']);
  9591. }
  9592. }
  9593. protected function findRootPackages($installMap, $updateMap)
  9594. {
  9595. $packages = $installMap + $updateMap;
  9596. $roots = $packages;
  9597. foreach ($packages as $packageId => $operation) {
  9598. $package = $operation['package'];
  9599. if (!isset($roots[$packageId])) {
  9600. continue;
  9601. }
  9602. foreach ($package->getRequires() as $link) {
  9603. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9604. foreach ($possibleRequires as $require) {
  9605. if ($require !== $package) {
  9606. unset($roots[$require->id]);
  9607. }
  9608. }
  9609. }
  9610. }
  9611. return $roots;
  9612. }
  9613. protected function findUpdates()
  9614. {
  9615. $installMeansUpdateMap = array();
  9616. foreach ($this->decisions as $i => $decision) {
  9617. $literal = $decision[Decisions::DECISION_LITERAL];
  9618. $package = $this->pool->literalToPackage($literal);
  9619. if ($package instanceof AliasPackage) {
  9620. continue;
  9621. }
  9622. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  9623. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  9624. $literals = array($package->id);
  9625. foreach ($updates as $update) {
  9626. $literals[] = $update->id;
  9627. }
  9628. foreach ($literals as $updateLiteral) {
  9629. if ($updateLiteral !== $literal) {
  9630. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  9631. }
  9632. }
  9633. }
  9634. }
  9635. return $installMeansUpdateMap;
  9636. }
  9637. protected function install($package, $reason)
  9638. {
  9639. if ($package instanceof AliasPackage) {
  9640. return $this->markAliasInstalled($package, $reason);
  9641. }
  9642. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  9643. }
  9644. protected function update($from, $to, $reason)
  9645. {
  9646. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  9647. }
  9648. protected function uninstall($package, $reason)
  9649. {
  9650. if ($package instanceof AliasPackage) {
  9651. return $this->markAliasUninstalled($package, $reason);
  9652. }
  9653. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  9654. }
  9655. protected function markAliasInstalled($package, $reason)
  9656. {
  9657. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  9658. }
  9659. protected function markAliasUninstalled($package, $reason)
  9660. {
  9661. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  9662. }
  9663. }
  9664. <?php
  9665. namespace Composer\Downloader;
  9666. use Composer\Package\PackageInterface;
  9667. use Symfony\Component\Finder\Finder;
  9668. use Composer\IO\IOInterface;
  9669. abstract class ArchiveDownloader extends FileDownloader
  9670. {
  9671. public function download(PackageInterface $package, $path, $output = true)
  9672. {
  9673. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  9674. $retries = 3;
  9675. while ($retries--) {
  9676. $fileName = parent::download($package, $path, $output);
  9677. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  9678. try {
  9679. $this->filesystem->ensureDirectoryExists($temporaryDir);
  9680. try {
  9681. $this->extract($fileName, $temporaryDir);
  9682. } catch (\Exception $e) {
  9683. parent::clearLastCacheWrite($package);
  9684. throw $e;
  9685. }
  9686. $this->filesystem->unlink($fileName);
  9687. $contentDir = $this->getFolderContent($temporaryDir);
  9688. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  9689. $contentDir = $this->getFolderContent((string) reset($contentDir));
  9690. }
  9691. foreach ($contentDir as $file) {
  9692. $file = (string) $file;
  9693. $this->filesystem->rename($file, $path . '/' . basename($file));
  9694. }
  9695. $this->filesystem->removeDirectory($temporaryDir);
  9696. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  9697. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  9698. }
  9699. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  9700. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  9701. }
  9702. } catch (\Exception $e) {
  9703. $this->filesystem->removeDirectory($path);
  9704. $this->filesystem->removeDirectory($temporaryDir);
  9705. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  9706. $this->io->writeError('');
  9707. if ($this->io->isDebug()) {
  9708. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  9709. } else {
  9710. $this->io->writeError(' Invalid zip file, retrying...');
  9711. }
  9712. usleep(500000);
  9713. continue;
  9714. }
  9715. throw $e;
  9716. }
  9717. break;
  9718. }
  9719. }
  9720. protected function getFileName(PackageInterface $package, $path)
  9721. {
  9722. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  9723. }
  9724. abstract protected function extract($file, $path);
  9725. private function getFolderContent($dir)
  9726. {
  9727. $finder = Finder::create()
  9728. ->ignoreVCS(false)
  9729. ->ignoreDotFiles(false)
  9730. ->notName('.DS_Store')
  9731. ->depth(0)
  9732. ->in($dir);
  9733. return iterator_to_array($finder);
  9734. }
  9735. }
  9736. <?php
  9737. namespace Composer\Downloader;
  9738. use Composer\Package\PackageInterface;
  9739. interface ChangeReportInterface
  9740. {
  9741. public function getLocalChanges(PackageInterface $package, $path);
  9742. }
  9743. <?php
  9744. namespace Composer\Downloader;
  9745. use Composer\Package\PackageInterface;
  9746. use Composer\IO\IOInterface;
  9747. use Composer\Util\Filesystem;
  9748. class DownloadManager
  9749. {
  9750. private $io;
  9751. private $preferDist = false;
  9752. private $preferSource = false;
  9753. private $packagePreferences = array();
  9754. private $filesystem;
  9755. private $downloaders = array();
  9756. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  9757. {
  9758. $this->io = $io;
  9759. $this->preferSource = $preferSource;
  9760. $this->filesystem = $filesystem ?: new Filesystem();
  9761. }
  9762. public function setPreferSource($preferSource)
  9763. {
  9764. $this->preferSource = $preferSource;
  9765. return $this;
  9766. }
  9767. public function setPreferDist($preferDist)
  9768. {
  9769. $this->preferDist = $preferDist;
  9770. return $this;
  9771. }
  9772. public function setPreferences(array $preferences)
  9773. {
  9774. $this->packagePreferences = $preferences;
  9775. return $this;
  9776. }
  9777. public function setOutputProgress($outputProgress)
  9778. {
  9779. foreach ($this->downloaders as $downloader) {
  9780. $downloader->setOutputProgress($outputProgress);
  9781. }
  9782. return $this;
  9783. }
  9784. public function setDownloader($type, DownloaderInterface $downloader)
  9785. {
  9786. $type = strtolower($type);
  9787. $this->downloaders[$type] = $downloader;
  9788. return $this;
  9789. }
  9790. public function getDownloader($type)
  9791. {
  9792. $type = strtolower($type);
  9793. if (!isset($this->downloaders[$type])) {
  9794. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  9795. }
  9796. return $this->downloaders[$type];
  9797. }
  9798. public function getDownloaderForInstalledPackage(PackageInterface $package)
  9799. {
  9800. $installationSource = $package->getInstallationSource();
  9801. if ('metapackage' === $package->getType()) {
  9802. return;
  9803. }
  9804. if ('dist' === $installationSource) {
  9805. $downloader = $this->getDownloader($package->getDistType());
  9806. } elseif ('source' === $installationSource) {
  9807. $downloader = $this->getDownloader($package->getSourceType());
  9808. } else {
  9809. throw new \InvalidArgumentException(
  9810. 'Package '.$package.' seems not been installed properly'
  9811. );
  9812. }
  9813. if ($installationSource !== $downloader->getInstallationSource()) {
  9814. throw new \LogicException(sprintf(
  9815. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  9816. get_class($downloader), $downloader->getInstallationSource(), $installationSource, $package
  9817. ));
  9818. }
  9819. return $downloader;
  9820. }
  9821. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  9822. {
  9823. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  9824. $sourceType = $package->getSourceType();
  9825. $distType = $package->getDistType();
  9826. $sources = array();
  9827. if ($sourceType) {
  9828. $sources[] = 'source';
  9829. }
  9830. if ($distType) {
  9831. $sources[] = 'dist';
  9832. }
  9833. if (empty($sources)) {
  9834. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  9835. }
  9836. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  9837. $sources = array_reverse($sources);
  9838. }
  9839. $this->filesystem->ensureDirectoryExists($targetDir);
  9840. foreach ($sources as $i => $source) {
  9841. if (isset($e)) {
  9842. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  9843. }
  9844. $package->setInstallationSource($source);
  9845. try {
  9846. $downloader = $this->getDownloaderForInstalledPackage($package);
  9847. if ($downloader) {
  9848. $downloader->download($package, $targetDir);
  9849. }
  9850. break;
  9851. } catch (\RuntimeException $e) {
  9852. if ($i === count($sources) - 1) {
  9853. throw $e;
  9854. }
  9855. $this->io->writeError(
  9856. ' <warning>Failed to download '.
  9857. $package->getPrettyName().
  9858. ' from ' . $source . ': '.
  9859. $e->getMessage().'</warning>'
  9860. );
  9861. }
  9862. }
  9863. }
  9864. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  9865. {
  9866. $downloader = $this->getDownloaderForInstalledPackage($initial);
  9867. if (!$downloader) {
  9868. return;
  9869. }
  9870. $installationSource = $initial->getInstallationSource();
  9871. if ('dist' === $installationSource) {
  9872. $initialType = $initial->getDistType();
  9873. $targetType = $target->getDistType();
  9874. } else {
  9875. $initialType = $initial->getSourceType();
  9876. $targetType = $target->getSourceType();
  9877. }
  9878. if ($target->isDev() && 'dist' === $installationSource) {
  9879. $downloader->remove($initial, $targetDir);
  9880. $this->download($target, $targetDir);
  9881. return;
  9882. }
  9883. if ($initialType === $targetType) {
  9884. $target->setInstallationSource($installationSource);
  9885. try {
  9886. $downloader->update($initial, $target, $targetDir);
  9887. return;
  9888. } catch (\RuntimeException $e) {
  9889. if (!$this->io->isInteractive()) {
  9890. throw $e;
  9891. }
  9892. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  9893. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  9894. throw $e;
  9895. }
  9896. }
  9897. }
  9898. $downloader->remove($initial, $targetDir);
  9899. $this->download($target, $targetDir, 'source' === $installationSource);
  9900. }
  9901. public function remove(PackageInterface $package, $targetDir)
  9902. {
  9903. $downloader = $this->getDownloaderForInstalledPackage($package);
  9904. if ($downloader) {
  9905. $downloader->remove($package, $targetDir);
  9906. }
  9907. }
  9908. protected function resolvePackageInstallPreference(PackageInterface $package)
  9909. {
  9910. foreach ($this->packagePreferences as $pattern => $preference) {
  9911. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  9912. if (preg_match($pattern, $package->getName())) {
  9913. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  9914. return 'dist';
  9915. }
  9916. return 'source';
  9917. }
  9918. }
  9919. return $package->isDev() ? 'source' : 'dist';
  9920. }
  9921. }
  9922. <?php
  9923. namespace Composer\Downloader;
  9924. use Composer\Package\PackageInterface;
  9925. interface DownloaderInterface
  9926. {
  9927. public function getInstallationSource();
  9928. public function download(PackageInterface $package, $path);
  9929. public function update(PackageInterface $initial, PackageInterface $target, $path);
  9930. public function remove(PackageInterface $package, $path);
  9931. public function setOutputProgress($outputProgress);
  9932. }
  9933. <?php
  9934. namespace Composer\Downloader;
  9935. use Composer\Package\PackageInterface;
  9936. interface DvcsDownloaderInterface
  9937. {
  9938. public function getUnpushedChanges(PackageInterface $package, $path);
  9939. }
  9940. <?php
  9941. namespace Composer\Downloader;
  9942. use Composer\Config;
  9943. use Composer\Cache;
  9944. use Composer\Factory;
  9945. use Composer\IO\IOInterface;
  9946. use Composer\Package\PackageInterface;
  9947. use Composer\Plugin\PluginEvents;
  9948. use Composer\Plugin\PreFileDownloadEvent;
  9949. use Composer\EventDispatcher\EventDispatcher;
  9950. use Composer\Util\Filesystem;
  9951. use Composer\Util\RemoteFilesystem;
  9952. use Composer\Util\Url as UrlUtil;
  9953. class FileDownloader implements DownloaderInterface
  9954. {
  9955. protected $io;
  9956. protected $config;
  9957. protected $rfs;
  9958. protected $filesystem;
  9959. protected $cache;
  9960. protected $outputProgress = true;
  9961. private $lastCacheWrites = array();
  9962. private $eventDispatcher;
  9963. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  9964. {
  9965. $this->io = $io;
  9966. $this->config = $config;
  9967. $this->eventDispatcher = $eventDispatcher;
  9968. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  9969. $this->filesystem = $filesystem ?: new Filesystem();
  9970. $this->cache = $cache;
  9971. if ($this->cache && $this->cache->gcIsNecessary()) {
  9972. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  9973. }
  9974. }
  9975. public function getInstallationSource()
  9976. {
  9977. return 'dist';
  9978. }
  9979. public function download(PackageInterface $package, $path, $output = true)
  9980. {
  9981. if (!$package->getDistUrl()) {
  9982. throw new \InvalidArgumentException('The given package is missing url information');
  9983. }
  9984. if ($output) {
  9985. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  9986. }
  9987. $urls = $package->getDistUrls();
  9988. while ($url = array_shift($urls)) {
  9989. try {
  9990. $fileName = $this->doDownload($package, $path, $url);
  9991. break;
  9992. } catch (\Exception $e) {
  9993. if ($this->io->isDebug()) {
  9994. $this->io->writeError('');
  9995. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  9996. } elseif (count($urls)) {
  9997. $this->io->writeError('');
  9998. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  9999. }
  10000. if (!count($urls)) {
  10001. throw $e;
  10002. }
  10003. }
  10004. }
  10005. if ($output) {
  10006. $this->io->writeError('');
  10007. }
  10008. return $fileName;
  10009. }
  10010. protected function doDownload(PackageInterface $package, $path, $url)
  10011. {
  10012. $this->filesystem->emptyDirectory($path);
  10013. $fileName = $this->getFileName($package, $path);
  10014. $processedUrl = $this->processUrl($package, $url);
  10015. $hostname = parse_url($processedUrl, PHP_URL_HOST);
  10016. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  10017. if ($this->eventDispatcher) {
  10018. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  10019. }
  10020. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  10021. try {
  10022. $checksum = $package->getDistSha1Checksum();
  10023. $cacheKey = $this->getCacheKey($package, $processedUrl);
  10024. if (!$this->cache || ($checksum && $checksum !== $this->cache->sha1($cacheKey)) || !$this->cache->copyTo($cacheKey, $fileName)) {
  10025. if (!$this->outputProgress) {
  10026. $this->io->writeError('Downloading', false);
  10027. }
  10028. $retries = 3;
  10029. while ($retries--) {
  10030. try {
  10031. $rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  10032. break;
  10033. } catch (TransportException $e) {
  10034. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  10035. throw $e;
  10036. }
  10037. $this->io->writeError('');
  10038. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  10039. usleep(500000);
  10040. }
  10041. }
  10042. if (!$this->outputProgress) {
  10043. $this->io->writeError(' (<comment>100%</comment>)', false);
  10044. }
  10045. if ($this->cache) {
  10046. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  10047. $this->cache->copyFrom($cacheKey, $fileName);
  10048. }
  10049. } else {
  10050. $this->io->writeError('Loading from cache', false);
  10051. }
  10052. if (!file_exists($fileName)) {
  10053. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  10054. .' directory is writable and you have internet connectivity');
  10055. }
  10056. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  10057. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  10058. }
  10059. } catch (\Exception $e) {
  10060. $this->filesystem->removeDirectory($path);
  10061. $this->clearLastCacheWrite($package);
  10062. throw $e;
  10063. }
  10064. return $fileName;
  10065. }
  10066. public function setOutputProgress($outputProgress)
  10067. {
  10068. $this->outputProgress = $outputProgress;
  10069. return $this;
  10070. }
  10071. protected function clearLastCacheWrite(PackageInterface $package)
  10072. {
  10073. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  10074. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  10075. unset($this->lastCacheWrites[$package->getName()]);
  10076. }
  10077. }
  10078. public function update(PackageInterface $initial, PackageInterface $target, $path)
  10079. {
  10080. $name = $target->getName();
  10081. $from = $initial->getPrettyVersion();
  10082. $to = $target->getPrettyVersion();
  10083. $this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  10084. $this->remove($initial, $path, false);
  10085. $this->download($target, $path, false);
  10086. $this->io->writeError('');
  10087. }
  10088. public function remove(PackageInterface $package, $path, $output = true)
  10089. {
  10090. if ($output) {
  10091. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10092. }
  10093. if (!$this->filesystem->removeDirectory($path)) {
  10094. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10095. }
  10096. }
  10097. protected function getFileName(PackageInterface $package, $path)
  10098. {
  10099. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10100. }
  10101. protected function processUrl(PackageInterface $package, $url)
  10102. {
  10103. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  10104. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  10105. }
  10106. if ($package->getDistReference()) {
  10107. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  10108. }
  10109. return $url;
  10110. }
  10111. private function getCacheKey(PackageInterface $package, $processedUrl)
  10112. {
  10113. $cacheKey = sha1($processedUrl);
  10114. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  10115. }
  10116. }
  10117. <?php
  10118. namespace Composer\Downloader;
  10119. class FilesystemException extends \Exception
  10120. {
  10121. public function __construct($message = '', $code = 0, \Exception $previous = null)
  10122. {
  10123. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  10124. }
  10125. }
  10126. <?php
  10127. namespace Composer\Downloader;
  10128. use Composer\Package\PackageInterface;
  10129. use Composer\Util\ProcessExecutor;
  10130. class FossilDownloader extends VcsDownloader
  10131. {
  10132. public function doDownload(PackageInterface $package, $path, $url)
  10133. {
  10134. $this->config->prohibitUrlByConfig($url, $this->io);
  10135. $url = ProcessExecutor::escape($url);
  10136. $ref = ProcessExecutor::escape($package->getSourceReference());
  10137. $repoFile = $path . '.fossil';
  10138. $this->io->writeError("Cloning ".$package->getSourceReference());
  10139. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  10140. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10141. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10142. }
  10143. $command = sprintf('fossil open %s', ProcessExecutor::escape($repoFile));
  10144. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10145. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10146. }
  10147. $command = sprintf('fossil update %s', $ref);
  10148. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10149. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10150. }
  10151. }
  10152. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10153. {
  10154. $this->config->prohibitUrlByConfig($url, $this->io);
  10155. $url = ProcessExecutor::escape($url);
  10156. $ref = ProcessExecutor::escape($target->getSourceReference());
  10157. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10158. if (!$this->hasMetadataRepository($path)) {
  10159. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10160. }
  10161. $command = sprintf('fossil pull && fossil up %s', $ref);
  10162. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10163. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10164. }
  10165. }
  10166. public function getLocalChanges(PackageInterface $package, $path)
  10167. {
  10168. if (!$this->hasMetadataRepository($path)) {
  10169. return null;
  10170. }
  10171. $this->process->execute('fossil changes', $output, realpath($path));
  10172. return trim($output) ?: null;
  10173. }
  10174. protected function getCommitLogs($fromReference, $toReference, $path)
  10175. {
  10176. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', $toReference);
  10177. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10178. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10179. }
  10180. $log = '';
  10181. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  10182. foreach ($this->process->splitLines($output) as $line) {
  10183. if (preg_match($match, $line)) {
  10184. break;
  10185. }
  10186. $log .= $line;
  10187. }
  10188. return $log;
  10189. }
  10190. protected function hasMetadataRepository($path)
  10191. {
  10192. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  10193. }
  10194. }
  10195. <?php
  10196. namespace Composer\Downloader;
  10197. use Composer\Config;
  10198. use Composer\IO\IOInterface;
  10199. use Composer\Package\PackageInterface;
  10200. use Composer\Util\Filesystem;
  10201. use Composer\Util\Git as GitUtil;
  10202. use Composer\Util\Platform;
  10203. use Composer\Util\ProcessExecutor;
  10204. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  10205. {
  10206. private $hasStashedChanges = false;
  10207. private $hasDiscardedChanges = false;
  10208. private $gitUtil;
  10209. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10210. {
  10211. parent::__construct($io, $config, $process, $fs);
  10212. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  10213. }
  10214. public function doDownload(PackageInterface $package, $path, $url)
  10215. {
  10216. GitUtil::cleanEnv();
  10217. $path = $this->normalizePath($path);
  10218. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  10219. $ref = $package->getSourceReference();
  10220. $flag = Platform::isWindows() ? '/D ' : '';
  10221. $gitVersion = $this->gitUtil->getVersion();
  10222. $msg = "Cloning ".$this->getShortHash($ref);
  10223. $command = 'git clone --no-checkout %url% %path% && cd '.$flag.'%path% && git remote add composer %url% && git fetch composer';
  10224. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=')) {
  10225. $this->io->writeError('', true, IOInterface::DEBUG);
  10226. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  10227. try {
  10228. $this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref);
  10229. if (is_dir($cachePath)) {
  10230. $command =
  10231. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  10232. . '&& cd '.$flag.'%path% '
  10233. . '&& git remote set-url origin %url% && git remote add composer %url%';
  10234. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  10235. }
  10236. } catch (\RuntimeException $e) {
  10237. }
  10238. }
  10239. $this->io->writeError($msg);
  10240. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  10241. return str_replace(
  10242. array('%url%', '%path%', '%cachePath%'),
  10243. array(
  10244. ProcessExecutor::escape($url),
  10245. ProcessExecutor::escape($path),
  10246. ProcessExecutor::escape($cachePath),
  10247. ),
  10248. $command
  10249. );
  10250. };
  10251. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  10252. if ($url !== $package->getSourceUrl()) {
  10253. $this->updateOriginUrl($path, $package->getSourceUrl());
  10254. } else {
  10255. $this->setPushUrl($path, $url);
  10256. }
  10257. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  10258. if ($package->getDistReference() === $package->getSourceReference()) {
  10259. $package->setDistReference($newRef);
  10260. }
  10261. $package->setSourceReference($newRef);
  10262. }
  10263. }
  10264. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10265. {
  10266. GitUtil::cleanEnv();
  10267. if (!$this->hasMetadataRepository($path)) {
  10268. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10269. }
  10270. $updateOriginUrl = false;
  10271. if (
  10272. 0 === $this->process->execute('git remote -v', $output, $path)
  10273. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  10274. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  10275. ) {
  10276. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  10277. $updateOriginUrl = true;
  10278. }
  10279. }
  10280. $ref = $target->getSourceReference();
  10281. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  10282. $command = 'git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)';
  10283. $commandCallable = function ($url) use ($command, $ref) {
  10284. return sprintf($command, ProcessExecutor::escape($url), ProcessExecutor::escape($ref.'^{commit}'));
  10285. };
  10286. $this->gitUtil->runCommand($commandCallable, $url, $path);
  10287. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  10288. if ($target->getDistReference() === $target->getSourceReference()) {
  10289. $target->setDistReference($newRef);
  10290. }
  10291. $target->setSourceReference($newRef);
  10292. }
  10293. if ($updateOriginUrl) {
  10294. $this->updateOriginUrl($path, $target->getSourceUrl());
  10295. }
  10296. }
  10297. public function getLocalChanges(PackageInterface $package, $path)
  10298. {
  10299. GitUtil::cleanEnv();
  10300. if (!$this->hasMetadataRepository($path)) {
  10301. return;
  10302. }
  10303. $command = 'git status --porcelain --untracked-files=no';
  10304. if (0 !== $this->process->execute($command, $output, $path)) {
  10305. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10306. }
  10307. return trim($output) ?: null;
  10308. }
  10309. public function getUnpushedChanges(PackageInterface $package, $path)
  10310. {
  10311. GitUtil::cleanEnv();
  10312. $path = $this->normalizePath($path);
  10313. if (!$this->hasMetadataRepository($path)) {
  10314. return;
  10315. }
  10316. $command = 'git show-ref --head -d';
  10317. if (0 !== $this->process->execute($command, $output, $path)) {
  10318. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10319. }
  10320. $refs = trim($output);
  10321. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  10322. return;
  10323. }
  10324. $headRef = $match[1];
  10325. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  10326. return;
  10327. }
  10328. $branch = $matches[1][0];
  10329. $unpushedChanges = null;
  10330. for ($i = 0; $i <= 1; $i++) {
  10331. foreach ($matches[1] as $candidate) {
  10332. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  10333. $branch = $candidate;
  10334. $remoteBranch = $match[1];
  10335. break;
  10336. }
  10337. }
  10338. if (!isset($remoteBranch)) {
  10339. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  10340. } else {
  10341. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  10342. if (0 !== $this->process->execute($command, $output, $path)) {
  10343. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10344. }
  10345. $unpushedChanges = trim($output) ?: null;
  10346. }
  10347. if ($unpushedChanges && $i === 0) {
  10348. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  10349. }
  10350. if (!$unpushedChanges) {
  10351. break;
  10352. }
  10353. }
  10354. return $unpushedChanges;
  10355. }
  10356. protected function cleanChanges(PackageInterface $package, $path, $update)
  10357. {
  10358. GitUtil::cleanEnv();
  10359. $path = $this->normalizePath($path);
  10360. $unpushed = $this->getUnpushedChanges($package, $path);
  10361. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  10362. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  10363. }
  10364. if (!$changes = $this->getLocalChanges($package, $path)) {
  10365. return;
  10366. }
  10367. if (!$this->io->isInteractive()) {
  10368. $discardChanges = $this->config->get('discard-changes');
  10369. if (true === $discardChanges) {
  10370. return $this->discardChanges($path);
  10371. }
  10372. if ('stash' === $discardChanges) {
  10373. if (!$update) {
  10374. return parent::cleanChanges($package, $path, $update);
  10375. }
  10376. return $this->stashChanges($path);
  10377. }
  10378. return parent::cleanChanges($package, $path, $update);
  10379. }
  10380. $changes = array_map(function ($elem) {
  10381. return ' '.$elem;
  10382. }, preg_split('{\s*\r?\n\s*}', $changes));
  10383. $this->io->writeError(' <error>The package has modified files:</error>');
  10384. $this->io->writeError(array_slice($changes, 0, 10));
  10385. if (count($changes) > 10) {
  10386. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  10387. }
  10388. while (true) {
  10389. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  10390. case 'y':
  10391. $this->discardChanges($path);
  10392. break 2;
  10393. case 's':
  10394. if (!$update) {
  10395. goto help;
  10396. }
  10397. $this->stashChanges($path);
  10398. break 2;
  10399. case 'n':
  10400. throw new \RuntimeException('Update aborted');
  10401. case 'v':
  10402. $this->io->writeError($changes);
  10403. break;
  10404. case 'd':
  10405. $this->viewDiff($path);
  10406. break;
  10407. case '?':
  10408. default:
  10409. help:
  10410. $this->io->writeError(array(
  10411. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  10412. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  10413. ' v - view modified files',
  10414. ' d - view local modifications (diff)',
  10415. ));
  10416. if ($update) {
  10417. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  10418. }
  10419. $this->io->writeError(' ? - print help');
  10420. break;
  10421. }
  10422. }
  10423. }
  10424. protected function reapplyChanges($path)
  10425. {
  10426. $path = $this->normalizePath($path);
  10427. if ($this->hasStashedChanges) {
  10428. $this->hasStashedChanges = false;
  10429. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  10430. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  10431. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  10432. }
  10433. }
  10434. $this->hasDiscardedChanges = false;
  10435. }
  10436. protected function updateToCommit($path, $reference, $branch, $date)
  10437. {
  10438. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  10439. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  10440. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  10441. $branches = null;
  10442. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  10443. $branches = $output;
  10444. }
  10445. $gitRef = $reference;
  10446. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  10447. && $branches
  10448. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  10449. ) {
  10450. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  10451. if (0 === $this->process->execute($command, $output, $path)) {
  10452. return;
  10453. }
  10454. }
  10455. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  10456. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  10457. $branch = 'v' . $branch;
  10458. }
  10459. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  10460. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  10461. if (0 === $this->process->execute($command, $output, $path)
  10462. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  10463. ) {
  10464. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  10465. if (0 === $this->process->execute($command, $output, $path)) {
  10466. return;
  10467. }
  10468. }
  10469. }
  10470. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  10471. if (0 === $this->process->execute($command, $output, $path)) {
  10472. return;
  10473. }
  10474. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  10475. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  10476. }
  10477. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  10478. }
  10479. protected function updateOriginUrl($path, $url)
  10480. {
  10481. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  10482. $this->setPushUrl($path, $url);
  10483. }
  10484. protected function setPushUrl($path, $url)
  10485. {
  10486. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  10487. $protocols = $this->config->get('github-protocols');
  10488. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  10489. if (!in_array('ssh', $protocols, true)) {
  10490. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  10491. }
  10492. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  10493. $this->process->execute($cmd, $ignoredOutput, $path);
  10494. }
  10495. }
  10496. protected function getCommitLogs($fromReference, $toReference, $path)
  10497. {
  10498. $path = $this->normalizePath($path);
  10499. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', $fromReference, $toReference);
  10500. if (0 !== $this->process->execute($command, $output, $path)) {
  10501. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10502. }
  10503. return $output;
  10504. }
  10505. protected function discardChanges($path)
  10506. {
  10507. $path = $this->normalizePath($path);
  10508. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  10509. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  10510. }
  10511. $this->hasDiscardedChanges = true;
  10512. }
  10513. protected function stashChanges($path)
  10514. {
  10515. $path = $this->normalizePath($path);
  10516. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  10517. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  10518. }
  10519. $this->hasStashedChanges = true;
  10520. }
  10521. protected function viewDiff($path)
  10522. {
  10523. $path = $this->normalizePath($path);
  10524. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  10525. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  10526. }
  10527. $this->io->writeError($output);
  10528. }
  10529. protected function normalizePath($path)
  10530. {
  10531. if (Platform::isWindows() && strlen($path) > 0) {
  10532. $basePath = $path;
  10533. $removed = array();
  10534. while (!is_dir($basePath) && $basePath !== '\\') {
  10535. array_unshift($removed, basename($basePath));
  10536. $basePath = dirname($basePath);
  10537. }
  10538. if ($basePath === '\\') {
  10539. return $path;
  10540. }
  10541. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  10542. }
  10543. return $path;
  10544. }
  10545. protected function hasMetadataRepository($path)
  10546. {
  10547. $path = $this->normalizePath($path);
  10548. return is_dir($path.'/.git');
  10549. }
  10550. protected function getShortHash($reference)
  10551. {
  10552. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  10553. return substr($reference, 0, 10);
  10554. }
  10555. return $reference;
  10556. }
  10557. }
  10558. <?php
  10559. namespace Composer\Downloader;
  10560. use Composer\Config;
  10561. use Composer\Cache;
  10562. use Composer\EventDispatcher\EventDispatcher;
  10563. use Composer\Package\PackageInterface;
  10564. use Composer\Util\Platform;
  10565. use Composer\Util\ProcessExecutor;
  10566. use Composer\Util\RemoteFilesystem;
  10567. use Composer\IO\IOInterface;
  10568. class GzipDownloader extends ArchiveDownloader
  10569. {
  10570. protected $process;
  10571. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  10572. {
  10573. $this->process = $process ?: new ProcessExecutor($io);
  10574. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  10575. }
  10576. protected function extract($file, $path)
  10577. {
  10578. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  10579. if (!Platform::isWindows()) {
  10580. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  10581. if (0 === $this->process->execute($command, $ignoredOutput)) {
  10582. return;
  10583. }
  10584. if (extension_loaded('zlib')) {
  10585. $this->extractUsingExt($file, $targetFilepath);
  10586. return;
  10587. }
  10588. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  10589. throw new \RuntimeException($processError);
  10590. }
  10591. $this->extractUsingExt($file, $targetFilepath);
  10592. }
  10593. protected function getFileName(PackageInterface $package, $path)
  10594. {
  10595. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10596. }
  10597. private function extractUsingExt($file, $targetFilepath)
  10598. {
  10599. $archiveFile = gzopen($file, 'rb');
  10600. $targetFile = fopen($targetFilepath, 'wb');
  10601. while ($string = gzread($archiveFile, 4096)) {
  10602. fwrite($targetFile, $string, Platform::strlen($string));
  10603. }
  10604. gzclose($archiveFile);
  10605. fclose($targetFile);
  10606. }
  10607. }
  10608. <?php
  10609. namespace Composer\Downloader;
  10610. use Composer\Package\PackageInterface;
  10611. use Composer\Util\ProcessExecutor;
  10612. class HgDownloader extends VcsDownloader
  10613. {
  10614. public function doDownload(PackageInterface $package, $path, $url)
  10615. {
  10616. $this->config->prohibitUrlByConfig($url, $this->io);
  10617. $url = ProcessExecutor::escape($url);
  10618. $ref = ProcessExecutor::escape($package->getSourceReference());
  10619. $this->io->writeError("Cloning ".$package->getSourceReference());
  10620. $command = sprintf('hg clone %s %s', $url, ProcessExecutor::escape($path));
  10621. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10622. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10623. }
  10624. $command = sprintf('hg up %s', $ref);
  10625. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10626. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10627. }
  10628. }
  10629. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10630. {
  10631. $this->config->prohibitUrlByConfig($url, $this->io);
  10632. $url = ProcessExecutor::escape($url);
  10633. $ref = ProcessExecutor::escape($target->getSourceReference());
  10634. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10635. if (!$this->hasMetadataRepository($path)) {
  10636. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10637. }
  10638. $command = sprintf('hg pull %s && hg up %s', $url, $ref);
  10639. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10640. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10641. }
  10642. }
  10643. public function getLocalChanges(PackageInterface $package, $path)
  10644. {
  10645. if (!is_dir($path.'/.hg')) {
  10646. return null;
  10647. }
  10648. $this->process->execute('hg st', $output, realpath($path));
  10649. return trim($output) ?: null;
  10650. }
  10651. protected function getCommitLogs($fromReference, $toReference, $path)
  10652. {
  10653. $command = sprintf('hg log -r %s:%s --style compact', $fromReference, $toReference);
  10654. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10655. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10656. }
  10657. return $output;
  10658. }
  10659. protected function hasMetadataRepository($path)
  10660. {
  10661. return is_dir($path . '/.hg');
  10662. }
  10663. }
  10664. <?php
  10665. namespace Composer\Downloader;
  10666. use Composer\Package\Archiver\ArchivableFilesFinder;
  10667. use Composer\Package\Dumper\ArrayDumper;
  10668. use Composer\Package\PackageInterface;
  10669. use Composer\Package\Version\VersionGuesser;
  10670. use Composer\Package\Version\VersionParser;
  10671. use Composer\Util\Platform;
  10672. use Composer\Util\ProcessExecutor;
  10673. use Composer\Util\Filesystem as ComposerFilesystem;
  10674. use Symfony\Component\Filesystem\Exception\IOException;
  10675. use Symfony\Component\Filesystem\Filesystem;
  10676. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  10677. {
  10678. const STRATEGY_SYMLINK = 10;
  10679. const STRATEGY_MIRROR = 20;
  10680. public function download(PackageInterface $package, $path, $output = true)
  10681. {
  10682. $url = $package->getDistUrl();
  10683. $realUrl = realpath($url);
  10684. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  10685. throw new \RuntimeException(sprintf(
  10686. 'Source path "%s" is not found for package %s', $url, $package->getName()
  10687. ));
  10688. }
  10689. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  10690. throw new \RuntimeException(sprintf(
  10691. 'Package %s cannot install to "%s" inside its source at "%s"',
  10692. $package->getName(), realpath($path), $realUrl
  10693. ));
  10694. }
  10695. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  10696. $currentStrategy = self::STRATEGY_SYMLINK;
  10697. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  10698. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  10699. if ($mirrorPathRepos) {
  10700. $currentStrategy = self::STRATEGY_MIRROR;
  10701. }
  10702. if (true === $transportOptions['symlink']) {
  10703. $currentStrategy = self::STRATEGY_SYMLINK;
  10704. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  10705. } elseif (false === $transportOptions['symlink']) {
  10706. $currentStrategy = self::STRATEGY_MIRROR;
  10707. $allowedStrategies = array(self::STRATEGY_MIRROR);
  10708. }
  10709. $fileSystem = new Filesystem();
  10710. $this->filesystem->removeDirectory($path);
  10711. if ($output) {
  10712. $this->io->writeError(sprintf(
  10713. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  10714. $package->getName(),
  10715. $package->getFullPrettyVersion()
  10716. ), false);
  10717. }
  10718. $isFallback = false;
  10719. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  10720. try {
  10721. if (Platform::isWindows()) {
  10722. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  10723. $this->filesystem->junction($realUrl, $path);
  10724. } else {
  10725. $absolutePath = $path;
  10726. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  10727. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  10728. }
  10729. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  10730. $path = rtrim($path, "/");
  10731. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  10732. $fileSystem->symlink($shortestPath, $path);
  10733. }
  10734. } catch (IOException $e) {
  10735. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  10736. $this->io->writeError('');
  10737. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  10738. $currentStrategy = self::STRATEGY_MIRROR;
  10739. $isFallback = true;
  10740. } else {
  10741. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  10742. }
  10743. }
  10744. }
  10745. if (self::STRATEGY_MIRROR == $currentStrategy) {
  10746. $fs = new ComposerFilesystem();
  10747. $realUrl = $fs->normalizePath($realUrl);
  10748. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  10749. $iterator = new ArchivableFilesFinder($realUrl, array());
  10750. $fileSystem->mirror($realUrl, $path, $iterator);
  10751. }
  10752. $this->io->writeError('');
  10753. }
  10754. public function remove(PackageInterface $package, $path, $output = true)
  10755. {
  10756. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  10757. if ($output) {
  10758. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10759. }
  10760. if (!$this->filesystem->removeJunction($path)) {
  10761. $this->io->writeError(" <warn>Could not remove junction at " . $path . " - is another process locking it?</warn>");
  10762. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  10763. }
  10764. } else {
  10765. parent::remove($package, $path, $output);
  10766. }
  10767. }
  10768. public function getVcsReference(PackageInterface $package, $path)
  10769. {
  10770. $parser = new VersionParser;
  10771. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  10772. $dumper = new ArrayDumper;
  10773. $packageConfig = $dumper->dump($package);
  10774. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  10775. return $packageVersion['commit'];
  10776. }
  10777. }
  10778. }
  10779. <?php
  10780. namespace Composer\Downloader;
  10781. use Composer\Util\Filesystem;
  10782. class PearPackageExtractor
  10783. {
  10784. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  10785. private $filesystem;
  10786. private $file;
  10787. public function __construct($file)
  10788. {
  10789. if (!is_file($file)) {
  10790. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  10791. }
  10792. $this->filesystem = new Filesystem();
  10793. $this->file = $file;
  10794. }
  10795. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  10796. {
  10797. $extractionPath = $target.'/tarball';
  10798. try {
  10799. $archive = new \PharData($this->file);
  10800. $archive->extractTo($extractionPath, null, true);
  10801. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  10802. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  10803. }
  10804. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  10805. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  10806. $this->filesystem->removeDirectory($extractionPath);
  10807. } catch (\Exception $exception) {
  10808. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  10809. }
  10810. }
  10811. private function copyFiles($files, $source, $target, $roles, $vars)
  10812. {
  10813. foreach ($files as $file) {
  10814. $from = $this->combine($source, $file['from']);
  10815. $to = $this->combine($target, $roles[$file['role']]);
  10816. $to = $this->combine($to, $file['to']);
  10817. $tasks = $file['tasks'];
  10818. $this->copyFile($from, $to, $tasks, $vars);
  10819. }
  10820. }
  10821. private function copyFile($from, $to, $tasks, $vars)
  10822. {
  10823. if (!is_file($from)) {
  10824. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  10825. }
  10826. $this->filesystem->ensureDirectoryExists(dirname($to));
  10827. if (0 == count($tasks)) {
  10828. $copied = copy($from, $to);
  10829. } else {
  10830. $content = file_get_contents($from);
  10831. $replacements = array();
  10832. foreach ($tasks as $task) {
  10833. $pattern = $task['from'];
  10834. $varName = $task['to'];
  10835. if (isset($vars[$varName])) {
  10836. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  10837. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  10838. } else {
  10839. $replacements[$pattern] = $vars[$varName];
  10840. }
  10841. }
  10842. }
  10843. $content = strtr($content, $replacements);
  10844. $copied = file_put_contents($to, $content);
  10845. }
  10846. if (false === $copied) {
  10847. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  10848. }
  10849. }
  10850. private function buildCopyActions($source, array $roles, $vars)
  10851. {
  10852. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  10853. if (false === $package) {
  10854. throw new \RuntimeException('Package definition file is not valid.');
  10855. }
  10856. $packageSchemaVersion = $package['version'];
  10857. if ('1.0' == $packageSchemaVersion) {
  10858. $children = $package->release->filelist->children();
  10859. $packageName = (string) $package->name;
  10860. $packageVersion = (string) $package->release->version;
  10861. $sourceDir = $packageName . '-' . $packageVersion;
  10862. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  10863. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  10864. $children = $package->contents->children();
  10865. $packageName = (string) $package->name;
  10866. $packageVersion = (string) $package->version->release;
  10867. $sourceDir = $packageName . '-' . $packageVersion;
  10868. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  10869. $namespaces = $package->getNamespaces();
  10870. $package->registerXPathNamespace('ns', $namespaces['']);
  10871. $releaseNodes = $package->xpath('ns:phprelease');
  10872. $this->applyRelease($result, $releaseNodes, $vars);
  10873. } else {
  10874. throw new \RuntimeException('Unsupported schema version of package definition file.');
  10875. }
  10876. return $result;
  10877. }
  10878. private function applyRelease(&$actions, $releaseNodes, $vars)
  10879. {
  10880. foreach ($releaseNodes as $releaseNode) {
  10881. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  10882. if ($requiredOs && $vars['os'] != $requiredOs) {
  10883. continue;
  10884. }
  10885. if ($releaseNode->filelist) {
  10886. foreach ($releaseNode->filelist->children() as $action) {
  10887. if ('install' == $action->getName()) {
  10888. $name = (string) $action['name'];
  10889. $as = (string) $action['as'];
  10890. if (isset($actions[$name])) {
  10891. $actions[$name]['to'] = $as;
  10892. }
  10893. } elseif ('ignore' == $action->getName()) {
  10894. $name = (string) $action['name'];
  10895. unset($actions[$name]);
  10896. } else {
  10897. }
  10898. }
  10899. }
  10900. break;
  10901. }
  10902. }
  10903. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  10904. {
  10905. $result = array();
  10906. foreach ($children as $child) {
  10907. if ($child->getName() == 'dir') {
  10908. $dirSource = $this->combine($source, (string) $child['name']);
  10909. $dirTarget = $child['baseinstalldir'] ?: $target;
  10910. $dirRole = $child['role'] ?: $role;
  10911. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  10912. $result = array_merge($result, $dirFiles);
  10913. } elseif ($child->getName() == 'file') {
  10914. $fileRole = (string) $child['role'] ?: $role;
  10915. if (isset($targetRoles[$fileRole])) {
  10916. $fileName = (string) ($child['name'] ?: $child[0]);
  10917. $fileSource = $this->combine($source, $fileName);
  10918. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  10919. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  10920. $fileTarget = $packageName . '/' . $fileTarget;
  10921. }
  10922. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  10923. }
  10924. }
  10925. }
  10926. return $result;
  10927. }
  10928. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  10929. {
  10930. $result = array();
  10931. foreach ($children as $child) {
  10932. if ('dir' == $child->getName()) {
  10933. $dirSource = $this->combine($source, $child['name']);
  10934. $dirTarget = $child['baseinstalldir'] ?: $target;
  10935. $dirRole = $child['role'] ?: $role;
  10936. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  10937. $result = array_merge($result, $dirFiles);
  10938. } elseif ('file' == $child->getName()) {
  10939. $fileRole = (string) $child['role'] ?: $role;
  10940. if (isset($targetRoles[$fileRole])) {
  10941. $fileSource = $this->combine($source, (string) $child['name']);
  10942. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  10943. $fileTasks = array();
  10944. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  10945. if ('replace' == $taskNode->getName()) {
  10946. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  10947. }
  10948. }
  10949. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  10950. $fileTarget = $packageName . '/' . $fileTarget;
  10951. }
  10952. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  10953. }
  10954. }
  10955. }
  10956. return $result;
  10957. }
  10958. private function combine($left, $right)
  10959. {
  10960. return rtrim($left, '/') . '/' . ltrim($right, '/');
  10961. }
  10962. }
  10963. <?php
  10964. namespace Composer\Downloader;
  10965. use Composer\Package\PackageInterface;
  10966. use Composer\Repository\VcsRepository;
  10967. use Composer\Util\Perforce;
  10968. class PerforceDownloader extends VcsDownloader
  10969. {
  10970. protected $perforce;
  10971. public function doDownload(PackageInterface $package, $path, $url)
  10972. {
  10973. $ref = $package->getSourceReference();
  10974. $label = $this->getLabelFromSourceReference($ref);
  10975. $this->io->writeError('Cloning ' . $ref);
  10976. $this->initPerforce($package, $path, $url);
  10977. $this->perforce->setStream($ref);
  10978. $this->perforce->p4Login();
  10979. $this->perforce->writeP4ClientSpec();
  10980. $this->perforce->connectClient();
  10981. $this->perforce->syncCodeBase($label);
  10982. $this->perforce->cleanupClientSpec();
  10983. }
  10984. private function getLabelFromSourceReference($ref)
  10985. {
  10986. $pos = strpos($ref, '@');
  10987. if (false !== $pos) {
  10988. return substr($ref, $pos + 1);
  10989. }
  10990. return null;
  10991. }
  10992. public function initPerforce(PackageInterface $package, $path, $url)
  10993. {
  10994. if (!empty($this->perforce)) {
  10995. $this->perforce->initializePath($path);
  10996. return;
  10997. }
  10998. $repository = $package->getRepository();
  10999. $repoConfig = null;
  11000. if ($repository instanceof VcsRepository) {
  11001. $repoConfig = $this->getRepoConfig($repository);
  11002. }
  11003. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  11004. }
  11005. private function getRepoConfig(VcsRepository $repository)
  11006. {
  11007. return $repository->getRepoConfig();
  11008. }
  11009. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11010. {
  11011. $this->doDownload($target, $path, $url);
  11012. }
  11013. public function getLocalChanges(PackageInterface $package, $path)
  11014. {
  11015. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  11016. return;
  11017. }
  11018. protected function getCommitLogs($fromReference, $toReference, $path)
  11019. {
  11020. return $this->perforce->getCommitLogs($fromReference, $toReference);
  11021. }
  11022. public function setPerforce($perforce)
  11023. {
  11024. $this->perforce = $perforce;
  11025. }
  11026. protected function hasMetadataRepository($path)
  11027. {
  11028. return true;
  11029. }
  11030. }
  11031. <?php
  11032. namespace Composer\Downloader;
  11033. class PharDownloader extends ArchiveDownloader
  11034. {
  11035. protected function extract($file, $path)
  11036. {
  11037. $archive = new \Phar($file);
  11038. $archive->extractTo($path, null, true);
  11039. }
  11040. }
  11041. <?php
  11042. namespace Composer\Downloader;
  11043. use Composer\Config;
  11044. use Composer\Cache;
  11045. use Composer\EventDispatcher\EventDispatcher;
  11046. use Composer\Util\IniHelper;
  11047. use Composer\Util\Platform;
  11048. use Composer\Util\ProcessExecutor;
  11049. use Composer\Util\RemoteFilesystem;
  11050. use Composer\IO\IOInterface;
  11051. use RarArchive;
  11052. class RarDownloader extends ArchiveDownloader
  11053. {
  11054. protected $process;
  11055. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11056. {
  11057. $this->process = $process ?: new ProcessExecutor($io);
  11058. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11059. }
  11060. protected function extract($file, $path)
  11061. {
  11062. $processError = null;
  11063. if (!Platform::isWindows()) {
  11064. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  11065. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11066. return;
  11067. }
  11068. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11069. }
  11070. if (!class_exists('RarArchive')) {
  11071. $iniMessage = IniHelper::getMessage();
  11072. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  11073. . $iniMessage . "\n" . $processError;
  11074. if (!Platform::isWindows()) {
  11075. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  11076. }
  11077. throw new \RuntimeException($error);
  11078. }
  11079. $rarArchive = RarArchive::open($file);
  11080. if (false === $rarArchive) {
  11081. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  11082. }
  11083. $entries = $rarArchive->getEntries();
  11084. if (false === $entries) {
  11085. throw new \RuntimeException('Could not retrieve RAR archive entries');
  11086. }
  11087. foreach ($entries as $entry) {
  11088. if (false === $entry->extract($path)) {
  11089. throw new \RuntimeException('Could not extract entry');
  11090. }
  11091. }
  11092. $rarArchive->close();
  11093. }
  11094. }
  11095. <?php
  11096. namespace Composer\Downloader;
  11097. use Composer\Package\PackageInterface;
  11098. use Composer\Util\Svn as SvnUtil;
  11099. use Composer\Repository\VcsRepository;
  11100. use Composer\Util\ProcessExecutor;
  11101. class SvnDownloader extends VcsDownloader
  11102. {
  11103. protected $cacheCredentials = true;
  11104. public function doDownload(PackageInterface $package, $path, $url)
  11105. {
  11106. SvnUtil::cleanEnv();
  11107. $ref = $package->getSourceReference();
  11108. $repo = $package->getRepository();
  11109. if ($repo instanceof VcsRepository) {
  11110. $repoConfig = $repo->getRepoConfig();
  11111. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  11112. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  11113. }
  11114. }
  11115. $this->io->writeError(" Checking out ".$package->getSourceReference());
  11116. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  11117. }
  11118. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11119. {
  11120. SvnUtil::cleanEnv();
  11121. $ref = $target->getSourceReference();
  11122. if (!$this->hasMetadataRepository($path)) {
  11123. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11124. }
  11125. $flags = "";
  11126. if (0 === $this->process->execute('svn --version', $output)) {
  11127. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match) && version_compare($match[1], '1.7.0', '>=')) {
  11128. $flags .= ' --ignore-ancestry';
  11129. }
  11130. }
  11131. $this->io->writeError(" Checking out " . $ref);
  11132. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  11133. }
  11134. public function getLocalChanges(PackageInterface $package, $path)
  11135. {
  11136. if (!$this->hasMetadataRepository($path)) {
  11137. return null;
  11138. }
  11139. $this->process->execute('svn status --ignore-externals', $output, $path);
  11140. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  11141. }
  11142. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  11143. {
  11144. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11145. $util->setCacheCredentials($this->cacheCredentials);
  11146. try {
  11147. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  11148. } catch (\RuntimeException $e) {
  11149. throw new \RuntimeException(
  11150. 'Package could not be downloaded, '.$e->getMessage()
  11151. );
  11152. }
  11153. }
  11154. protected function cleanChanges(PackageInterface $package, $path, $update)
  11155. {
  11156. if (!$changes = $this->getLocalChanges($package, $path)) {
  11157. return;
  11158. }
  11159. if (!$this->io->isInteractive()) {
  11160. if (true === $this->config->get('discard-changes')) {
  11161. return $this->discardChanges($path);
  11162. }
  11163. return parent::cleanChanges($package, $path, $update);
  11164. }
  11165. $changes = array_map(function ($elem) {
  11166. return ' '.$elem;
  11167. }, preg_split('{\s*\r?\n\s*}', $changes));
  11168. $countChanges = count($changes);
  11169. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  11170. $this->io->writeError(array_slice($changes, 0, 10));
  11171. if ($countChanges > 10) {
  11172. $remaingChanges = $countChanges - 10;
  11173. $this->io->writeError(
  11174. sprintf(
  11175. ' <info>'.$remaingChanges.' more file%s modified, choose "v" to view the full list</info>',
  11176. $remaingChanges === 1 ? '' : 's'
  11177. )
  11178. );
  11179. }
  11180. while (true) {
  11181. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  11182. case 'y':
  11183. $this->discardChanges($path);
  11184. break 2;
  11185. case 'n':
  11186. throw new \RuntimeException('Update aborted');
  11187. case 'v':
  11188. $this->io->writeError($changes);
  11189. break;
  11190. case '?':
  11191. default:
  11192. $this->io->writeError(array(
  11193. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11194. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11195. ' v - view modified files',
  11196. ' ? - print help',
  11197. ));
  11198. break;
  11199. }
  11200. }
  11201. }
  11202. protected function getCommitLogs($fromReference, $toReference, $path)
  11203. {
  11204. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  11205. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  11206. if (0 !== $this->process->execute($command, $output, $path)) {
  11207. throw new \RuntimeException(
  11208. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  11209. );
  11210. }
  11211. $urlPattern = '#<url>(.*)</url>#';
  11212. if (preg_match($urlPattern, $output, $matches)) {
  11213. $baseUrl = $matches[1];
  11214. } else {
  11215. throw new \RuntimeException(
  11216. 'Unable to determine svn url for path '. $path
  11217. );
  11218. }
  11219. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  11220. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  11221. $command = sprintf('svn log -r%s:%s --incremental', $fromRevision, $toRevision);
  11222. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11223. $util->setCacheCredentials($this->cacheCredentials);
  11224. try {
  11225. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  11226. } catch (\RuntimeException $e) {
  11227. throw new \RuntimeException(
  11228. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  11229. );
  11230. }
  11231. }
  11232. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  11233. }
  11234. protected function discardChanges($path)
  11235. {
  11236. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  11237. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11238. }
  11239. }
  11240. protected function hasMetadataRepository($path)
  11241. {
  11242. return is_dir($path.'/.svn');
  11243. }
  11244. }
  11245. <?php
  11246. namespace Composer\Downloader;
  11247. class TarDownloader extends ArchiveDownloader
  11248. {
  11249. protected function extract($file, $path)
  11250. {
  11251. $archive = new \PharData($file);
  11252. $archive->extractTo($path, null, true);
  11253. }
  11254. }
  11255. <?php
  11256. namespace Composer\Downloader;
  11257. class TransportException extends \RuntimeException
  11258. {
  11259. protected $headers;
  11260. protected $response;
  11261. protected $statusCode;
  11262. public function setHeaders($headers)
  11263. {
  11264. $this->headers = $headers;
  11265. }
  11266. public function getHeaders()
  11267. {
  11268. return $this->headers;
  11269. }
  11270. public function setResponse($response)
  11271. {
  11272. $this->response = $response;
  11273. }
  11274. public function getResponse()
  11275. {
  11276. return $this->response;
  11277. }
  11278. public function setStatusCode($statusCode)
  11279. {
  11280. $this->statusCode = $statusCode;
  11281. }
  11282. public function getStatusCode()
  11283. {
  11284. return $this->statusCode;
  11285. }
  11286. }
  11287. <?php
  11288. namespace Composer\Downloader;
  11289. use Composer\Package\PackageInterface;
  11290. interface VcsCapableDownloaderInterface
  11291. {
  11292. public function getVcsReference(PackageInterface $package, $path);
  11293. }
  11294. <?php
  11295. namespace Composer\Downloader;
  11296. use Composer\Config;
  11297. use Composer\Package\Dumper\ArrayDumper;
  11298. use Composer\Package\PackageInterface;
  11299. use Composer\Package\Version\VersionGuesser;
  11300. use Composer\Package\Version\VersionParser;
  11301. use Composer\Util\ProcessExecutor;
  11302. use Composer\IO\IOInterface;
  11303. use Composer\Util\Filesystem;
  11304. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  11305. {
  11306. protected $io;
  11307. protected $config;
  11308. protected $process;
  11309. protected $filesystem;
  11310. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11311. {
  11312. $this->io = $io;
  11313. $this->config = $config;
  11314. $this->process = $process ?: new ProcessExecutor($io);
  11315. $this->filesystem = $fs ?: new Filesystem($this->process);
  11316. }
  11317. public function getInstallationSource()
  11318. {
  11319. return 'source';
  11320. }
  11321. public function download(PackageInterface $package, $path)
  11322. {
  11323. if (!$package->getSourceReference()) {
  11324. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  11325. }
  11326. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11327. $this->filesystem->emptyDirectory($path);
  11328. $urls = $package->getSourceUrls();
  11329. while ($url = array_shift($urls)) {
  11330. try {
  11331. if (Filesystem::isLocalPath($url)) {
  11332. $needle = 'file://';
  11333. $isFileProtocol = false;
  11334. if (0 === strpos($url, $needle)) {
  11335. $url = substr($url, strlen($needle));
  11336. $isFileProtocol = true;
  11337. }
  11338. if (false !== strpos($url, '%')) {
  11339. $url = rawurldecode($url);
  11340. }
  11341. $url = realpath($url);
  11342. if ($isFileProtocol) {
  11343. $url = $needle . $url;
  11344. }
  11345. }
  11346. $this->doDownload($package, $path, $url);
  11347. break;
  11348. } catch (\Exception $e) {
  11349. if ($e instanceof \PHPUnit_Framework_Exception) {
  11350. throw $e;
  11351. }
  11352. if ($this->io->isDebug()) {
  11353. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  11354. } elseif (count($urls)) {
  11355. $this->io->writeError(' Failed, trying the next URL');
  11356. }
  11357. if (!count($urls)) {
  11358. throw $e;
  11359. }
  11360. }
  11361. }
  11362. }
  11363. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11364. {
  11365. if (!$target->getSourceReference()) {
  11366. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  11367. }
  11368. $name = $target->getName();
  11369. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  11370. if ($target->getSourceType() === 'svn') {
  11371. $from = $initial->getSourceReference();
  11372. $to = $target->getSourceReference();
  11373. } else {
  11374. $from = substr($initial->getSourceReference(), 0, 7);
  11375. $to = substr($target->getSourceReference(), 0, 7);
  11376. }
  11377. $name .= ' '.$initial->getPrettyVersion();
  11378. } else {
  11379. $from = $initial->getFullPrettyVersion();
  11380. $to = $target->getFullPrettyVersion();
  11381. }
  11382. $this->io->writeError(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11383. $this->cleanChanges($initial, $path, true);
  11384. $urls = $target->getSourceUrls();
  11385. $exception = null;
  11386. while ($url = array_shift($urls)) {
  11387. try {
  11388. if (Filesystem::isLocalPath($url)) {
  11389. $url = realpath($url);
  11390. }
  11391. $this->doUpdate($initial, $target, $path, $url);
  11392. $exception = null;
  11393. break;
  11394. } catch (\Exception $exception) {
  11395. if ($exception instanceof \PHPUnit_Framework_Exception) {
  11396. throw $exception;
  11397. }
  11398. if ($this->io->isDebug()) {
  11399. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  11400. } elseif (count($urls)) {
  11401. $this->io->writeError(' Failed, trying the next URL');
  11402. }
  11403. }
  11404. }
  11405. $this->reapplyChanges($path);
  11406. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  11407. $message = 'Pulling in changes:';
  11408. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  11409. if (!trim($logs)) {
  11410. $message = 'Rolling back changes:';
  11411. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  11412. }
  11413. if (trim($logs)) {
  11414. $logs = implode("\n", array_map(function ($line) {
  11415. return ' ' . $line;
  11416. }, explode("\n", $logs)));
  11417. $logs = str_replace('<', '\<', $logs);
  11418. $this->io->writeError(' '.$message);
  11419. $this->io->writeError($logs);
  11420. }
  11421. }
  11422. if (!$urls && $exception) {
  11423. throw $exception;
  11424. }
  11425. }
  11426. public function remove(PackageInterface $package, $path)
  11427. {
  11428. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  11429. $this->cleanChanges($package, $path, false);
  11430. if (!$this->filesystem->removeDirectory($path)) {
  11431. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  11432. }
  11433. }
  11434. public function setOutputProgress($outputProgress)
  11435. {
  11436. return $this;
  11437. }
  11438. public function getVcsReference(PackageInterface $package, $path)
  11439. {
  11440. $parser = new VersionParser;
  11441. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  11442. $dumper = new ArrayDumper;
  11443. $packageConfig = $dumper->dump($package);
  11444. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11445. return $packageVersion['commit'];
  11446. }
  11447. }
  11448. protected function cleanChanges(PackageInterface $package, $path, $update)
  11449. {
  11450. if (null !== $this->getLocalChanges($package, $path)) {
  11451. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  11452. }
  11453. }
  11454. protected function reapplyChanges($path)
  11455. {
  11456. }
  11457. abstract protected function doDownload(PackageInterface $package, $path, $url);
  11458. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  11459. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  11460. abstract protected function hasMetadataRepository($path);
  11461. }
  11462. <?php
  11463. namespace Composer\Downloader;
  11464. use Composer\Config;
  11465. use Composer\Cache;
  11466. use Composer\EventDispatcher\EventDispatcher;
  11467. use Composer\Package\PackageInterface;
  11468. use Composer\Util\ProcessExecutor;
  11469. use Composer\Util\RemoteFilesystem;
  11470. use Composer\IO\IOInterface;
  11471. class XzDownloader extends ArchiveDownloader
  11472. {
  11473. protected $process;
  11474. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11475. {
  11476. $this->process = $process ?: new ProcessExecutor($io);
  11477. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11478. }
  11479. protected function extract($file, $path)
  11480. {
  11481. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  11482. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11483. return;
  11484. }
  11485. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11486. throw new \RuntimeException($processError);
  11487. }
  11488. protected function getFileName(PackageInterface $package, $path)
  11489. {
  11490. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11491. }
  11492. }
  11493. <?php
  11494. namespace Composer\Downloader;
  11495. use Composer\Config;
  11496. use Composer\Cache;
  11497. use Composer\EventDispatcher\EventDispatcher;
  11498. use Composer\Package\PackageInterface;
  11499. use Composer\Util\IniHelper;
  11500. use Composer\Util\Platform;
  11501. use Composer\Util\ProcessExecutor;
  11502. use Composer\Util\RemoteFilesystem;
  11503. use Composer\IO\IOInterface;
  11504. use Symfony\Component\Process\ExecutableFinder;
  11505. use ZipArchive;
  11506. class ZipDownloader extends ArchiveDownloader
  11507. {
  11508. protected static $hasSystemUnzip;
  11509. private static $hasZipArchive;
  11510. private static $isWindows;
  11511. protected $process;
  11512. private $zipArchiveObject;
  11513. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11514. {
  11515. $this->process = $process ?: new ProcessExecutor($io);
  11516. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11517. }
  11518. public function download(PackageInterface $package, $path, $output = true)
  11519. {
  11520. if (null === self::$hasSystemUnzip) {
  11521. $finder = new ExecutableFinder;
  11522. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  11523. }
  11524. if (null === self::$hasZipArchive) {
  11525. self::$hasZipArchive = class_exists('ZipArchive');
  11526. }
  11527. if (null === self::$isWindows) {
  11528. self::$isWindows = Platform::isWindows();
  11529. }
  11530. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  11531. $iniMessage = IniHelper::getMessage();
  11532. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  11533. throw new \RuntimeException($error);
  11534. }
  11535. return parent::download($package, $path, $output);
  11536. }
  11537. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  11538. {
  11539. if (!self::$hasZipArchive) {
  11540. $isLastChance = true;
  11541. }
  11542. if (!self::$hasSystemUnzip && !$isLastChance) {
  11543. return $this->extractWithZipArchive($file, $path, true);
  11544. }
  11545. $processError = null;
  11546. $overwrite = $isLastChance ? '-o' : '';
  11547. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  11548. try {
  11549. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11550. return true;
  11551. }
  11552. $processError = new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11553. } catch (\Exception $e) {
  11554. $processError = $e;
  11555. }
  11556. if ($isLastChance) {
  11557. throw $processError;
  11558. }
  11559. $this->io->writeError(' '.$processError->getMessage());
  11560. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  11561. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  11562. return $this->extractWithZipArchive($file, $path, true);
  11563. }
  11564. protected function extractWithZipArchive($file, $path, $isLastChance)
  11565. {
  11566. if (!self::$hasSystemUnzip) {
  11567. $isLastChance = true;
  11568. }
  11569. if (!self::$hasZipArchive && !$isLastChance) {
  11570. return $this->extractWithSystemUnzip($file, $path, true);
  11571. }
  11572. $processError = null;
  11573. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  11574. try {
  11575. if (true === ($retval = $zipArchive->open($file))) {
  11576. $extractResult = $zipArchive->extractTo($path);
  11577. if (true === $extractResult) {
  11578. $zipArchive->close();
  11579. return true;
  11580. }
  11581. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  11582. } else {
  11583. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  11584. }
  11585. } catch (\ErrorException $e) {
  11586. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  11587. } catch (\Exception $e) {
  11588. $processError = $e;
  11589. }
  11590. if ($isLastChance) {
  11591. throw $processError;
  11592. }
  11593. $this->io->writeError(' '.$processError->getMessage());
  11594. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  11595. return $this->extractWithSystemUnzip($file, $path, true);
  11596. }
  11597. public function extract($file, $path)
  11598. {
  11599. if (self::$isWindows) {
  11600. $this->extractWithZipArchive($file, $path, false);
  11601. } else {
  11602. $this->extractWithSystemUnzip($file, $path, false);
  11603. }
  11604. }
  11605. protected function getErrorMessage($retval, $file)
  11606. {
  11607. switch ($retval) {
  11608. case ZipArchive::ER_EXISTS:
  11609. return sprintf("File '%s' already exists.", $file);
  11610. case ZipArchive::ER_INCONS:
  11611. return sprintf("Zip archive '%s' is inconsistent.", $file);
  11612. case ZipArchive::ER_INVAL:
  11613. return sprintf("Invalid argument (%s)", $file);
  11614. case ZipArchive::ER_MEMORY:
  11615. return sprintf("Malloc failure (%s)", $file);
  11616. case ZipArchive::ER_NOENT:
  11617. return sprintf("No such zip file: '%s'", $file);
  11618. case ZipArchive::ER_NOZIP:
  11619. return sprintf("'%s' is not a zip archive.", $file);
  11620. case ZipArchive::ER_OPEN:
  11621. return sprintf("Can't open zip file: %s", $file);
  11622. case ZipArchive::ER_READ:
  11623. return sprintf("Zip read error (%s)", $file);
  11624. case ZipArchive::ER_SEEK:
  11625. return sprintf("Zip seek error (%s)", $file);
  11626. default:
  11627. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  11628. }
  11629. }
  11630. }
  11631. <?php
  11632. namespace Composer\EventDispatcher;
  11633. class Event
  11634. {
  11635. protected $name;
  11636. protected $args;
  11637. protected $flags;
  11638. private $propagationStopped = false;
  11639. public function __construct($name, array $args = array(), array $flags = array())
  11640. {
  11641. $this->name = $name;
  11642. $this->args = $args;
  11643. $this->flags = $flags;
  11644. }
  11645. public function getName()
  11646. {
  11647. return $this->name;
  11648. }
  11649. public function getArguments()
  11650. {
  11651. return $this->args;
  11652. }
  11653. public function getFlags()
  11654. {
  11655. return $this->flags;
  11656. }
  11657. public function isPropagationStopped()
  11658. {
  11659. return $this->propagationStopped;
  11660. }
  11661. public function stopPropagation()
  11662. {
  11663. $this->propagationStopped = true;
  11664. }
  11665. }
  11666. <?php
  11667. namespace Composer\EventDispatcher;
  11668. use Composer\DependencyResolver\PolicyInterface;
  11669. use Composer\DependencyResolver\Pool;
  11670. use Composer\DependencyResolver\Request;
  11671. use Composer\Installer\InstallerEvent;
  11672. use Composer\IO\IOInterface;
  11673. use Composer\Composer;
  11674. use Composer\DependencyResolver\Operation\OperationInterface;
  11675. use Composer\Repository\CompositeRepository;
  11676. use Composer\Script;
  11677. use Composer\Installer\PackageEvent;
  11678. use Composer\Installer\BinaryInstaller;
  11679. use Composer\Util\ProcessExecutor;
  11680. use Composer\Script\Event as ScriptEvent;
  11681. use Symfony\Component\Process\PhpExecutableFinder;
  11682. class EventDispatcher
  11683. {
  11684. protected $composer;
  11685. protected $io;
  11686. protected $loader;
  11687. protected $process;
  11688. protected $listeners;
  11689. private $eventStack;
  11690. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  11691. {
  11692. $this->composer = $composer;
  11693. $this->io = $io;
  11694. $this->process = $process ?: new ProcessExecutor($io);
  11695. $this->eventStack = array();
  11696. }
  11697. public function dispatch($eventName, Event $event = null)
  11698. {
  11699. if (null === $event) {
  11700. $event = new Event($eventName);
  11701. }
  11702. return $this->doDispatch($event);
  11703. }
  11704. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  11705. {
  11706. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  11707. }
  11708. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  11709. {
  11710. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  11711. }
  11712. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  11713. {
  11714. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  11715. }
  11716. protected function doDispatch(Event $event)
  11717. {
  11718. $pathStr = 'PATH';
  11719. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  11720. $pathStr = 'Path';
  11721. }
  11722. $binDir = $this->composer->getConfig()->get('bin-dir');
  11723. if (is_dir($binDir)) {
  11724. $binDir = realpath($binDir);
  11725. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  11726. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  11727. putenv($pathStr.'='.$_SERVER[$pathStr]);
  11728. }
  11729. }
  11730. $listeners = $this->getListeners($event);
  11731. $this->pushEvent($event);
  11732. $return = 0;
  11733. foreach ($listeners as $callable) {
  11734. if (!is_string($callable) && is_callable($callable)) {
  11735. $event = $this->checkListenerExpectedEvent($callable, $event);
  11736. $return = false === call_user_func($callable, $event) ? 1 : 0;
  11737. } elseif ($this->isComposerScript($callable)) {
  11738. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  11739. $scriptName = substr($callable, 1);
  11740. $args = $event->getArguments();
  11741. $flags = $event->getFlags();
  11742. if (substr($callable, 0, 10) === '@composer ') {
  11743. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  11744. if (0 !== ($exitCode = $this->process->execute($exec))) {
  11745. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  11746. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  11747. }
  11748. } else {
  11749. if (!$this->getListeners(new Event($scriptName))) {
  11750. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  11751. }
  11752. $return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
  11753. }
  11754. } elseif ($this->isPhpScript($callable)) {
  11755. $className = substr($callable, 0, strpos($callable, '::'));
  11756. $methodName = substr($callable, strpos($callable, '::') + 2);
  11757. if (!class_exists($className)) {
  11758. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  11759. continue;
  11760. }
  11761. if (!is_callable($callable)) {
  11762. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  11763. continue;
  11764. }
  11765. try {
  11766. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  11767. } catch (\Exception $e) {
  11768. $message = "Script %s handling the %s event terminated with an exception";
  11769. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  11770. throw $e;
  11771. }
  11772. } else {
  11773. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  11774. $exec = $callable . ($args === '' ? '' : ' '.$args);
  11775. if ($this->io->isVerbose()) {
  11776. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  11777. } else {
  11778. $this->io->writeError(sprintf('> %s', $exec));
  11779. }
  11780. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  11781. if ($possibleLocalBinaries) {
  11782. foreach ($possibleLocalBinaries as $localExec) {
  11783. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  11784. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  11785. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  11786. break;
  11787. }
  11788. }
  11789. }
  11790. if (substr($exec, 0, 5) === '@php ') {
  11791. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  11792. }
  11793. if (0 !== ($exitCode = $this->process->execute($exec))) {
  11794. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  11795. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  11796. }
  11797. }
  11798. if ($event->isPropagationStopped()) {
  11799. break;
  11800. }
  11801. }
  11802. $this->popEvent();
  11803. return $return;
  11804. }
  11805. protected function getPhpExecCommand()
  11806. {
  11807. $finder = new PhpExecutableFinder();
  11808. $phpPath = $finder->find();
  11809. if (!$phpPath) {
  11810. throw new \RuntimeException('Failed to locate PHP binary to execute '.$scriptName);
  11811. }
  11812. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  11813. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  11814. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  11815. return ProcessExecutor::escape($phpPath) . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  11816. }
  11817. protected function executeEventPhpScript($className, $methodName, Event $event)
  11818. {
  11819. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  11820. if ($this->io->isVerbose()) {
  11821. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  11822. } else {
  11823. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  11824. }
  11825. return $className::$methodName($event);
  11826. }
  11827. protected function checkListenerExpectedEvent($target, Event $event)
  11828. {
  11829. if (in_array($event->getName(), array(
  11830. 'init',
  11831. 'command',
  11832. 'pre-file-download',
  11833. ), true)) {
  11834. return $event;
  11835. }
  11836. try {
  11837. $reflected = new \ReflectionParameter($target, 0);
  11838. } catch (\Exception $e) {
  11839. return $event;
  11840. }
  11841. $typehint = $reflected->getClass();
  11842. if (!$typehint instanceof \ReflectionClass) {
  11843. return $event;
  11844. }
  11845. $expected = $typehint->getName();
  11846. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  11847. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11848. $event = new \Composer\Script\CommandEvent(
  11849. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(), $event->getArguments()
  11850. );
  11851. }
  11852. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  11853. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11854. $event = new \Composer\Script\PackageEvent(
  11855. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  11856. $event->getPolicy(), $event->getPool(), $event->getInstalledRepo(), $event->getRequest(),
  11857. $event->getOperations(), $event->getOperation()
  11858. );
  11859. }
  11860. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  11861. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  11862. $event = new \Composer\Script\Event(
  11863. $event->getName(), $event->getComposer(), $event->getIO(), $event->isDevMode(),
  11864. $event->getArguments(), $event->getFlags()
  11865. );
  11866. }
  11867. return $event;
  11868. }
  11869. private function serializeCallback($cb)
  11870. {
  11871. if (is_array($cb) && count($cb) === 2) {
  11872. if (is_object($cb[0])) {
  11873. $cb[0] = get_class($cb[0]);
  11874. }
  11875. if (is_string($cb[0]) && is_string($cb[1])) {
  11876. $cb = implode('::', $cb);
  11877. }
  11878. }
  11879. if (is_string($cb)) {
  11880. return $cb;
  11881. }
  11882. return var_export($cb, true);
  11883. }
  11884. public function addListener($eventName, $listener, $priority = 0)
  11885. {
  11886. $this->listeners[$eventName][$priority][] = $listener;
  11887. }
  11888. public function addSubscriber(EventSubscriberInterface $subscriber)
  11889. {
  11890. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  11891. if (is_string($params)) {
  11892. $this->addListener($eventName, array($subscriber, $params));
  11893. } elseif (is_string($params[0])) {
  11894. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  11895. } else {
  11896. foreach ($params as $listener) {
  11897. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  11898. }
  11899. }
  11900. }
  11901. }
  11902. protected function getListeners(Event $event)
  11903. {
  11904. $scriptListeners = $this->getScriptListeners($event);
  11905. if (!isset($this->listeners[$event->getName()][0])) {
  11906. $this->listeners[$event->getName()][0] = array();
  11907. }
  11908. krsort($this->listeners[$event->getName()]);
  11909. $listeners = $this->listeners;
  11910. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  11911. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  11912. }
  11913. public function hasEventListeners(Event $event)
  11914. {
  11915. $listeners = $this->getListeners($event);
  11916. return count($listeners) > 0;
  11917. }
  11918. protected function getScriptListeners(Event $event)
  11919. {
  11920. $package = $this->composer->getPackage();
  11921. $scripts = $package->getScripts();
  11922. if (empty($scripts[$event->getName()])) {
  11923. return array();
  11924. }
  11925. if ($this->loader) {
  11926. $this->loader->unregister();
  11927. }
  11928. $generator = $this->composer->getAutoloadGenerator();
  11929. if ($event instanceof ScriptEvent) {
  11930. $generator->setDevMode($event->isDevMode());
  11931. }
  11932. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  11933. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  11934. $map = $generator->parseAutoloads($packageMap, $package);
  11935. $this->loader = $generator->createLoader($map);
  11936. $this->loader->register();
  11937. return $scripts[$event->getName()];
  11938. }
  11939. protected function isPhpScript($callable)
  11940. {
  11941. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  11942. }
  11943. protected function isComposerScript($callable)
  11944. {
  11945. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5);
  11946. }
  11947. protected function pushEvent(Event $event)
  11948. {
  11949. $eventName = $event->getName();
  11950. if (in_array($eventName, $this->eventStack)) {
  11951. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  11952. }
  11953. return array_push($this->eventStack, $eventName);
  11954. }
  11955. protected function popEvent()
  11956. {
  11957. return array_pop($this->eventStack);
  11958. }
  11959. }
  11960. <?php
  11961. namespace Composer\EventDispatcher;
  11962. interface EventSubscriberInterface
  11963. {
  11964. public static function getSubscribedEvents();
  11965. }
  11966. <?php
  11967. namespace Composer\EventDispatcher;
  11968. class ScriptExecutionException extends \RuntimeException
  11969. {
  11970. }
  11971. <?php
  11972. namespace Composer\Exception;
  11973. class NoSslException extends \RuntimeException
  11974. {
  11975. }
  11976. <?php
  11977. namespace Composer;
  11978. use Composer\Config\JsonConfigSource;
  11979. use Composer\Json\JsonFile;
  11980. use Composer\IO\IOInterface;
  11981. use Composer\Package\Archiver;
  11982. use Composer\Package\Version\VersionGuesser;
  11983. use Composer\Repository\RepositoryManager;
  11984. use Composer\Repository\RepositoryFactory;
  11985. use Composer\Repository\WritableRepositoryInterface;
  11986. use Composer\Util\Filesystem;
  11987. use Composer\Util\Platform;
  11988. use Composer\Util\ProcessExecutor;
  11989. use Composer\Util\RemoteFilesystem;
  11990. use Composer\Util\Silencer;
  11991. use Composer\Plugin\PluginEvents;
  11992. use Composer\EventDispatcher\Event;
  11993. use Seld\JsonLint\DuplicateKeyException;
  11994. use Symfony\Component\Console\Formatter\OutputFormatter;
  11995. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  11996. use Symfony\Component\Console\Output\ConsoleOutput;
  11997. use Composer\EventDispatcher\EventDispatcher;
  11998. use Composer\Autoload\AutoloadGenerator;
  11999. use Composer\Package\Version\VersionParser;
  12000. use Composer\Downloader\TransportException;
  12001. use Seld\JsonLint\JsonParser;
  12002. class Factory
  12003. {
  12004. protected static function getHomeDir()
  12005. {
  12006. $home = getenv('COMPOSER_HOME');
  12007. if ($home) {
  12008. return $home;
  12009. }
  12010. if (Platform::isWindows()) {
  12011. if (!getenv('APPDATA')) {
  12012. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12013. }
  12014. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  12015. }
  12016. $userDir = self::getUserDir();
  12017. if (is_dir($userDir . '/.composer')) {
  12018. return $userDir . '/.composer';
  12019. }
  12020. if (self::useXdg()) {
  12021. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  12022. return $xdgConfig . '/composer';
  12023. }
  12024. return $userDir . '/.composer';
  12025. }
  12026. protected static function getCacheDir($home)
  12027. {
  12028. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  12029. if ($cacheDir) {
  12030. return $cacheDir;
  12031. }
  12032. $homeEnv = getenv('COMPOSER_HOME');
  12033. if ($homeEnv) {
  12034. return $homeEnv . '/cache';
  12035. }
  12036. if (Platform::isWindows()) {
  12037. if ($cacheDir = getenv('LOCALAPPDATA')) {
  12038. $cacheDir .= '/Composer';
  12039. } else {
  12040. $cacheDir = $home . '/cache';
  12041. }
  12042. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  12043. }
  12044. $userDir = self::getUserDir();
  12045. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  12046. return $home . '/cache';
  12047. }
  12048. if (self::useXdg()) {
  12049. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  12050. return $xdgCache . '/composer';
  12051. }
  12052. return $home . '/cache';
  12053. }
  12054. protected static function getDataDir($home)
  12055. {
  12056. $homeEnv = getenv('COMPOSER_HOME');
  12057. if ($homeEnv) {
  12058. return $homeEnv;
  12059. }
  12060. if (Platform::isWindows()) {
  12061. return strtr($home, '\\', '/');
  12062. }
  12063. $userDir = self::getUserDir();
  12064. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  12065. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  12066. return $xdgData . '/composer';
  12067. }
  12068. return $home;
  12069. }
  12070. public static function createConfig(IOInterface $io = null, $cwd = null)
  12071. {
  12072. $cwd = $cwd ?: getcwd();
  12073. $config = new Config(true, $cwd);
  12074. $home = self::getHomeDir();
  12075. $config->merge(array('config' => array(
  12076. 'home' => $home,
  12077. 'cache-dir' => self::getCacheDir($home),
  12078. 'data-dir' => self::getDataDir($home),
  12079. )));
  12080. $htaccessProtect = (bool) $config->get('htaccess-protect');
  12081. if ($htaccessProtect) {
  12082. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  12083. foreach ($dirs as $dir) {
  12084. if (!file_exists($dir . '/.htaccess')) {
  12085. if (!is_dir($dir)) {
  12086. Silencer::call('mkdir', $dir, 0777, true);
  12087. }
  12088. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  12089. }
  12090. }
  12091. }
  12092. $file = new JsonFile($config->get('home').'/config.json');
  12093. if ($file->exists()) {
  12094. if ($io && $io->isDebug()) {
  12095. $io->writeError('Loading config file ' . $file->getPath());
  12096. }
  12097. $config->merge($file->read());
  12098. }
  12099. $config->setConfigSource(new JsonConfigSource($file));
  12100. $file = new JsonFile($config->get('home').'/auth.json');
  12101. if ($file->exists()) {
  12102. if ($io && $io->isDebug()) {
  12103. $io->writeError('Loading config file ' . $file->getPath());
  12104. }
  12105. $config->merge(array('config' => $file->read()));
  12106. }
  12107. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  12108. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  12109. $authData = json_decode($composerAuthEnv, true);
  12110. if (null === $authData) {
  12111. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  12112. }
  12113. if ($io && $io->isDebug()) {
  12114. $io->writeError('Loading auth config from COMPOSER_AUTH');
  12115. }
  12116. $config->merge(array('config' => $authData));
  12117. }
  12118. return $config;
  12119. }
  12120. public static function getComposerFile()
  12121. {
  12122. return trim(getenv('COMPOSER')) ?: './composer.json';
  12123. }
  12124. public static function createAdditionalStyles()
  12125. {
  12126. return array(
  12127. 'highlight' => new OutputFormatterStyle('red'),
  12128. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  12129. );
  12130. }
  12131. public static function createOutput()
  12132. {
  12133. $styles = self::createAdditionalStyles();
  12134. $formatter = new OutputFormatter(false, $styles);
  12135. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  12136. }
  12137. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  12138. {
  12139. return RepositoryFactory::defaultRepos($io, $config, $rm);
  12140. }
  12141. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  12142. {
  12143. $cwd = $cwd ?: getcwd();
  12144. if (null === $localConfig) {
  12145. $localConfig = static::getComposerFile();
  12146. }
  12147. if (is_string($localConfig)) {
  12148. $composerFile = $localConfig;
  12149. $file = new JsonFile($localConfig, null, $io);
  12150. if (!$file->exists()) {
  12151. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  12152. $message = 'Composer could not find a composer.json file in '.$cwd;
  12153. } else {
  12154. $message = 'Composer could not find the config file: '.$localConfig;
  12155. }
  12156. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  12157. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  12158. }
  12159. $file->validateSchema(JsonFile::LAX_SCHEMA);
  12160. $jsonParser = new JsonParser;
  12161. try {
  12162. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  12163. } catch (DuplicateKeyException $e) {
  12164. $details = $e->getDetails();
  12165. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  12166. }
  12167. $localConfig = $file->read();
  12168. }
  12169. $config = static::createConfig($io, $cwd);
  12170. $config->merge($localConfig);
  12171. if (isset($composerFile)) {
  12172. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  12173. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  12174. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  12175. if ($localAuthFile->exists()) {
  12176. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  12177. $config->merge(array('config' => $localAuthFile->read()));
  12178. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  12179. }
  12180. }
  12181. $vendorDir = $config->get('vendor-dir');
  12182. $composer = new Composer();
  12183. $composer->setConfig($config);
  12184. if ($fullLoad) {
  12185. $io->loadConfiguration($config);
  12186. }
  12187. $rfs = self::createRemoteFilesystem($io, $config);
  12188. $dispatcher = new EventDispatcher($composer, $io);
  12189. $composer->setEventDispatcher($dispatcher);
  12190. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  12191. $composer->setRepositoryManager($rm);
  12192. $this->addLocalRepository($io, $rm, $vendorDir);
  12193. if (!$fullLoad && !isset($localConfig['version'])) {
  12194. $localConfig['version'] = '1.0.0';
  12195. }
  12196. $parser = new VersionParser;
  12197. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  12198. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser);
  12199. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  12200. $composer->setPackage($package);
  12201. $im = $this->createInstallationManager();
  12202. $composer->setInstallationManager($im);
  12203. if ($fullLoad) {
  12204. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  12205. $composer->setDownloadManager($dm);
  12206. $generator = new AutoloadGenerator($dispatcher, $io);
  12207. $composer->setAutoloadGenerator($generator);
  12208. $am = $this->createArchiveManager($config, $dm);
  12209. $composer->setArchiveManager($am);
  12210. }
  12211. $this->createDefaultInstallers($im, $composer, $io);
  12212. if ($fullLoad) {
  12213. $globalComposer = null;
  12214. if (realpath($config->get('home')) !== $cwd) {
  12215. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  12216. }
  12217. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  12218. $composer->setPluginManager($pm);
  12219. $pm->loadInstalledPlugins();
  12220. }
  12221. if ($fullLoad && isset($composerFile)) {
  12222. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  12223. ? substr($composerFile, 0, -4).'lock'
  12224. : $composerFile . '.lock';
  12225. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  12226. $composer->setLocker($locker);
  12227. }
  12228. if ($fullLoad) {
  12229. $initEvent = new Event(PluginEvents::INIT);
  12230. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  12231. if ($rm->getLocalRepository()) {
  12232. $this->purgePackages($rm->getLocalRepository(), $im);
  12233. }
  12234. }
  12235. return $composer;
  12236. }
  12237. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  12238. {
  12239. $factory = new static();
  12240. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  12241. }
  12242. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  12243. {
  12244. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  12245. }
  12246. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  12247. {
  12248. $composer = null;
  12249. try {
  12250. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  12251. } catch (\Exception $e) {
  12252. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  12253. }
  12254. return $composer;
  12255. }
  12256. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  12257. {
  12258. $cache = null;
  12259. if ($config->get('cache-files-ttl') > 0) {
  12260. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  12261. }
  12262. $dm = new Downloader\DownloadManager($io);
  12263. switch ($preferred = $config->get('preferred-install')) {
  12264. case 'dist':
  12265. $dm->setPreferDist(true);
  12266. break;
  12267. case 'source':
  12268. $dm->setPreferSource(true);
  12269. break;
  12270. case 'auto':
  12271. default:
  12272. break;
  12273. }
  12274. if (is_array($preferred)) {
  12275. $dm->setPreferences($preferred);
  12276. }
  12277. $executor = new ProcessExecutor($io);
  12278. $fs = new Filesystem($executor);
  12279. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  12280. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  12281. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  12282. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  12283. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  12284. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12285. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12286. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12287. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12288. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12289. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12290. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12291. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12292. return $dm;
  12293. }
  12294. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  12295. {
  12296. if (null === $dm) {
  12297. $io = new IO\NullIO();
  12298. $io->loadConfiguration($config);
  12299. $dm = $this->createDownloadManager($io, $config);
  12300. }
  12301. $am = new Archiver\ArchiveManager($dm);
  12302. $am->addArchiver(new Archiver\ZipArchiver);
  12303. $am->addArchiver(new Archiver\PharArchiver);
  12304. return $am;
  12305. }
  12306. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  12307. {
  12308. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  12309. }
  12310. protected function createInstallationManager()
  12311. {
  12312. return new Installer\InstallationManager();
  12313. }
  12314. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  12315. {
  12316. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  12317. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  12318. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  12319. $im->addInstaller(new Installer\MetapackageInstaller($io));
  12320. }
  12321. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  12322. {
  12323. foreach ($repo->getPackages() as $package) {
  12324. if (!$im->isPackageInstalled($repo, $package)) {
  12325. $repo->removePackage($package);
  12326. }
  12327. }
  12328. }
  12329. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  12330. {
  12331. $factory = new static();
  12332. return $factory->createComposer($io, $config, $disablePlugins);
  12333. }
  12334. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  12335. {
  12336. static $warned = false;
  12337. $disableTls = false;
  12338. if ($config && $config->get('disable-tls') === true) {
  12339. if (!$warned) {
  12340. $io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  12341. }
  12342. $warned = true;
  12343. $disableTls = true;
  12344. } elseif (!extension_loaded('openssl')) {
  12345. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  12346. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  12347. }
  12348. $remoteFilesystemOptions = array();
  12349. if ($disableTls === false) {
  12350. if ($config && $config->get('cafile')) {
  12351. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  12352. }
  12353. if ($config && $config->get('capath')) {
  12354. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  12355. }
  12356. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  12357. }
  12358. try {
  12359. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  12360. } catch (TransportException $e) {
  12361. if (false !== strpos($e->getMessage(), 'cafile')) {
  12362. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  12363. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  12364. if (PHP_VERSION_ID < 50600) {
  12365. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  12366. }
  12367. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  12368. }
  12369. throw $e;
  12370. }
  12371. return $remoteFilesystem;
  12372. }
  12373. private static function useXdg()
  12374. {
  12375. foreach (array_keys($_SERVER) as $key) {
  12376. if (substr($key, 0, 4) === 'XDG_') {
  12377. return true;
  12378. }
  12379. }
  12380. return false;
  12381. }
  12382. private static function getUserDir()
  12383. {
  12384. $home = getenv('HOME');
  12385. if (!$home) {
  12386. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12387. }
  12388. return rtrim(strtr($home, '\\', '/'), '/');
  12389. }
  12390. }
  12391. <?php
  12392. namespace Composer\IO;
  12393. use Composer\Config;
  12394. use Composer\Util\ProcessExecutor;
  12395. use Psr\Log\LoggerInterface;
  12396. use Psr\Log\LogLevel;
  12397. abstract class BaseIO implements IOInterface, LoggerInterface
  12398. {
  12399. protected $authentications = array();
  12400. public function getAuthentications()
  12401. {
  12402. return $this->authentications;
  12403. }
  12404. public function hasAuthentication($repositoryName)
  12405. {
  12406. return isset($this->authentications[$repositoryName]);
  12407. }
  12408. public function getAuthentication($repositoryName)
  12409. {
  12410. if (isset($this->authentications[$repositoryName])) {
  12411. return $this->authentications[$repositoryName];
  12412. }
  12413. return array('username' => null, 'password' => null);
  12414. }
  12415. public function setAuthentication($repositoryName, $username, $password = null)
  12416. {
  12417. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  12418. }
  12419. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  12420. {
  12421. if ($this->hasAuthentication($repositoryName)) {
  12422. $auth = $this->getAuthentication($repositoryName);
  12423. if ($auth['username'] === $username && $auth['password'] === $password) {
  12424. return;
  12425. }
  12426. $this->writeError(
  12427. sprintf(
  12428. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  12429. $repositoryName
  12430. )
  12431. );
  12432. }
  12433. $this->setAuthentication($repositoryName, $username, $password);
  12434. }
  12435. public function loadConfiguration(Config $config)
  12436. {
  12437. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  12438. $githubOauth = $config->get('github-oauth') ?: array();
  12439. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  12440. $gitlabToken = $config->get('gitlab-token') ?: array();
  12441. $httpBasic = $config->get('http-basic') ?: array();
  12442. foreach ($bitbucketOauth as $domain => $cred) {
  12443. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  12444. }
  12445. foreach ($githubOauth as $domain => $token) {
  12446. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  12447. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  12448. }
  12449. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  12450. }
  12451. foreach ($gitlabOauth as $domain => $token) {
  12452. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  12453. }
  12454. foreach ($gitlabToken as $domain => $token) {
  12455. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  12456. }
  12457. foreach ($httpBasic as $domain => $cred) {
  12458. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  12459. }
  12460. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  12461. }
  12462. public function emergency($message, array $context = array())
  12463. {
  12464. return $this->log(LogLevel::EMERGENCY, $message, $context);
  12465. }
  12466. public function alert($message, array $context = array())
  12467. {
  12468. return $this->log(LogLevel::ALERT, $message, $context);
  12469. }
  12470. public function critical($message, array $context = array())
  12471. {
  12472. return $this->log(LogLevel::CRITICAL, $message, $context);
  12473. }
  12474. public function error($message, array $context = array())
  12475. {
  12476. return $this->log(LogLevel::ERROR, $message, $context);
  12477. }
  12478. public function warning($message, array $context = array())
  12479. {
  12480. return $this->log(LogLevel::WARNING, $message, $context);
  12481. }
  12482. public function notice($message, array $context = array())
  12483. {
  12484. return $this->log(LogLevel::NOTICE, $message, $context);
  12485. }
  12486. public function info($message, array $context = array())
  12487. {
  12488. return $this->log(LogLevel::INFO, $message, $context);
  12489. }
  12490. public function debug($message, array $context = array())
  12491. {
  12492. return $this->log(LogLevel::DEBUG, $message, $context);
  12493. }
  12494. public function log($level, $message, array $context = array())
  12495. {
  12496. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  12497. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  12498. } elseif ($level === LogLevel::WARNING) {
  12499. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  12500. } elseif ($level === LogLevel::NOTICE) {
  12501. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  12502. } elseif ($level === LogLevel::INFO) {
  12503. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  12504. } else {
  12505. $this->writeError($message, true, self::DEBUG);
  12506. }
  12507. }
  12508. }
  12509. <?php
  12510. namespace Composer\IO;
  12511. use Symfony\Component\Console\Output\StreamOutput;
  12512. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  12513. use Symfony\Component\Console\Input\StringInput;
  12514. use Symfony\Component\Console\Helper\HelperSet;
  12515. class BufferIO extends ConsoleIO
  12516. {
  12517. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  12518. {
  12519. $input = new StringInput($input);
  12520. $input->setInteractive(false);
  12521. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  12522. parent::__construct($input, $output, new HelperSet(array()));
  12523. }
  12524. public function getOutput()
  12525. {
  12526. fseek($this->output->getStream(), 0);
  12527. $output = stream_get_contents($this->output->getStream());
  12528. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  12529. $pre = strip_tags($matches[1]);
  12530. if (strlen($pre) === strlen($matches[2])) {
  12531. return '';
  12532. }
  12533. return rtrim($matches[1])."\n";
  12534. }, $output);
  12535. return $output;
  12536. }
  12537. }
  12538. <?php
  12539. namespace Composer\IO;
  12540. use Composer\Question\StrictConfirmationQuestion;
  12541. use Symfony\Component\Console\Helper\HelperSet;
  12542. use Symfony\Component\Console\Input\InputInterface;
  12543. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  12544. use Symfony\Component\Console\Output\OutputInterface;
  12545. use Symfony\Component\Console\Question\ChoiceQuestion;
  12546. use Symfony\Component\Console\Question\Question;
  12547. class ConsoleIO extends BaseIO
  12548. {
  12549. protected $input;
  12550. protected $output;
  12551. protected $helperSet;
  12552. protected $lastMessage;
  12553. protected $lastMessageErr;
  12554. private $startTime;
  12555. private $verbosityMap;
  12556. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  12557. {
  12558. $this->input = $input;
  12559. $this->output = $output;
  12560. $this->helperSet = $helperSet;
  12561. $this->verbosityMap = array(
  12562. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  12563. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  12564. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  12565. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  12566. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  12567. );
  12568. }
  12569. public function enableDebugging($startTime)
  12570. {
  12571. $this->startTime = $startTime;
  12572. }
  12573. public function isInteractive()
  12574. {
  12575. return $this->input->isInteractive();
  12576. }
  12577. public function isDecorated()
  12578. {
  12579. return $this->output->isDecorated();
  12580. }
  12581. public function isVerbose()
  12582. {
  12583. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  12584. }
  12585. public function isVeryVerbose()
  12586. {
  12587. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  12588. }
  12589. public function isDebug()
  12590. {
  12591. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  12592. }
  12593. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  12594. {
  12595. $this->doWrite($messages, $newline, false, $verbosity);
  12596. }
  12597. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  12598. {
  12599. $this->doWrite($messages, $newline, true, $verbosity);
  12600. }
  12601. private function doWrite($messages, $newline, $stderr, $verbosity)
  12602. {
  12603. $sfVerbosity = $this->verbosityMap[$verbosity];
  12604. if ($sfVerbosity > $this->output->getVerbosity()) {
  12605. return;
  12606. }
  12607. if (OutputInterface::VERBOSITY_QUIET === 0) {
  12608. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  12609. }
  12610. if (null !== $this->startTime) {
  12611. $memoryUsage = memory_get_usage() / 1024 / 1024;
  12612. $timeSpent = microtime(true) - $this->startTime;
  12613. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  12614. return sprintf('[%.1fMB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  12615. }, (array) $messages);
  12616. }
  12617. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  12618. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  12619. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  12620. return;
  12621. }
  12622. $this->output->write($messages, $newline, $sfVerbosity);
  12623. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  12624. }
  12625. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  12626. {
  12627. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  12628. }
  12629. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  12630. {
  12631. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  12632. }
  12633. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  12634. {
  12635. $messages = implode($newline ? "\n" : '', (array) $messages);
  12636. if (!isset($size)) {
  12637. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  12638. }
  12639. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  12640. $this->doWrite($messages, false, $stderr, $verbosity);
  12641. $fill = $size - strlen(strip_tags($messages));
  12642. if ($fill > 0) {
  12643. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  12644. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  12645. }
  12646. if ($newline) {
  12647. $this->doWrite('', true, $stderr, $verbosity);
  12648. }
  12649. if ($stderr) {
  12650. $this->lastMessageErr = $messages;
  12651. } else {
  12652. $this->lastMessage = $messages;
  12653. }
  12654. }
  12655. public function ask($question, $default = null)
  12656. {
  12657. $helper = $this->helperSet->get('question');
  12658. $question = new Question($question, $default);
  12659. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12660. }
  12661. public function askConfirmation($question, $default = true)
  12662. {
  12663. $helper = $this->helperSet->get('question');
  12664. $question = new StrictConfirmationQuestion($question, $default);
  12665. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12666. }
  12667. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  12668. {
  12669. $helper = $this->helperSet->get('question');
  12670. $question = new Question($question, $default);
  12671. $question->setValidator($validator);
  12672. $question->setMaxAttempts($attempts);
  12673. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  12674. }
  12675. public function askAndHideAnswer($question)
  12676. {
  12677. $this->writeError($question, false);
  12678. return \Seld\CliPrompt\CliPrompt::hiddenPrompt(true);
  12679. }
  12680. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  12681. {
  12682. $helper = $this->helperSet->get('question');
  12683. $question = new ChoiceQuestion($question, $choices, $default);
  12684. $question->setMaxAttempts($attempts ?: null);
  12685. $question->setErrorMessage($errorMessage);
  12686. $question->setMultiselect($multiselect);
  12687. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  12688. $results = array();
  12689. foreach ($choices as $index => $choice) {
  12690. if (in_array($choice, $result, true)) {
  12691. $results[] = (string) $index;
  12692. }
  12693. }
  12694. return $results;
  12695. }
  12696. private function getErrorOutput()
  12697. {
  12698. if ($this->output instanceof ConsoleOutputInterface) {
  12699. return $this->output->getErrorOutput();
  12700. }
  12701. return $this->output;
  12702. }
  12703. }
  12704. <?php
  12705. namespace Composer\IO;
  12706. use Composer\Config;
  12707. interface IOInterface
  12708. {
  12709. const QUIET = 1;
  12710. const NORMAL = 2;
  12711. const VERBOSE = 4;
  12712. const VERY_VERBOSE = 8;
  12713. const DEBUG = 16;
  12714. public function isInteractive();
  12715. public function isVerbose();
  12716. public function isVeryVerbose();
  12717. public function isDebug();
  12718. public function isDecorated();
  12719. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  12720. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  12721. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  12722. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  12723. public function ask($question, $default = null);
  12724. public function askConfirmation($question, $default = true);
  12725. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  12726. public function askAndHideAnswer($question);
  12727. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  12728. public function getAuthentications();
  12729. public function hasAuthentication($repositoryName);
  12730. public function getAuthentication($repositoryName);
  12731. public function setAuthentication($repositoryName, $username, $password = null);
  12732. public function loadConfiguration(Config $config);
  12733. }
  12734. <?php
  12735. namespace Composer\IO;
  12736. class NullIO extends BaseIO
  12737. {
  12738. public function isInteractive()
  12739. {
  12740. return false;
  12741. }
  12742. public function isVerbose()
  12743. {
  12744. return false;
  12745. }
  12746. public function isVeryVerbose()
  12747. {
  12748. return false;
  12749. }
  12750. public function isDebug()
  12751. {
  12752. return false;
  12753. }
  12754. public function isDecorated()
  12755. {
  12756. return false;
  12757. }
  12758. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  12759. {
  12760. }
  12761. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  12762. {
  12763. }
  12764. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  12765. {
  12766. }
  12767. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  12768. {
  12769. }
  12770. public function ask($question, $default = null)
  12771. {
  12772. return $default;
  12773. }
  12774. public function askConfirmation($question, $default = true)
  12775. {
  12776. return $default;
  12777. }
  12778. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  12779. {
  12780. return $default;
  12781. }
  12782. public function askAndHideAnswer($question)
  12783. {
  12784. return null;
  12785. }
  12786. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  12787. {
  12788. return $default;
  12789. }
  12790. }
  12791. <?php
  12792. namespace Composer;
  12793. use Composer\Autoload\AutoloadGenerator;
  12794. use Composer\DependencyResolver\DefaultPolicy;
  12795. use Composer\DependencyResolver\Operation\UpdateOperation;
  12796. use Composer\DependencyResolver\Operation\InstallOperation;
  12797. use Composer\DependencyResolver\Operation\UninstallOperation;
  12798. use Composer\DependencyResolver\Operation\OperationInterface;
  12799. use Composer\DependencyResolver\PolicyInterface;
  12800. use Composer\DependencyResolver\Pool;
  12801. use Composer\DependencyResolver\Request;
  12802. use Composer\DependencyResolver\Rule;
  12803. use Composer\DependencyResolver\Solver;
  12804. use Composer\DependencyResolver\SolverProblemsException;
  12805. use Composer\Downloader\DownloadManager;
  12806. use Composer\EventDispatcher\EventDispatcher;
  12807. use Composer\Installer\InstallationManager;
  12808. use Composer\Installer\InstallerEvents;
  12809. use Composer\Installer\NoopInstaller;
  12810. use Composer\Installer\SuggestedPackagesReporter;
  12811. use Composer\IO\IOInterface;
  12812. use Composer\Package\AliasPackage;
  12813. use Composer\Package\CompletePackage;
  12814. use Composer\Package\Link;
  12815. use Composer\Package\Loader\ArrayLoader;
  12816. use Composer\Package\Dumper\ArrayDumper;
  12817. use Composer\Semver\Constraint\Constraint;
  12818. use Composer\Package\Locker;
  12819. use Composer\Package\PackageInterface;
  12820. use Composer\Package\RootPackageInterface;
  12821. use Composer\Repository\CompositeRepository;
  12822. use Composer\Repository\InstalledArrayRepository;
  12823. use Composer\Repository\PlatformRepository;
  12824. use Composer\Repository\RepositoryInterface;
  12825. use Composer\Repository\RepositoryManager;
  12826. use Composer\Repository\WritableRepositoryInterface;
  12827. use Composer\Script\ScriptEvents;
  12828. class Installer
  12829. {
  12830. protected $io;
  12831. protected $config;
  12832. protected $package;
  12833. protected $downloadManager;
  12834. protected $repositoryManager;
  12835. protected $locker;
  12836. protected $installationManager;
  12837. protected $eventDispatcher;
  12838. protected $autoloadGenerator;
  12839. protected $preferSource = false;
  12840. protected $preferDist = false;
  12841. protected $optimizeAutoloader = false;
  12842. protected $classMapAuthoritative = false;
  12843. protected $apcuAutoloader = false;
  12844. protected $devMode = false;
  12845. protected $dryRun = false;
  12846. protected $verbose = false;
  12847. protected $update = false;
  12848. protected $dumpAutoloader = true;
  12849. protected $runScripts = true;
  12850. protected $ignorePlatformReqs = false;
  12851. protected $preferStable = false;
  12852. protected $preferLowest = false;
  12853. protected $skipSuggest = false;
  12854. protected $writeLock = true;
  12855. protected $executeOperations = true;
  12856. protected $updateWhitelist = null;
  12857. protected $whitelistDependencies = false;
  12858. protected $whitelistAllDependencies = false;
  12859. protected $suggestedPackagesReporter;
  12860. protected $additionalInstalledRepository;
  12861. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  12862. {
  12863. $this->io = $io;
  12864. $this->config = $config;
  12865. $this->package = $package;
  12866. $this->downloadManager = $downloadManager;
  12867. $this->repositoryManager = $repositoryManager;
  12868. $this->locker = $locker;
  12869. $this->installationManager = $installationManager;
  12870. $this->eventDispatcher = $eventDispatcher;
  12871. $this->autoloadGenerator = $autoloadGenerator;
  12872. }
  12873. public function run()
  12874. {
  12875. gc_collect_cycles();
  12876. gc_disable();
  12877. if (!$this->update && !$this->locker->isLocked()) {
  12878. $this->update = true;
  12879. }
  12880. if ($this->dryRun) {
  12881. $this->verbose = true;
  12882. $this->runScripts = false;
  12883. $this->executeOperations = false;
  12884. $this->writeLock = false;
  12885. $this->dumpAutoloader = false;
  12886. $this->installationManager->addInstaller(new NoopInstaller);
  12887. $this->mockLocalRepositories($this->repositoryManager);
  12888. }
  12889. if ($this->runScripts) {
  12890. $devMode = (int) $this->devMode;
  12891. putenv("COMPOSER_DEV_MODE=$devMode");
  12892. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  12893. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  12894. }
  12895. $this->downloadManager->setPreferSource($this->preferSource);
  12896. $this->downloadManager->setPreferDist($this->preferDist);
  12897. $localRepo = $this->repositoryManager->getLocalRepository();
  12898. if ($this->update) {
  12899. $platformOverrides = $this->config->get('platform') ?: array();
  12900. } else {
  12901. $platformOverrides = $this->locker->getPlatformOverrides();
  12902. }
  12903. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  12904. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  12905. $aliases = $this->getRootAliases();
  12906. $this->aliasPlatformPackages($platformRepo, $aliases);
  12907. if (!$this->suggestedPackagesReporter) {
  12908. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  12909. }
  12910. try {
  12911. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  12912. if ($res !== 0) {
  12913. return $res;
  12914. }
  12915. } catch (\Exception $e) {
  12916. if ($this->executeOperations) {
  12917. $this->installationManager->notifyInstalls($this->io);
  12918. }
  12919. throw $e;
  12920. }
  12921. if ($this->executeOperations) {
  12922. $this->installationManager->notifyInstalls($this->io);
  12923. }
  12924. if ($this->devMode && !$this->skipSuggest) {
  12925. $this->suggestedPackagesReporter->output($installedRepo);
  12926. }
  12927. foreach ($localRepo->getPackages() as $package) {
  12928. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  12929. continue;
  12930. }
  12931. $replacement = (is_string($package->getReplacementPackage()))
  12932. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  12933. : 'No replacement was suggested';
  12934. $this->io->writeError(
  12935. sprintf(
  12936. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  12937. $package->getPrettyName(),
  12938. $replacement
  12939. )
  12940. );
  12941. }
  12942. if ($this->update && $this->writeLock) {
  12943. $localRepo->reload();
  12944. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  12945. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  12946. $updatedLock = $this->locker->setLockData(
  12947. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  12948. $devPackages,
  12949. $platformReqs,
  12950. $platformDevReqs,
  12951. $aliases,
  12952. $this->package->getMinimumStability(),
  12953. $this->package->getStabilityFlags(),
  12954. $this->preferStable || $this->package->getPreferStable(),
  12955. $this->preferLowest,
  12956. $this->config->get('platform') ?: array()
  12957. );
  12958. if ($updatedLock) {
  12959. $this->io->writeError('<info>Writing lock file</info>');
  12960. }
  12961. }
  12962. if ($this->dumpAutoloader) {
  12963. if ($this->optimizeAutoloader) {
  12964. $this->io->writeError('<info>Generating optimized autoload files</info>');
  12965. } else {
  12966. $this->io->writeError('<info>Generating autoload files</info>');
  12967. }
  12968. $this->autoloadGenerator->setDevMode($this->devMode);
  12969. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  12970. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  12971. $this->autoloadGenerator->setRunScripts($this->runScripts);
  12972. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  12973. }
  12974. if ($this->executeOperations) {
  12975. foreach ($localRepo->getPackages() as $package) {
  12976. $this->installationManager->ensureBinariesPresence($package);
  12977. }
  12978. $vendorDir = $this->config->get('vendor-dir');
  12979. if (is_dir($vendorDir)) {
  12980. @touch($vendorDir);
  12981. }
  12982. }
  12983. if ($this->runScripts) {
  12984. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  12985. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  12986. }
  12987. if (!defined('HHVM_VERSION')) {
  12988. gc_enable();
  12989. }
  12990. return 0;
  12991. }
  12992. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  12993. {
  12994. $lockedRepository = null;
  12995. $repositories = null;
  12996. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  12997. try {
  12998. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  12999. } catch (\RuntimeException $e) {
  13000. if ($this->package->getDevRequires()) {
  13001. throw $e;
  13002. }
  13003. $lockedRepository = $this->locker->getLockedRepository();
  13004. }
  13005. }
  13006. $this->whitelistUpdateDependencies(
  13007. $lockedRepository ?: $localRepo,
  13008. $this->package->getRequires(),
  13009. $this->package->getDevRequires()
  13010. );
  13011. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  13012. $policy = $this->createPolicy();
  13013. $pool = $this->createPool($this->update ? null : $lockedRepository);
  13014. $pool->addRepository($installedRepo, $aliases);
  13015. if ($this->update) {
  13016. $repositories = $this->repositoryManager->getRepositories();
  13017. foreach ($repositories as $repository) {
  13018. $pool->addRepository($repository, $aliases);
  13019. }
  13020. }
  13021. if ($lockedRepository) {
  13022. $pool->addRepository($lockedRepository, $aliases);
  13023. }
  13024. $request = $this->createRequest($this->package, $platformRepo);
  13025. if ($this->update) {
  13026. $removedUnstablePackages = array();
  13027. foreach ($localRepo->getPackages() as $package) {
  13028. if (
  13029. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  13030. && $this->installationManager->isPackageInstalled($localRepo, $package)
  13031. ) {
  13032. $removedUnstablePackages[$package->getName()] = true;
  13033. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  13034. }
  13035. }
  13036. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  13037. $request->updateAll();
  13038. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13039. foreach ($links as $link) {
  13040. $request->install($link->getTarget(), $link->getConstraint());
  13041. }
  13042. if ($this->updateWhitelist) {
  13043. $currentPackages = $this->getCurrentPackages($installedRepo);
  13044. $candidates = array();
  13045. foreach ($links as $link) {
  13046. $candidates[$link->getTarget()] = true;
  13047. $rootRequires[$link->getTarget()] = $link;
  13048. }
  13049. foreach ($currentPackages as $package) {
  13050. $candidates[$package->getName()] = true;
  13051. }
  13052. foreach ($candidates as $candidate => $dummy) {
  13053. foreach ($currentPackages as $curPackage) {
  13054. if ($curPackage->getName() === $candidate) {
  13055. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  13056. $constraint = new Constraint('=', $curPackage->getVersion());
  13057. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  13058. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  13059. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  13060. $request->install($curPackage->getName(), $constraint);
  13061. }
  13062. break;
  13063. }
  13064. }
  13065. }
  13066. }
  13067. } else {
  13068. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  13069. if (!$this->locker->isFresh()) {
  13070. $this->io->writeError('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.</warning>', true, IOInterface::QUIET);
  13071. }
  13072. foreach ($lockedRepository->getPackages() as $package) {
  13073. $version = $package->getVersion();
  13074. if (isset($aliases[$package->getName()][$version])) {
  13075. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  13076. }
  13077. $constraint = new Constraint('=', $version);
  13078. $constraint->setPrettyString($package->getPrettyVersion());
  13079. $request->install($package->getName(), $constraint);
  13080. }
  13081. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  13082. $request->install($link->getTarget(), $link->getConstraint());
  13083. }
  13084. }
  13085. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  13086. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  13087. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13088. try {
  13089. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  13090. } catch (SolverProblemsException $e) {
  13091. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  13092. $this->io->writeError($e->getMessage());
  13093. if ($this->update && !$this->devMode) {
  13094. $this->io->writeError('<warning>Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.</warning>', true, IOInterface::QUIET);
  13095. }
  13096. return array(max(1, $e->getCode()), array());
  13097. }
  13098. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  13099. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  13100. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  13101. $this->io->writeError("Analyzed ".$solver->getRuleSetSize()." rules to resolve dependencies", true, IOInterface::VERBOSE);
  13102. if (!$operations) {
  13103. $this->io->writeError('Nothing to install or update');
  13104. }
  13105. $operations = $this->movePluginsToFront($operations);
  13106. $operations = $this->moveUninstallsToFront($operations);
  13107. if ($this->update) {
  13108. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  13109. if (!$this->devMode) {
  13110. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  13111. }
  13112. } else {
  13113. $devPackages = null;
  13114. }
  13115. if ($operations) {
  13116. $installs = $updates = $uninstalls = array();
  13117. foreach ($operations as $operation) {
  13118. if ($operation instanceof InstallOperation) {
  13119. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  13120. } elseif ($operation instanceof UpdateOperation) {
  13121. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  13122. } elseif ($operation instanceof UninstallOperation) {
  13123. $uninstalls[] = $operation->getPackage()->getPrettyName();
  13124. }
  13125. }
  13126. $this->io->writeError(
  13127. sprintf("<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  13128. count($installs),
  13129. 1 === count($installs) ? '' : 's',
  13130. count($updates),
  13131. 1 === count($updates) ? '' : 's',
  13132. count($uninstalls),
  13133. 1 === count($uninstalls) ? '' : 's')
  13134. );
  13135. if ($installs) {
  13136. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  13137. }
  13138. if ($updates) {
  13139. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  13140. }
  13141. if ($uninstalls) {
  13142. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  13143. }
  13144. }
  13145. foreach ($operations as $operation) {
  13146. if ('install' === $operation->getJobType()) {
  13147. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  13148. }
  13149. if ($this->update) {
  13150. $package = null;
  13151. if ('update' === $operation->getJobType()) {
  13152. $package = $operation->getTargetPackage();
  13153. } elseif ('install' === $operation->getJobType()) {
  13154. $package = $operation->getPackage();
  13155. }
  13156. if ($package && $package->isDev()) {
  13157. $references = $this->package->getReferences();
  13158. if (isset($references[$package->getName()])) {
  13159. $this->updateInstallReferences($package, $references[$package->getName()]);
  13160. }
  13161. }
  13162. if ('update' === $operation->getJobType()
  13163. && $operation->getTargetPackage()->isDev()
  13164. && $operation->getTargetPackage()->getVersion() === $operation->getInitialPackage()->getVersion()
  13165. && (!$operation->getTargetPackage()->getSourceReference() || $operation->getTargetPackage()->getSourceReference() === $operation->getInitialPackage()->getSourceReference())
  13166. && (!$operation->getTargetPackage()->getDistReference() || $operation->getTargetPackage()->getDistReference() === $operation->getInitialPackage()->getDistReference())
  13167. ) {
  13168. $this->io->writeError(' - Skipping update of '. $operation->getTargetPackage()->getPrettyName().' to the same reference-locked version', true, IOInterface::DEBUG);
  13169. $this->io->writeError('', true, IOInterface::DEBUG);
  13170. continue;
  13171. }
  13172. }
  13173. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($operation->getJobType());
  13174. if (defined($event) && $this->runScripts) {
  13175. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13176. }
  13177. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  13178. $this->io->writeError(' - ' . $operation);
  13179. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  13180. $this->io->writeError(' - ' . $operation);
  13181. }
  13182. $this->installationManager->execute($localRepo, $operation);
  13183. if ($this->verbose && $this->io->isVeryVerbose() && in_array($operation->getJobType(), array('install', 'update'))) {
  13184. $reason = $operation->getReason();
  13185. if ($reason instanceof Rule) {
  13186. switch ($reason->getReason()) {
  13187. case Rule::RULE_JOB_INSTALL:
  13188. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  13189. $this->io->writeError('');
  13190. break;
  13191. case Rule::RULE_PACKAGE_REQUIRES:
  13192. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  13193. $this->io->writeError('');
  13194. break;
  13195. }
  13196. }
  13197. }
  13198. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($operation->getJobType());
  13199. if (defined($event) && $this->runScripts) {
  13200. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13201. }
  13202. if ($this->executeOperations || $this->writeLock) {
  13203. $localRepo->write();
  13204. }
  13205. }
  13206. if ($this->executeOperations) {
  13207. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  13208. $localRepo->write();
  13209. }
  13210. return array(0, $devPackages);
  13211. }
  13212. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  13213. {
  13214. if (!$this->package->getDevRequires()) {
  13215. return array();
  13216. }
  13217. $tempLocalRepo = clone $localRepo;
  13218. foreach ($operations as $operation) {
  13219. switch ($operation->getJobType()) {
  13220. case 'install':
  13221. case 'markAliasInstalled':
  13222. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  13223. $tempLocalRepo->addPackage(clone $operation->getPackage());
  13224. }
  13225. break;
  13226. case 'uninstall':
  13227. case 'markAliasUninstalled':
  13228. $tempLocalRepo->removePackage($operation->getPackage());
  13229. break;
  13230. case 'update':
  13231. $tempLocalRepo->removePackage($operation->getInitialPackage());
  13232. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  13233. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  13234. }
  13235. break;
  13236. default:
  13237. throw new \LogicException('Unknown type: '.$operation->getJobType());
  13238. }
  13239. }
  13240. $localRepo = new InstalledArrayRepository(array());
  13241. $loader = new ArrayLoader(null, true);
  13242. $dumper = new ArrayDumper();
  13243. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  13244. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  13245. }
  13246. unset($tempLocalRepo, $loader, $dumper);
  13247. $policy = $this->createPolicy();
  13248. $pool = $this->createPool();
  13249. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13250. $pool->addRepository($installedRepo, $aliases);
  13251. $request = $this->createRequest($this->package, $platformRepo);
  13252. $request->updateAll();
  13253. foreach ($this->package->getRequires() as $link) {
  13254. $request->install($link->getTarget(), $link->getConstraint());
  13255. }
  13256. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  13257. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13258. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  13259. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  13260. $devPackages = array();
  13261. foreach ($ops as $op) {
  13262. if ($op->getJobType() === 'uninstall') {
  13263. $devPackages[] = $op->getPackage();
  13264. }
  13265. }
  13266. return $devPackages;
  13267. }
  13268. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  13269. {
  13270. $finalOps = array();
  13271. $packagesToSkip = array();
  13272. foreach ($devPackages as $pkg) {
  13273. $packagesToSkip[$pkg->getName()] = true;
  13274. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  13275. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  13276. }
  13277. }
  13278. foreach ($operations as $op) {
  13279. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  13280. if (isset($packagesToSkip[$package->getName()])) {
  13281. continue;
  13282. }
  13283. $finalOps[] = $op;
  13284. }
  13285. return $finalOps;
  13286. }
  13287. private function movePluginsToFront(array $operations)
  13288. {
  13289. $pluginsNoDeps = array();
  13290. $pluginsWithDeps = array();
  13291. $pluginRequires = array();
  13292. foreach (array_reverse($operations, true) as $idx => $op) {
  13293. if ($op instanceof InstallOperation) {
  13294. $package = $op->getPackage();
  13295. } elseif ($op instanceof UpdateOperation) {
  13296. $package = $op->getTargetPackage();
  13297. } else {
  13298. continue;
  13299. }
  13300. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  13301. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  13302. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  13303. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  13304. });
  13305. if ($isPlugin && !count($requires)) {
  13306. array_unshift($pluginsNoDeps, $op);
  13307. } else {
  13308. $pluginRequires = array_merge($pluginRequires, $requires);
  13309. array_unshift($pluginsWithDeps, $op);
  13310. }
  13311. unset($operations[$idx]);
  13312. }
  13313. }
  13314. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  13315. }
  13316. private function moveUninstallsToFront(array $operations)
  13317. {
  13318. $uninstOps = array();
  13319. foreach ($operations as $idx => $op) {
  13320. if ($op instanceof UninstallOperation) {
  13321. $uninstOps[] = $op;
  13322. unset($operations[$idx]);
  13323. }
  13324. }
  13325. return array_merge($uninstOps, $operations);
  13326. }
  13327. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  13328. {
  13329. $installedRootPackage = clone $this->package;
  13330. $installedRootPackage->setRequires(array());
  13331. $installedRootPackage->setDevRequires(array());
  13332. $repos = array(
  13333. $localRepo,
  13334. new InstalledArrayRepository(array($installedRootPackage)),
  13335. $platformRepo,
  13336. );
  13337. $installedRepo = new CompositeRepository($repos);
  13338. if ($this->additionalInstalledRepository) {
  13339. $installedRepo->addRepository($this->additionalInstalledRepository);
  13340. }
  13341. return $installedRepo;
  13342. }
  13343. private function createPool(RepositoryInterface $lockedRepository = null)
  13344. {
  13345. if ($this->update) {
  13346. $minimumStability = $this->package->getMinimumStability();
  13347. $stabilityFlags = $this->package->getStabilityFlags();
  13348. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13349. } else {
  13350. $minimumStability = $this->locker->getMinimumStability();
  13351. $stabilityFlags = $this->locker->getStabilityFlags();
  13352. $requires = array();
  13353. foreach ($lockedRepository->getPackages() as $package) {
  13354. $constraint = new Constraint('=', $package->getVersion());
  13355. $constraint->setPrettyString($package->getPrettyVersion());
  13356. $requires[$package->getName()] = $constraint;
  13357. }
  13358. }
  13359. $rootConstraints = array();
  13360. foreach ($requires as $req => $constraint) {
  13361. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  13362. continue;
  13363. }
  13364. if ($constraint instanceof Link) {
  13365. $rootConstraints[$req] = $constraint->getConstraint();
  13366. } else {
  13367. $rootConstraints[$req] = $constraint;
  13368. }
  13369. }
  13370. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  13371. }
  13372. private function createPolicy()
  13373. {
  13374. $preferStable = null;
  13375. $preferLowest = null;
  13376. if (!$this->update) {
  13377. $preferStable = $this->locker->getPreferStable();
  13378. $preferLowest = $this->locker->getPreferLowest();
  13379. }
  13380. if (null === $preferStable) {
  13381. $preferStable = $this->preferStable || $this->package->getPreferStable();
  13382. }
  13383. if (null === $preferLowest) {
  13384. $preferLowest = $this->preferLowest;
  13385. }
  13386. return new DefaultPolicy($preferStable, $preferLowest);
  13387. }
  13388. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  13389. {
  13390. $request = new Request();
  13391. $constraint = new Constraint('=', $rootPackage->getVersion());
  13392. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  13393. $request->install($rootPackage->getName(), $constraint);
  13394. $fixedPackages = $platformRepo->getPackages();
  13395. if ($this->additionalInstalledRepository) {
  13396. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  13397. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  13398. }
  13399. $provided = $rootPackage->getProvides();
  13400. foreach ($fixedPackages as $package) {
  13401. $constraint = new Constraint('=', $package->getVersion());
  13402. $constraint->setPrettyString($package->getPrettyVersion());
  13403. if ($package->getRepository() !== $platformRepo
  13404. || !isset($provided[$package->getName()])
  13405. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  13406. ) {
  13407. $request->fix($package->getName(), $constraint);
  13408. }
  13409. }
  13410. return $request;
  13411. }
  13412. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  13413. {
  13414. if ($task === 'force-updates' && null === $operations) {
  13415. throw new \InvalidArgumentException('Missing operations argument');
  13416. }
  13417. if ($task === 'force-links') {
  13418. $operations = array();
  13419. }
  13420. if ($this->update && $this->updateWhitelist) {
  13421. $currentPackages = $this->getCurrentPackages($installedRepo);
  13422. }
  13423. foreach ($localRepo->getCanonicalPackages() as $package) {
  13424. if (!$package->isDev()) {
  13425. continue;
  13426. }
  13427. foreach ($operations as $operation) {
  13428. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  13429. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  13430. ) {
  13431. continue 2;
  13432. }
  13433. }
  13434. if ($this->update) {
  13435. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13436. foreach ($currentPackages as $curPackage) {
  13437. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  13438. if ($task === 'force-links') {
  13439. $package->setRequires($curPackage->getRequires());
  13440. $package->setConflicts($curPackage->getConflicts());
  13441. $package->setProvides($curPackage->getProvides());
  13442. $package->setReplaces($curPackage->getReplaces());
  13443. } elseif ($task === 'force-updates') {
  13444. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  13445. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  13446. ) {
  13447. $operations[] = new UpdateOperation($package, $curPackage);
  13448. }
  13449. }
  13450. break;
  13451. }
  13452. }
  13453. continue;
  13454. }
  13455. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13456. foreach ($matches as $index => $match) {
  13457. if (!in_array($match->getRepository(), $repositories, true)) {
  13458. unset($matches[$index]);
  13459. continue;
  13460. }
  13461. if ($match->getName() !== $package->getName()) {
  13462. unset($matches[$index]);
  13463. continue;
  13464. }
  13465. $matches[$index] = $match->getId();
  13466. }
  13467. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13468. $newPackage = $pool->literalToPackage($matches[0]);
  13469. if ($task === 'force-links' && $newPackage) {
  13470. $package->setRequires($newPackage->getRequires());
  13471. $package->setConflicts($newPackage->getConflicts());
  13472. $package->setProvides($newPackage->getProvides());
  13473. $package->setReplaces($newPackage->getReplaces());
  13474. }
  13475. if ($task === 'force-updates' && $newPackage && (
  13476. (($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  13477. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  13478. )
  13479. )) {
  13480. $operations[] = new UpdateOperation($package, $newPackage);
  13481. continue;
  13482. }
  13483. }
  13484. if ($task === 'force-updates') {
  13485. $references = $this->package->getReferences();
  13486. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  13487. $operations[] = new UpdateOperation($package, clone $package);
  13488. }
  13489. }
  13490. } else {
  13491. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  13492. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  13493. if ($task === 'force-links') {
  13494. $package->setRequires($lockedPackage->getRequires());
  13495. $package->setConflicts($lockedPackage->getConflicts());
  13496. $package->setProvides($lockedPackage->getProvides());
  13497. $package->setReplaces($lockedPackage->getReplaces());
  13498. } elseif ($task === 'force-updates') {
  13499. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  13500. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  13501. ) {
  13502. $operations[] = new UpdateOperation($package, $lockedPackage);
  13503. }
  13504. }
  13505. break;
  13506. }
  13507. }
  13508. }
  13509. }
  13510. return $operations;
  13511. }
  13512. private function getCurrentPackages($installedRepo)
  13513. {
  13514. if ($this->locker->isLocked()) {
  13515. try {
  13516. return $this->locker->getLockedRepository(true)->getPackages();
  13517. } catch (\RuntimeException $e) {
  13518. return $this->locker->getLockedRepository()->getPackages();
  13519. }
  13520. }
  13521. return $installedRepo->getPackages();
  13522. }
  13523. private function getRootAliases()
  13524. {
  13525. if ($this->update) {
  13526. $aliases = $this->package->getAliases();
  13527. } else {
  13528. $aliases = $this->locker->getAliases();
  13529. }
  13530. $normalizedAliases = array();
  13531. foreach ($aliases as $alias) {
  13532. $normalizedAliases[$alias['package']][$alias['version']] = array(
  13533. 'alias' => $alias['alias'],
  13534. 'alias_normalized' => $alias['alias_normalized'],
  13535. );
  13536. }
  13537. return $normalizedAliases;
  13538. }
  13539. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  13540. {
  13541. if (!$this->update) {
  13542. return;
  13543. }
  13544. $rootRefs = $this->package->getReferences();
  13545. foreach ($localRepo->getCanonicalPackages() as $package) {
  13546. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  13547. foreach ($matches as $index => $match) {
  13548. if (!in_array($match->getRepository(), $repositories, true)) {
  13549. unset($matches[$index]);
  13550. continue;
  13551. }
  13552. if ($match->getName() !== $package->getName()) {
  13553. unset($matches[$index]);
  13554. continue;
  13555. }
  13556. $matches[$index] = $match->getId();
  13557. }
  13558. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  13559. $newPackage = $pool->literalToPackage($matches[0]);
  13560. $sourceUrl = $package->getSourceUrl();
  13561. $newSourceUrl = $newPackage->getSourceUrl();
  13562. $newReference = $newPackage->getSourceReference();
  13563. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  13564. $newReference = $rootRefs[$package->getName()];
  13565. }
  13566. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl());
  13567. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  13568. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  13569. }
  13570. $package->setDistMirrors($newPackage->getDistMirrors());
  13571. $package->setSourceMirrors($newPackage->getSourceMirrors());
  13572. }
  13573. }
  13574. }
  13575. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl)
  13576. {
  13577. $oldSourceRef = $package->getSourceReference();
  13578. if ($package->getSourceUrl() !== $sourceUrl) {
  13579. $package->setSourceType($sourceType);
  13580. $package->setSourceUrl($sourceUrl);
  13581. $package->setSourceReference($sourceReference);
  13582. }
  13583. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $distUrl)) {
  13584. $package->setDistUrl($distUrl);
  13585. $this->updateInstallReferences($package, $sourceReference);
  13586. }
  13587. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  13588. $this->updateInstallReferences($package, $oldSourceRef);
  13589. }
  13590. }
  13591. private function updateInstallReferences(PackageInterface $package, $reference)
  13592. {
  13593. if (!$reference) {
  13594. return;
  13595. }
  13596. $package->setSourceReference($reference);
  13597. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $package->getDistUrl())) {
  13598. $package->setDistReference($reference);
  13599. $package->setDistUrl(preg_replace('{(?<=/)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  13600. } elseif ($package->getDistReference()) {
  13601. $package->setDistReference($reference);
  13602. }
  13603. }
  13604. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  13605. {
  13606. foreach ($aliases as $package => $versions) {
  13607. foreach ($versions as $version => $alias) {
  13608. $packages = $platformRepo->findPackages($package, $version);
  13609. foreach ($packages as $package) {
  13610. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  13611. $aliasPackage->setRootPackageAlias(true);
  13612. $platformRepo->addPackage($aliasPackage);
  13613. }
  13614. }
  13615. }
  13616. }
  13617. private function isUpdateable(PackageInterface $package)
  13618. {
  13619. if (!$this->updateWhitelist) {
  13620. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  13621. }
  13622. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  13623. $patternRegexp = $this->packageNameToRegexp($whiteListedPattern);
  13624. if (preg_match($patternRegexp, $package->getName())) {
  13625. return true;
  13626. }
  13627. }
  13628. return false;
  13629. }
  13630. private function packageNameToRegexp($whiteListedPattern)
  13631. {
  13632. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  13633. return "{^" . $cleanedWhiteListedPattern . "$}i";
  13634. }
  13635. private function extractPlatformRequirements($links)
  13636. {
  13637. $platformReqs = array();
  13638. foreach ($links as $link) {
  13639. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  13640. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  13641. }
  13642. }
  13643. return $platformReqs;
  13644. }
  13645. private function whitelistUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  13646. {
  13647. if (!$this->updateWhitelist) {
  13648. return;
  13649. }
  13650. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  13651. $requiredPackageNames = array();
  13652. foreach ($rootRequires as $require) {
  13653. $requiredPackageNames[] = $require->getTarget();
  13654. }
  13655. $skipPackages = array();
  13656. if (!$this->whitelistAllDependencies) {
  13657. foreach ($rootRequires as $require) {
  13658. $skipPackages[$require->getTarget()] = true;
  13659. }
  13660. }
  13661. $pool = new Pool('dev');
  13662. $pool->addRepository($localOrLockRepo);
  13663. $seen = array();
  13664. $rootRequiredPackageNames = array_keys($rootRequires);
  13665. foreach ($this->updateWhitelist as $packageName => $void) {
  13666. $packageQueue = new \SplQueue;
  13667. $depPackages = $pool->whatProvides($packageName);
  13668. $nameMatchesRequiredPackage = in_array($packageName, $requiredPackageNames, true);
  13669. if (!$nameMatchesRequiredPackage) {
  13670. $whitelistPatternRegexp = $this->packageNameToRegexp($packageName);
  13671. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  13672. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  13673. $nameMatchesRequiredPackage = true;
  13674. break;
  13675. }
  13676. }
  13677. }
  13678. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  13679. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  13680. }
  13681. foreach ($depPackages as $depPackage) {
  13682. $packageQueue->enqueue($depPackage);
  13683. }
  13684. while (!$packageQueue->isEmpty()) {
  13685. $package = $packageQueue->dequeue();
  13686. if (isset($seen[$package->getId()])) {
  13687. continue;
  13688. }
  13689. $seen[$package->getId()] = true;
  13690. $this->updateWhitelist[$package->getName()] = true;
  13691. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  13692. continue;
  13693. }
  13694. $requires = $package->getRequires();
  13695. foreach ($requires as $require) {
  13696. $requirePackages = $pool->whatProvides($require->getTarget());
  13697. foreach ($requirePackages as $requirePackage) {
  13698. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  13699. continue;
  13700. }
  13701. if (isset($skipPackages[$requirePackage->getName()])) {
  13702. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  13703. continue;
  13704. }
  13705. $packageQueue->enqueue($requirePackage);
  13706. }
  13707. }
  13708. }
  13709. }
  13710. }
  13711. private function mockLocalRepositories(RepositoryManager $rm)
  13712. {
  13713. $packages = array();
  13714. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  13715. $packages[(string) $package] = clone $package;
  13716. }
  13717. foreach ($packages as $key => $package) {
  13718. if ($package instanceof AliasPackage) {
  13719. $alias = (string) $package->getAliasOf();
  13720. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  13721. }
  13722. }
  13723. $rm->setLocalRepository(
  13724. new InstalledArrayRepository($packages)
  13725. );
  13726. }
  13727. public static function create(IOInterface $io, Composer $composer)
  13728. {
  13729. return new static(
  13730. $io,
  13731. $composer->getConfig(),
  13732. $composer->getPackage(),
  13733. $composer->getDownloadManager(),
  13734. $composer->getRepositoryManager(),
  13735. $composer->getLocker(),
  13736. $composer->getInstallationManager(),
  13737. $composer->getEventDispatcher(),
  13738. $composer->getAutoloadGenerator()
  13739. );
  13740. }
  13741. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  13742. {
  13743. $this->additionalInstalledRepository = $additionalInstalledRepository;
  13744. return $this;
  13745. }
  13746. public function setDryRun($dryRun = true)
  13747. {
  13748. $this->dryRun = (bool) $dryRun;
  13749. return $this;
  13750. }
  13751. public function isDryRun()
  13752. {
  13753. return $this->dryRun;
  13754. }
  13755. public function setPreferSource($preferSource = true)
  13756. {
  13757. $this->preferSource = (bool) $preferSource;
  13758. return $this;
  13759. }
  13760. public function setPreferDist($preferDist = true)
  13761. {
  13762. $this->preferDist = (bool) $preferDist;
  13763. return $this;
  13764. }
  13765. public function setOptimizeAutoloader($optimizeAutoloader = false)
  13766. {
  13767. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  13768. if (!$this->optimizeAutoloader) {
  13769. $this->setClassMapAuthoritative(false);
  13770. }
  13771. return $this;
  13772. }
  13773. public function setClassMapAuthoritative($classMapAuthoritative = false)
  13774. {
  13775. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  13776. if ($this->classMapAuthoritative) {
  13777. $this->setOptimizeAutoloader(true);
  13778. }
  13779. return $this;
  13780. }
  13781. public function setApcuAutoloader($apcuAutoloader = false)
  13782. {
  13783. $this->apcuAutoloader = (bool) $apcuAutoloader;
  13784. return $this;
  13785. }
  13786. public function setUpdate($update = true)
  13787. {
  13788. $this->update = (bool) $update;
  13789. return $this;
  13790. }
  13791. public function setDevMode($devMode = true)
  13792. {
  13793. $this->devMode = (bool) $devMode;
  13794. return $this;
  13795. }
  13796. public function setDumpAutoloader($dumpAutoloader = true)
  13797. {
  13798. $this->dumpAutoloader = (bool) $dumpAutoloader;
  13799. return $this;
  13800. }
  13801. public function setRunScripts($runScripts = true)
  13802. {
  13803. $this->runScripts = (bool) $runScripts;
  13804. return $this;
  13805. }
  13806. public function setConfig(Config $config)
  13807. {
  13808. $this->config = $config;
  13809. return $this;
  13810. }
  13811. public function setVerbose($verbose = true)
  13812. {
  13813. $this->verbose = (bool) $verbose;
  13814. return $this;
  13815. }
  13816. public function isVerbose()
  13817. {
  13818. return $this->verbose;
  13819. }
  13820. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  13821. {
  13822. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  13823. return $this;
  13824. }
  13825. public function setUpdateWhitelist(array $packages)
  13826. {
  13827. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  13828. return $this;
  13829. }
  13830. public function setWhitelistDependencies($updateDependencies = true)
  13831. {
  13832. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  13833. }
  13834. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  13835. {
  13836. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  13837. return $this;
  13838. }
  13839. public function setWhitelistAllDependencies($updateAllDependencies = true)
  13840. {
  13841. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  13842. return $this;
  13843. }
  13844. public function setPreferStable($preferStable = true)
  13845. {
  13846. $this->preferStable = (bool) $preferStable;
  13847. return $this;
  13848. }
  13849. public function setPreferLowest($preferLowest = true)
  13850. {
  13851. $this->preferLowest = (bool) $preferLowest;
  13852. return $this;
  13853. }
  13854. public function setWriteLock($writeLock = true)
  13855. {
  13856. $this->writeLock = (bool) $writeLock;
  13857. return $this;
  13858. }
  13859. public function setExecuteOperations($executeOperations = true)
  13860. {
  13861. $this->executeOperations = (bool) $executeOperations;
  13862. return $this;
  13863. }
  13864. public function setSkipSuggest($skipSuggest = true)
  13865. {
  13866. $this->skipSuggest = (bool) $skipSuggest;
  13867. return $this;
  13868. }
  13869. public function disablePlugins()
  13870. {
  13871. $this->installationManager->disablePlugins();
  13872. return $this;
  13873. }
  13874. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  13875. {
  13876. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  13877. return $this;
  13878. }
  13879. }
  13880. <?php
  13881. namespace Composer\Installer;
  13882. use Composer\IO\IOInterface;
  13883. use Composer\Package\PackageInterface;
  13884. use Composer\Util\Filesystem;
  13885. use Composer\Util\Platform;
  13886. use Composer\Util\ProcessExecutor;
  13887. use Composer\Util\Silencer;
  13888. class BinaryInstaller
  13889. {
  13890. protected $binDir;
  13891. protected $binCompat;
  13892. protected $io;
  13893. protected $filesystem;
  13894. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  13895. {
  13896. $this->binDir = $binDir;
  13897. $this->binCompat = $binCompat;
  13898. $this->io = $io;
  13899. $this->filesystem = $filesystem ?: new Filesystem();
  13900. }
  13901. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  13902. {
  13903. $binaries = $this->getBinaries($package);
  13904. if (!$binaries) {
  13905. return;
  13906. }
  13907. foreach ($binaries as $bin) {
  13908. $binPath = $installPath.'/'.$bin;
  13909. if (!file_exists($binPath)) {
  13910. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  13911. continue;
  13912. }
  13913. $binPath = realpath($binPath);
  13914. $this->initializeBinDir();
  13915. $link = $this->binDir.'/'.basename($bin);
  13916. if (file_exists($link)) {
  13917. if (is_link($link)) {
  13918. Silencer::call('chmod', $link, 0777 & ~umask());
  13919. }
  13920. if ($warnOnOverwrite) {
  13921. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  13922. }
  13923. continue;
  13924. }
  13925. if ($this->binCompat === "auto") {
  13926. if (Platform::isWindows()) {
  13927. $this->installFullBinaries($binPath, $link, $bin, $package);
  13928. } else {
  13929. $this->installSymlinkBinaries($binPath, $link);
  13930. }
  13931. } elseif ($this->binCompat === "full") {
  13932. $this->installFullBinaries($binPath, $link, $bin, $package);
  13933. }
  13934. Silencer::call('chmod', $link, 0777 & ~umask());
  13935. }
  13936. }
  13937. public function removeBinaries(PackageInterface $package)
  13938. {
  13939. $this->initializeBinDir();
  13940. $binaries = $this->getBinaries($package);
  13941. if (!$binaries) {
  13942. return;
  13943. }
  13944. foreach ($binaries as $bin) {
  13945. $link = $this->binDir.'/'.basename($bin);
  13946. if (is_link($link) || file_exists($link)) {
  13947. $this->filesystem->unlink($link);
  13948. }
  13949. if (file_exists($link.'.bat')) {
  13950. $this->filesystem->unlink($link.'.bat');
  13951. }
  13952. }
  13953. if ((is_dir($this->binDir)) && ($this->filesystem->isDirEmpty($this->binDir))) {
  13954. Silencer::call('rmdir', $this->binDir);
  13955. }
  13956. }
  13957. public static function determineBinaryCaller($bin)
  13958. {
  13959. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  13960. return 'call';
  13961. }
  13962. $handle = fopen($bin, 'r');
  13963. $line = fgets($handle);
  13964. fclose($handle);
  13965. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  13966. return trim($match[1]);
  13967. }
  13968. return 'php';
  13969. }
  13970. protected function getBinaries(PackageInterface $package)
  13971. {
  13972. return $package->getBinaries();
  13973. }
  13974. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  13975. {
  13976. if ('.bat' !== substr($binPath, -4)) {
  13977. $this->installUnixyProxyBinaries($binPath, $link);
  13978. @chmod($link, 0777 & ~umask());
  13979. $link .= '.bat';
  13980. if (file_exists($link)) {
  13981. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  13982. }
  13983. }
  13984. if (!file_exists($link)) {
  13985. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  13986. }
  13987. }
  13988. protected function installSymlinkBinaries($binPath, $link)
  13989. {
  13990. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  13991. $this->installUnixyProxyBinaries($binPath, $link);
  13992. }
  13993. }
  13994. protected function installUnixyProxyBinaries($binPath, $link)
  13995. {
  13996. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  13997. }
  13998. protected function initializeBinDir()
  13999. {
  14000. $this->filesystem->ensureDirectoryExists($this->binDir);
  14001. $this->binDir = realpath($this->binDir);
  14002. }
  14003. protected function generateWindowsProxyCode($bin, $link)
  14004. {
  14005. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14006. $caller = self::determineBinaryCaller($bin);
  14007. return "@ECHO OFF\r\n".
  14008. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  14009. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  14010. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  14011. }
  14012. protected function generateUnixyProxyCode($bin, $link)
  14013. {
  14014. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14015. $binDir = ProcessExecutor::escape(dirname($binPath));
  14016. $binFile = basename($binPath);
  14017. $proxyCode = <<<PROXY
  14018. #!/usr/bin/env sh
  14019. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  14020. if [ -d /proc/cygdrive ] && [[ \$(which php) == \$(readlink -n /proc/cygdrive)/* ]]; then
  14021. # We are in Cgywin using Windows php, so the path must be translated
  14022. dir=\$(cygpath -m "\$dir");
  14023. fi
  14024. "\${dir}/$binFile" "\$@"
  14025. PROXY;
  14026. return $proxyCode;
  14027. }
  14028. }
  14029. <?php
  14030. namespace Composer\Installer;
  14031. use Composer\Package\PackageInterface;
  14032. interface BinaryPresenceInterface
  14033. {
  14034. public function ensureBinariesPresence(PackageInterface $package);
  14035. }
  14036. <?php
  14037. namespace Composer\Installer;
  14038. use Composer\IO\IOInterface;
  14039. use Composer\Package\PackageInterface;
  14040. use Composer\Package\AliasPackage;
  14041. use Composer\Repository\RepositoryInterface;
  14042. use Composer\Repository\InstalledRepositoryInterface;
  14043. use Composer\DependencyResolver\Operation\OperationInterface;
  14044. use Composer\DependencyResolver\Operation\InstallOperation;
  14045. use Composer\DependencyResolver\Operation\UpdateOperation;
  14046. use Composer\DependencyResolver\Operation\UninstallOperation;
  14047. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  14048. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14049. use Composer\Util\StreamContextFactory;
  14050. class InstallationManager
  14051. {
  14052. private $installers = array();
  14053. private $cache = array();
  14054. private $notifiablePackages = array();
  14055. public function reset()
  14056. {
  14057. $this->notifiablePackages = array();
  14058. }
  14059. public function addInstaller(InstallerInterface $installer)
  14060. {
  14061. array_unshift($this->installers, $installer);
  14062. $this->cache = array();
  14063. }
  14064. public function removeInstaller(InstallerInterface $installer)
  14065. {
  14066. if (false !== ($key = array_search($installer, $this->installers, true))) {
  14067. array_splice($this->installers, $key, 1);
  14068. $this->cache = array();
  14069. }
  14070. }
  14071. public function disablePlugins()
  14072. {
  14073. foreach ($this->installers as $i => $installer) {
  14074. if (!$installer instanceof PluginInstaller) {
  14075. continue;
  14076. }
  14077. unset($this->installers[$i]);
  14078. }
  14079. }
  14080. public function getInstaller($type)
  14081. {
  14082. $type = strtolower($type);
  14083. if (isset($this->cache[$type])) {
  14084. return $this->cache[$type];
  14085. }
  14086. foreach ($this->installers as $installer) {
  14087. if ($installer->supports($type)) {
  14088. return $this->cache[$type] = $installer;
  14089. }
  14090. }
  14091. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  14092. }
  14093. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14094. {
  14095. if ($package instanceof AliasPackage) {
  14096. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  14097. }
  14098. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  14099. }
  14100. public function ensureBinariesPresence(PackageInterface $package)
  14101. {
  14102. try {
  14103. $installer = $this->getInstaller($package->getType());
  14104. } catch (\InvalidArgumentException $e) {
  14105. return;
  14106. }
  14107. if ($installer instanceof BinaryPresenceInterface) {
  14108. $installer->ensureBinariesPresence($package);
  14109. }
  14110. }
  14111. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  14112. {
  14113. $method = $operation->getJobType();
  14114. $this->$method($repo, $operation);
  14115. }
  14116. public function install(RepositoryInterface $repo, InstallOperation $operation)
  14117. {
  14118. $package = $operation->getPackage();
  14119. $installer = $this->getInstaller($package->getType());
  14120. $installer->install($repo, $package);
  14121. $this->markForNotification($package);
  14122. }
  14123. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  14124. {
  14125. $initial = $operation->getInitialPackage();
  14126. $target = $operation->getTargetPackage();
  14127. $initialType = $initial->getType();
  14128. $targetType = $target->getType();
  14129. if ($initialType === $targetType) {
  14130. $installer = $this->getInstaller($initialType);
  14131. $installer->update($repo, $initial, $target);
  14132. $this->markForNotification($target);
  14133. } else {
  14134. $this->getInstaller($initialType)->uninstall($repo, $initial);
  14135. $this->getInstaller($targetType)->install($repo, $target);
  14136. }
  14137. }
  14138. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  14139. {
  14140. $package = $operation->getPackage();
  14141. $installer = $this->getInstaller($package->getType());
  14142. $installer->uninstall($repo, $package);
  14143. }
  14144. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  14145. {
  14146. $package = $operation->getPackage();
  14147. if (!$repo->hasPackage($package)) {
  14148. $repo->addPackage(clone $package);
  14149. }
  14150. }
  14151. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  14152. {
  14153. $package = $operation->getPackage();
  14154. $repo->removePackage($package);
  14155. }
  14156. public function getInstallPath(PackageInterface $package)
  14157. {
  14158. $installer = $this->getInstaller($package->getType());
  14159. return $installer->getInstallPath($package);
  14160. }
  14161. public function notifyInstalls(IOInterface $io)
  14162. {
  14163. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  14164. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  14165. if ($io->hasAuthentication($repositoryName)) {
  14166. $auth = $io->getAuthentication($repositoryName);
  14167. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  14168. $authHeader = 'Authorization: Basic '.$authStr;
  14169. }
  14170. if (strpos($repoUrl, '%package%')) {
  14171. foreach ($packages as $package) {
  14172. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  14173. $params = array(
  14174. 'version' => $package->getPrettyVersion(),
  14175. 'version_normalized' => $package->getVersion(),
  14176. );
  14177. $opts = array('http' =>
  14178. array(
  14179. 'method' => 'POST',
  14180. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  14181. 'content' => http_build_query($params, '', '&'),
  14182. 'timeout' => 3,
  14183. ),
  14184. );
  14185. if (isset($authHeader)) {
  14186. $opts['http']['header'][] = $authHeader;
  14187. }
  14188. $context = StreamContextFactory::getContext($url, $opts);
  14189. @file_get_contents($url, false, $context);
  14190. }
  14191. continue;
  14192. }
  14193. $postData = array('downloads' => array());
  14194. foreach ($packages as $package) {
  14195. $postData['downloads'][] = array(
  14196. 'name' => $package->getPrettyName(),
  14197. 'version' => $package->getVersion(),
  14198. );
  14199. }
  14200. $opts = array('http' =>
  14201. array(
  14202. 'method' => 'POST',
  14203. 'header' => array('Content-Type: application/json'),
  14204. 'content' => json_encode($postData),
  14205. 'timeout' => 6,
  14206. ),
  14207. );
  14208. if (isset($authHeader)) {
  14209. $opts['http']['header'][] = $authHeader;
  14210. }
  14211. $context = StreamContextFactory::getContext($repoUrl, $opts);
  14212. @file_get_contents($repoUrl, false, $context);
  14213. }
  14214. $this->reset();
  14215. }
  14216. private function markForNotification(PackageInterface $package)
  14217. {
  14218. if ($package->getNotificationUrl()) {
  14219. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  14220. }
  14221. }
  14222. }
  14223. <?php
  14224. namespace Composer\Installer;
  14225. use Composer\Composer;
  14226. use Composer\DependencyResolver\PolicyInterface;
  14227. use Composer\DependencyResolver\Operation\OperationInterface;
  14228. use Composer\DependencyResolver\Pool;
  14229. use Composer\DependencyResolver\Request;
  14230. use Composer\EventDispatcher\Event;
  14231. use Composer\IO\IOInterface;
  14232. use Composer\Repository\CompositeRepository;
  14233. class InstallerEvent extends Event
  14234. {
  14235. private $composer;
  14236. private $io;
  14237. private $devMode;
  14238. private $policy;
  14239. private $pool;
  14240. private $installedRepo;
  14241. private $request;
  14242. private $operations;
  14243. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  14244. {
  14245. parent::__construct($eventName);
  14246. $this->composer = $composer;
  14247. $this->io = $io;
  14248. $this->devMode = $devMode;
  14249. $this->policy = $policy;
  14250. $this->pool = $pool;
  14251. $this->installedRepo = $installedRepo;
  14252. $this->request = $request;
  14253. $this->operations = $operations;
  14254. }
  14255. public function getComposer()
  14256. {
  14257. return $this->composer;
  14258. }
  14259. public function getIO()
  14260. {
  14261. return $this->io;
  14262. }
  14263. public function isDevMode()
  14264. {
  14265. return $this->devMode;
  14266. }
  14267. public function getPolicy()
  14268. {
  14269. return $this->policy;
  14270. }
  14271. public function getPool()
  14272. {
  14273. return $this->pool;
  14274. }
  14275. public function getInstalledRepo()
  14276. {
  14277. return $this->installedRepo;
  14278. }
  14279. public function getRequest()
  14280. {
  14281. return $this->request;
  14282. }
  14283. public function getOperations()
  14284. {
  14285. return $this->operations;
  14286. }
  14287. }
  14288. <?php
  14289. namespace Composer\Installer;
  14290. class InstallerEvents
  14291. {
  14292. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  14293. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  14294. }
  14295. <?php
  14296. namespace Composer\Installer;
  14297. use Composer\Package\PackageInterface;
  14298. use Composer\Repository\InstalledRepositoryInterface;
  14299. use InvalidArgumentException;
  14300. interface InstallerInterface
  14301. {
  14302. public function supports($packageType);
  14303. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  14304. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  14305. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  14306. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  14307. public function getInstallPath(PackageInterface $package);
  14308. }
  14309. <?php
  14310. namespace Composer\Installer;
  14311. use Composer\Composer;
  14312. use Composer\IO\IOInterface;
  14313. use Composer\Repository\InstalledRepositoryInterface;
  14314. use Composer\Package\PackageInterface;
  14315. use Composer\Util\Filesystem;
  14316. use Composer\Util\Silencer;
  14317. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  14318. {
  14319. protected $composer;
  14320. protected $vendorDir;
  14321. protected $binDir;
  14322. protected $downloadManager;
  14323. protected $io;
  14324. protected $type;
  14325. protected $filesystem;
  14326. protected $binCompat;
  14327. protected $binaryInstaller;
  14328. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  14329. {
  14330. $this->composer = $composer;
  14331. $this->downloadManager = $composer->getDownloadManager();
  14332. $this->io = $io;
  14333. $this->type = $type;
  14334. $this->filesystem = $filesystem ?: new Filesystem();
  14335. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  14336. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  14337. }
  14338. public function supports($packageType)
  14339. {
  14340. return $packageType === $this->type || null === $this->type;
  14341. }
  14342. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14343. {
  14344. return $repo->hasPackage($package) && is_readable($this->getInstallPath($package));
  14345. }
  14346. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14347. {
  14348. $this->initializeVendorDir();
  14349. $downloadPath = $this->getInstallPath($package);
  14350. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  14351. $this->binaryInstaller->removeBinaries($package);
  14352. }
  14353. $this->installCode($package);
  14354. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  14355. if (!$repo->hasPackage($package)) {
  14356. $repo->addPackage(clone $package);
  14357. }
  14358. }
  14359. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14360. {
  14361. if (!$repo->hasPackage($initial)) {
  14362. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14363. }
  14364. $this->initializeVendorDir();
  14365. $this->binaryInstaller->removeBinaries($initial);
  14366. $this->updateCode($initial, $target);
  14367. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  14368. $repo->removePackage($initial);
  14369. if (!$repo->hasPackage($target)) {
  14370. $repo->addPackage(clone $target);
  14371. }
  14372. }
  14373. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14374. {
  14375. if (!$repo->hasPackage($package)) {
  14376. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14377. }
  14378. $this->removeCode($package);
  14379. $this->binaryInstaller->removeBinaries($package);
  14380. $repo->removePackage($package);
  14381. $downloadPath = $this->getPackageBasePath($package);
  14382. if (strpos($package->getName(), '/')) {
  14383. $packageVendorDir = dirname($downloadPath);
  14384. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  14385. Silencer::call('rmdir', $packageVendorDir);
  14386. }
  14387. }
  14388. }
  14389. public function getInstallPath(PackageInterface $package)
  14390. {
  14391. $this->initializeVendorDir();
  14392. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  14393. $targetDir = $package->getTargetDir();
  14394. return $basePath . ($targetDir ? '/'.$targetDir : '');
  14395. }
  14396. public function ensureBinariesPresence(PackageInterface $package)
  14397. {
  14398. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  14399. }
  14400. protected function getPackageBasePath(PackageInterface $package)
  14401. {
  14402. $installPath = $this->getInstallPath($package);
  14403. $targetDir = $package->getTargetDir();
  14404. if ($targetDir) {
  14405. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  14406. }
  14407. return $installPath;
  14408. }
  14409. protected function installCode(PackageInterface $package)
  14410. {
  14411. $downloadPath = $this->getInstallPath($package);
  14412. $this->downloadManager->download($package, $downloadPath);
  14413. }
  14414. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  14415. {
  14416. $initialDownloadPath = $this->getInstallPath($initial);
  14417. $targetDownloadPath = $this->getInstallPath($target);
  14418. if ($targetDownloadPath !== $initialDownloadPath) {
  14419. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  14420. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  14421. ) {
  14422. $this->removeCode($initial);
  14423. $this->installCode($target);
  14424. return;
  14425. }
  14426. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  14427. }
  14428. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  14429. }
  14430. protected function removeCode(PackageInterface $package)
  14431. {
  14432. $downloadPath = $this->getPackageBasePath($package);
  14433. $this->downloadManager->remove($package, $downloadPath);
  14434. }
  14435. protected function initializeVendorDir()
  14436. {
  14437. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  14438. $this->vendorDir = realpath($this->vendorDir);
  14439. }
  14440. }
  14441. <?php
  14442. namespace Composer\Installer;
  14443. use Composer\Repository\InstalledRepositoryInterface;
  14444. use Composer\Package\PackageInterface;
  14445. class MetapackageInstaller implements InstallerInterface
  14446. {
  14447. public function supports($packageType)
  14448. {
  14449. return $packageType === 'metapackage';
  14450. }
  14451. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14452. {
  14453. return $repo->hasPackage($package);
  14454. }
  14455. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14456. {
  14457. $repo->addPackage(clone $package);
  14458. }
  14459. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14460. {
  14461. if (!$repo->hasPackage($initial)) {
  14462. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14463. }
  14464. $repo->removePackage($initial);
  14465. $repo->addPackage(clone $target);
  14466. }
  14467. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14468. {
  14469. if (!$repo->hasPackage($package)) {
  14470. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14471. }
  14472. $repo->removePackage($package);
  14473. }
  14474. public function getInstallPath(PackageInterface $package)
  14475. {
  14476. return '';
  14477. }
  14478. }
  14479. <?php
  14480. namespace Composer\Installer;
  14481. use Composer\Repository\InstalledRepositoryInterface;
  14482. use Composer\Package\PackageInterface;
  14483. class NoopInstaller implements InstallerInterface
  14484. {
  14485. public function supports($packageType)
  14486. {
  14487. return true;
  14488. }
  14489. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14490. {
  14491. return $repo->hasPackage($package);
  14492. }
  14493. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14494. {
  14495. if (!$repo->hasPackage($package)) {
  14496. $repo->addPackage(clone $package);
  14497. }
  14498. }
  14499. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14500. {
  14501. if (!$repo->hasPackage($initial)) {
  14502. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  14503. }
  14504. $repo->removePackage($initial);
  14505. if (!$repo->hasPackage($target)) {
  14506. $repo->addPackage(clone $target);
  14507. }
  14508. }
  14509. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14510. {
  14511. if (!$repo->hasPackage($package)) {
  14512. throw new \InvalidArgumentException('Package is not installed: '.$package);
  14513. }
  14514. $repo->removePackage($package);
  14515. }
  14516. public function getInstallPath(PackageInterface $package)
  14517. {
  14518. $targetDir = $package->getTargetDir();
  14519. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  14520. }
  14521. }
  14522. <?php
  14523. namespace Composer\Installer;
  14524. use Composer\Composer;
  14525. use Composer\IO\IOInterface;
  14526. use Composer\DependencyResolver\Operation\OperationInterface;
  14527. use Composer\DependencyResolver\PolicyInterface;
  14528. use Composer\DependencyResolver\Pool;
  14529. use Composer\DependencyResolver\Request;
  14530. use Composer\Repository\CompositeRepository;
  14531. class PackageEvent extends InstallerEvent
  14532. {
  14533. private $operation;
  14534. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  14535. {
  14536. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  14537. $this->operation = $operation;
  14538. }
  14539. public function getOperation()
  14540. {
  14541. return $this->operation;
  14542. }
  14543. }
  14544. <?php
  14545. namespace Composer\Installer;
  14546. class PackageEvents
  14547. {
  14548. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  14549. const POST_PACKAGE_INSTALL = 'post-package-install';
  14550. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  14551. const POST_PACKAGE_UPDATE = 'post-package-update';
  14552. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  14553. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  14554. }
  14555. <?php
  14556. namespace Composer\Installer;
  14557. use Composer\IO\IOInterface;
  14558. use Composer\Package\PackageInterface;
  14559. use Composer\Util\Filesystem;
  14560. use Composer\Util\ProcessExecutor;
  14561. class PearBinaryInstaller extends BinaryInstaller
  14562. {
  14563. private $installer;
  14564. private $vendorDir;
  14565. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  14566. {
  14567. parent::__construct($io, $binDir, $binCompat, $filesystem);
  14568. $this->installer = $installer;
  14569. $this->vendorDir = $vendorDir;
  14570. }
  14571. protected function getBinaries(PackageInterface $package)
  14572. {
  14573. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  14574. $binaries = array();
  14575. if (file_exists($binariesPath)) {
  14576. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  14577. if (!$value->isDir()) {
  14578. $binaries[] = 'bin/'.$fileName;
  14579. }
  14580. }
  14581. }
  14582. return $binaries;
  14583. }
  14584. protected function initializeBinDir()
  14585. {
  14586. parent::initializeBinDir();
  14587. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  14588. @chmod($this->binDir.'/composer-php', 0777);
  14589. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  14590. @chmod($this->binDir.'/composer-php.bat', 0777);
  14591. }
  14592. protected function generateWindowsProxyCode($bin, $link)
  14593. {
  14594. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14595. if ('.bat' === substr($bin, -4)) {
  14596. $caller = 'call';
  14597. } else {
  14598. $handle = fopen($bin, 'r');
  14599. $line = fgets($handle);
  14600. fclose($handle);
  14601. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14602. $caller = trim($match[1]);
  14603. } else {
  14604. $caller = 'php';
  14605. }
  14606. if ($caller === 'php') {
  14607. return "@echo off\r\n".
  14608. "pushd .\r\n".
  14609. "cd %~dp0\r\n".
  14610. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  14611. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  14612. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  14613. "popd\r\n".
  14614. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  14615. }
  14616. }
  14617. return "@echo off\r\n".
  14618. "pushd .\r\n".
  14619. "cd %~dp0\r\n".
  14620. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  14621. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  14622. "popd\r\n".
  14623. $caller." \"%BIN_TARGET%\" %*\r\n";
  14624. }
  14625. private function generateWindowsPhpProxyCode()
  14626. {
  14627. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  14628. return
  14629. "@echo off\r\n" .
  14630. "setlocal enabledelayedexpansion\r\n" .
  14631. "set BIN_DIR=%~dp0\r\n" .
  14632. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  14633. "set DIRS=.\r\n" .
  14634. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  14635. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  14636. " set DIRS=!DIRS!;%%~fP\r\n" .
  14637. " )\r\n" .
  14638. ")\r\n" .
  14639. "php.exe -d include_path=!DIRS! %*\r\n";
  14640. }
  14641. private function generateUnixyPhpProxyCode()
  14642. {
  14643. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  14644. return
  14645. "#!/usr/bin/env sh\n".
  14646. "SRC_DIR=`pwd`\n".
  14647. "BIN_DIR=`dirname $0`\n".
  14648. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  14649. "DIRS=\"\"\n".
  14650. "for vendor in \$VENDOR_DIR/*; do\n".
  14651. " if [ -d \"\$vendor\" ]; then\n".
  14652. " for package in \$vendor/*; do\n".
  14653. " if [ -d \"\$package\" ]; then\n".
  14654. " DIRS=\"\${DIRS}:\${package}\"\n".
  14655. " fi\n".
  14656. " done\n".
  14657. " fi\n".
  14658. "done\n".
  14659. "php -d include_path=\".\$DIRS\" $@\n";
  14660. }
  14661. }
  14662. <?php
  14663. namespace Composer\Installer;
  14664. use Composer\IO\IOInterface;
  14665. use Composer\Composer;
  14666. use Composer\Downloader\PearPackageExtractor;
  14667. use Composer\Repository\InstalledRepositoryInterface;
  14668. use Composer\Package\PackageInterface;
  14669. use Composer\Util\Platform;
  14670. use Composer\Util\Filesystem;
  14671. class PearInstaller extends LibraryInstaller
  14672. {
  14673. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  14674. {
  14675. $filesystem = new Filesystem();
  14676. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  14677. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  14678. }
  14679. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14680. {
  14681. $this->uninstall($repo, $initial);
  14682. $this->install($repo, $target);
  14683. }
  14684. protected function installCode(PackageInterface $package)
  14685. {
  14686. parent::installCode($package);
  14687. $isWindows = Platform::isWindows();
  14688. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  14689. if (!$isWindows) {
  14690. $php_bin = '/usr/bin/env ' . $php_bin;
  14691. }
  14692. $installPath = $this->getInstallPath($package);
  14693. $vars = array(
  14694. 'os' => $isWindows ? 'windows' : 'linux',
  14695. 'php_bin' => $php_bin,
  14696. 'pear_php' => $installPath,
  14697. 'php_dir' => $installPath,
  14698. 'bin_dir' => $installPath . '/bin',
  14699. 'data_dir' => $installPath . '/data',
  14700. 'version' => $package->getPrettyVersion(),
  14701. );
  14702. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  14703. $pearExtractor = new PearPackageExtractor($packageArchive);
  14704. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  14705. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  14706. $this->filesystem->unlink($packageArchive);
  14707. }
  14708. }
  14709. <?php
  14710. namespace Composer\Installer;
  14711. use Composer\Composer;
  14712. use Composer\IO\IOInterface;
  14713. use Composer\Repository\InstalledRepositoryInterface;
  14714. use Composer\Package\PackageInterface;
  14715. class PluginInstaller extends LibraryInstaller
  14716. {
  14717. private $installationManager;
  14718. public function __construct(IOInterface $io, Composer $composer, $type = 'library')
  14719. {
  14720. parent::__construct($io, $composer, 'composer-plugin');
  14721. $this->installationManager = $composer->getInstallationManager();
  14722. }
  14723. public function supports($packageType)
  14724. {
  14725. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  14726. }
  14727. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14728. {
  14729. $extra = $package->getExtra();
  14730. if (empty($extra['class'])) {
  14731. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  14732. }
  14733. parent::install($repo, $package);
  14734. try {
  14735. $this->composer->getPluginManager()->registerPackage($package, true);
  14736. } catch (\Exception $e) {
  14737. $this->io->writeError('Plugin installation failed, rolling back');
  14738. parent::uninstall($repo, $package);
  14739. throw $e;
  14740. }
  14741. }
  14742. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14743. {
  14744. $extra = $target->getExtra();
  14745. if (empty($extra['class'])) {
  14746. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  14747. }
  14748. parent::update($repo, $initial, $target);
  14749. $this->composer->getPluginManager()->registerPackage($target, true);
  14750. }
  14751. }
  14752. <?php
  14753. namespace Composer\Installer;
  14754. use Composer\Package\PackageInterface;
  14755. use Composer\Downloader\DownloadManager;
  14756. use Composer\Repository\InstalledRepositoryInterface;
  14757. use Composer\Util\Filesystem;
  14758. class ProjectInstaller implements InstallerInterface
  14759. {
  14760. private $installPath;
  14761. private $downloadManager;
  14762. private $filesystem;
  14763. public function __construct($installPath, DownloadManager $dm)
  14764. {
  14765. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  14766. $this->downloadManager = $dm;
  14767. $this->filesystem = new Filesystem;
  14768. }
  14769. public function supports($packageType)
  14770. {
  14771. return true;
  14772. }
  14773. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14774. {
  14775. return false;
  14776. }
  14777. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  14778. {
  14779. $installPath = $this->installPath;
  14780. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  14781. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  14782. }
  14783. if (!is_dir($installPath)) {
  14784. mkdir($installPath, 0777, true);
  14785. }
  14786. $this->downloadManager->download($package, $installPath);
  14787. }
  14788. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  14789. {
  14790. throw new \InvalidArgumentException("not supported");
  14791. }
  14792. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  14793. {
  14794. throw new \InvalidArgumentException("not supported");
  14795. }
  14796. public function getInstallPath(PackageInterface $package)
  14797. {
  14798. return $this->installPath;
  14799. }
  14800. }
  14801. <?php
  14802. namespace Composer\Installer;
  14803. use Composer\IO\IOInterface;
  14804. use Composer\Package\PackageInterface;
  14805. use Composer\Repository\RepositoryInterface;
  14806. use Symfony\Component\Console\Formatter\OutputFormatter;
  14807. class SuggestedPackagesReporter
  14808. {
  14809. protected $suggestedPackages = array();
  14810. private $io;
  14811. public function __construct(IOInterface $io)
  14812. {
  14813. $this->io = $io;
  14814. }
  14815. public function getPackages()
  14816. {
  14817. return $this->suggestedPackages;
  14818. }
  14819. public function addPackage($source, $target, $reason)
  14820. {
  14821. $this->suggestedPackages[] = array(
  14822. 'source' => $source,
  14823. 'target' => $target,
  14824. 'reason' => $reason,
  14825. );
  14826. return $this;
  14827. }
  14828. public function addSuggestionsFromPackage(PackageInterface $package)
  14829. {
  14830. $source = $package->getPrettyName();
  14831. foreach ($package->getSuggests() as $target => $reason) {
  14832. $this->addPackage(
  14833. $source,
  14834. $target,
  14835. $reason
  14836. );
  14837. }
  14838. return $this;
  14839. }
  14840. public function output(RepositoryInterface $installedRepo = null)
  14841. {
  14842. $suggestedPackages = $this->getPackages();
  14843. $installedPackages = array();
  14844. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  14845. foreach ($installedRepo->getPackages() as $package) {
  14846. $installedPackages = array_merge(
  14847. $installedPackages,
  14848. $package->getNames()
  14849. );
  14850. }
  14851. }
  14852. foreach ($suggestedPackages as $suggestion) {
  14853. if (in_array($suggestion['target'], $installedPackages)) {
  14854. continue;
  14855. }
  14856. $this->io->writeError(sprintf(
  14857. '%s suggests installing %s (%s)',
  14858. $suggestion['source'],
  14859. $this->escapeOutput($suggestion['target']),
  14860. $this->escapeOutput($suggestion['reason'])
  14861. ));
  14862. }
  14863. return $this;
  14864. }
  14865. private function escapeOutput($string)
  14866. {
  14867. return OutputFormatter::escape(
  14868. $this->removeControlCharacters($string)
  14869. );
  14870. }
  14871. private function removeControlCharacters($string)
  14872. {
  14873. return preg_replace(
  14874. '/[[:cntrl:]]/',
  14875. '',
  14876. str_replace("\n", ' ', $string)
  14877. );
  14878. }
  14879. }
  14880. <?php
  14881. namespace Composer\Json;
  14882. use JsonSchema\Validator;
  14883. use Seld\JsonLint\JsonParser;
  14884. use Seld\JsonLint\ParsingException;
  14885. use Composer\Util\RemoteFilesystem;
  14886. use Composer\IO\IOInterface;
  14887. use Composer\Downloader\TransportException;
  14888. class JsonFile
  14889. {
  14890. const LAX_SCHEMA = 1;
  14891. const STRICT_SCHEMA = 2;
  14892. const JSON_UNESCAPED_SLASHES = 64;
  14893. const JSON_PRETTY_PRINT = 128;
  14894. const JSON_UNESCAPED_UNICODE = 256;
  14895. private $path;
  14896. private $rfs;
  14897. private $io;
  14898. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  14899. {
  14900. $this->path = $path;
  14901. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  14902. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  14903. }
  14904. $this->rfs = $rfs;
  14905. $this->io = $io;
  14906. }
  14907. public function getPath()
  14908. {
  14909. return $this->path;
  14910. }
  14911. public function exists()
  14912. {
  14913. return is_file($this->path);
  14914. }
  14915. public function read()
  14916. {
  14917. try {
  14918. if ($this->rfs) {
  14919. $json = $this->rfs->getContents($this->path, $this->path, false);
  14920. } else {
  14921. if ($this->io && $this->io->isDebug()) {
  14922. $this->io->writeError('Reading ' . $this->path);
  14923. }
  14924. $json = file_get_contents($this->path);
  14925. }
  14926. } catch (TransportException $e) {
  14927. throw new \RuntimeException($e->getMessage(), 0, $e);
  14928. } catch (\Exception $e) {
  14929. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  14930. }
  14931. return static::parseJson($json, $this->path);
  14932. }
  14933. public function write(array $hash, $options = 448)
  14934. {
  14935. $dir = dirname($this->path);
  14936. if (!is_dir($dir)) {
  14937. if (file_exists($dir)) {
  14938. throw new \UnexpectedValueException(
  14939. $dir.' exists and is not a directory.'
  14940. );
  14941. }
  14942. if (!@mkdir($dir, 0777, true)) {
  14943. throw new \UnexpectedValueException(
  14944. $dir.' does not exist and could not be created.'
  14945. );
  14946. }
  14947. }
  14948. $retries = 3;
  14949. while ($retries--) {
  14950. try {
  14951. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  14952. break;
  14953. } catch (\Exception $e) {
  14954. if ($retries) {
  14955. usleep(500000);
  14956. continue;
  14957. }
  14958. throw $e;
  14959. }
  14960. }
  14961. }
  14962. public function validateSchema($schema = self::STRICT_SCHEMA)
  14963. {
  14964. $content = file_get_contents($this->path);
  14965. $data = json_decode($content);
  14966. if (null === $data && 'null' !== $content) {
  14967. self::validateSyntax($content, $this->path);
  14968. }
  14969. $schemaFile = __DIR__ . '/../../../res/composer-schema.json';
  14970. if (false === strpos($schemaFile, '://')) {
  14971. $schemaFile = 'file://' . $schemaFile;
  14972. }
  14973. $schemaData = (object) array('$ref' => $schemaFile);
  14974. if ($schema === self::LAX_SCHEMA) {
  14975. $schemaData->additionalProperties = true;
  14976. $schemaData->required = array();
  14977. }
  14978. $validator = new Validator();
  14979. $validator->check($data, $schemaData);
  14980. if (!$validator->isValid()) {
  14981. $errors = array();
  14982. foreach ((array) $validator->getErrors() as $error) {
  14983. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  14984. }
  14985. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  14986. }
  14987. return true;
  14988. }
  14989. public static function encode($data, $options = 448)
  14990. {
  14991. if (PHP_VERSION_ID >= 50400) {
  14992. $json = json_encode($data, $options);
  14993. if (false === $json) {
  14994. self::throwEncodeError(json_last_error());
  14995. }
  14996. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  14997. $json = preg_replace('/\[\s+\]/', '[]', $json);
  14998. $json = preg_replace('/\{\s+\}/', '{}', $json);
  14999. }
  15000. return $json;
  15001. }
  15002. $json = json_encode($data);
  15003. if (false === $json) {
  15004. self::throwEncodeError(json_last_error());
  15005. }
  15006. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  15007. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  15008. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  15009. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  15010. return $json;
  15011. }
  15012. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  15013. }
  15014. private static function throwEncodeError($code)
  15015. {
  15016. switch ($code) {
  15017. case JSON_ERROR_DEPTH:
  15018. $msg = 'Maximum stack depth exceeded';
  15019. break;
  15020. case JSON_ERROR_STATE_MISMATCH:
  15021. $msg = 'Underflow or the modes mismatch';
  15022. break;
  15023. case JSON_ERROR_CTRL_CHAR:
  15024. $msg = 'Unexpected control character found';
  15025. break;
  15026. case JSON_ERROR_UTF8:
  15027. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  15028. break;
  15029. default:
  15030. $msg = 'Unknown error';
  15031. }
  15032. throw new \RuntimeException('JSON encoding failed: '.$msg);
  15033. }
  15034. public static function parseJson($json, $file = null)
  15035. {
  15036. if (null === $json) {
  15037. return;
  15038. }
  15039. $data = json_decode($json, true);
  15040. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  15041. self::validateSyntax($json, $file);
  15042. }
  15043. return $data;
  15044. }
  15045. protected static function validateSyntax($json, $file = null)
  15046. {
  15047. $parser = new JsonParser();
  15048. $result = $parser->lint($json);
  15049. if (null === $result) {
  15050. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  15051. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  15052. }
  15053. return true;
  15054. }
  15055. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  15056. }
  15057. }
  15058. <?php
  15059. namespace Composer\Json;
  15060. class JsonFormatter
  15061. {
  15062. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  15063. {
  15064. $result = '';
  15065. $pos = 0;
  15066. $strLen = strlen($json);
  15067. $indentStr = ' ';
  15068. $newLine = "\n";
  15069. $outOfQuotes = true;
  15070. $buffer = '';
  15071. $noescape = true;
  15072. for ($i = 0; $i < $strLen; $i++) {
  15073. $char = substr($json, $i, 1);
  15074. if ('"' === $char && $noescape) {
  15075. $outOfQuotes = !$outOfQuotes;
  15076. }
  15077. if (!$outOfQuotes) {
  15078. $buffer .= $char;
  15079. $noescape = '\\' === $char ? !$noescape : true;
  15080. continue;
  15081. } elseif ('' !== $buffer) {
  15082. if ($unescapeSlashes) {
  15083. $buffer = str_replace('\\/', '/', $buffer);
  15084. }
  15085. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  15086. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  15087. $l = strlen($match[1]);
  15088. if ($l % 2) {
  15089. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  15090. pack('H*', $match[2]),
  15091. 'UTF-8',
  15092. 'UCS-2BE'
  15093. );
  15094. }
  15095. return $match[0];
  15096. }, $buffer);
  15097. }
  15098. $result .= $buffer.$char;
  15099. $buffer = '';
  15100. continue;
  15101. }
  15102. if (':' === $char) {
  15103. $char .= ' ';
  15104. } elseif (('}' === $char || ']' === $char)) {
  15105. $pos--;
  15106. $prevChar = substr($json, $i - 1, 1);
  15107. if ('{' !== $prevChar && '[' !== $prevChar) {
  15108. $result .= $newLine;
  15109. for ($j = 0; $j < $pos; $j++) {
  15110. $result .= $indentStr;
  15111. }
  15112. } else {
  15113. $result = rtrim($result);
  15114. }
  15115. }
  15116. $result .= $char;
  15117. if (',' === $char || '{' === $char || '[' === $char) {
  15118. $result .= $newLine;
  15119. if ('{' === $char || '[' === $char) {
  15120. $pos++;
  15121. }
  15122. for ($j = 0; $j < $pos; $j++) {
  15123. $result .= $indentStr;
  15124. }
  15125. }
  15126. }
  15127. return $result;
  15128. }
  15129. }
  15130. <?php
  15131. namespace Composer\Json;
  15132. use Composer\Repository\PlatformRepository;
  15133. class JsonManipulator
  15134. {
  15135. private static $DEFINES = '(?(DEFINE)
  15136. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  15137. (?<boolean> true | false | null )
  15138. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " )
  15139. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  15140. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  15141. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  15142. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  15143. )';
  15144. private $contents;
  15145. private $newline;
  15146. private $indent;
  15147. public function __construct($contents)
  15148. {
  15149. $contents = trim($contents);
  15150. if ($contents === '') {
  15151. $contents = '{}';
  15152. }
  15153. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  15154. throw new \InvalidArgumentException('The json file must be an object ({})');
  15155. }
  15156. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  15157. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  15158. $this->detectIndenting();
  15159. }
  15160. public function getContents()
  15161. {
  15162. return $this->contents . $this->newline;
  15163. }
  15164. public function addLink($type, $package, $constraint, $sortPackages = false)
  15165. {
  15166. $decoded = JsonFile::parseJson($this->contents);
  15167. if (!isset($decoded[$type])) {
  15168. return $this->addMainKey($type, array($package => $constraint));
  15169. }
  15170. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15171. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  15172. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  15173. return false;
  15174. }
  15175. $links = $matches['value'];
  15176. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  15177. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  15178. if ($this->pregMatch($regex, $links, $packageMatches)) {
  15179. $existingPackage = $packageMatches['package'];
  15180. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  15181. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  15182. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  15183. }, $links);
  15184. } else {
  15185. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  15186. $links = preg_replace(
  15187. '{'.preg_quote($match[1]).'$}',
  15188. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  15189. $links
  15190. );
  15191. } else {
  15192. $links = '{' . $this->newline .
  15193. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  15194. $this->indent . '}';
  15195. }
  15196. }
  15197. if (true === $sortPackages) {
  15198. $requirements = json_decode($links, true);
  15199. $this->sortPackages($requirements);
  15200. $links = $this->format($requirements);
  15201. }
  15202. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  15203. return true;
  15204. }
  15205. private function sortPackages(array &$packages = array())
  15206. {
  15207. $prefix = function ($requirement) {
  15208. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  15209. return preg_replace(
  15210. array(
  15211. '/^php/',
  15212. '/^hhvm/',
  15213. '/^ext/',
  15214. '/^lib/',
  15215. '/^\D/',
  15216. ),
  15217. array(
  15218. '0-$0',
  15219. '1-$0',
  15220. '2-$0',
  15221. '3-$0',
  15222. '4-$0',
  15223. ),
  15224. $requirement
  15225. );
  15226. }
  15227. return '5-'.$requirement;
  15228. };
  15229. uksort($packages, function ($a, $b) use ($prefix) {
  15230. return strnatcmp($prefix($a), $prefix($b));
  15231. });
  15232. }
  15233. public function addRepository($name, $config)
  15234. {
  15235. return $this->addSubNode('repositories', $name, $config);
  15236. }
  15237. public function removeRepository($name)
  15238. {
  15239. return $this->removeSubNode('repositories', $name);
  15240. }
  15241. public function addConfigSetting($name, $value)
  15242. {
  15243. return $this->addSubNode('config', $name, $value);
  15244. }
  15245. public function removeConfigSetting($name)
  15246. {
  15247. return $this->removeSubNode('config', $name);
  15248. }
  15249. public function addProperty($name, $value)
  15250. {
  15251. if (substr($name, 0, 6) === 'extra.') {
  15252. return $this->addSubNode('extra', substr($name, 6), $value);
  15253. }
  15254. return $this->addMainKey($name, $value);
  15255. }
  15256. public function removeProperty($name)
  15257. {
  15258. if (substr($name, 0, 6) === 'extra.') {
  15259. return $this->removeSubNode('extra', substr($name, 6));
  15260. }
  15261. return $this->removeMainKey($name);
  15262. }
  15263. public function addSubNode($mainNode, $name, $value)
  15264. {
  15265. $decoded = JsonFile::parseJson($this->contents);
  15266. $subName = null;
  15267. if (in_array($mainNode, array('config', 'extra')) && false !== strpos($name, '.')) {
  15268. list($name, $subName) = explode('.', $name, 2);
  15269. }
  15270. if (!isset($decoded[$mainNode])) {
  15271. if ($subName !== null) {
  15272. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  15273. } else {
  15274. $this->addMainKey($mainNode, array($name => $value));
  15275. }
  15276. return true;
  15277. }
  15278. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15279. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15280. try {
  15281. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15282. return false;
  15283. }
  15284. } catch (\RuntimeException $e) {
  15285. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15286. return false;
  15287. }
  15288. throw $e;
  15289. }
  15290. $children = $match['content'];
  15291. if (!@json_decode($children)) {
  15292. return false;
  15293. }
  15294. $that = $this;
  15295. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  15296. if ($this->pregMatch($childRegex, $children, $matches)) {
  15297. $children = preg_replace_callback($childRegex, function ($matches) use ($name, $subName, $value, $that) {
  15298. if ($subName !== null) {
  15299. $curVal = json_decode($matches['content'], true);
  15300. if (!is_array($curVal)) {
  15301. $curVal = array();
  15302. }
  15303. $curVal[$subName] = $value;
  15304. $value = $curVal;
  15305. }
  15306. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  15307. }, $children);
  15308. } else {
  15309. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  15310. $whitespace = '';
  15311. if (!empty($match['trailingspace'])) {
  15312. $whitespace = $match['trailingspace'];
  15313. }
  15314. if (!empty($match['content'])) {
  15315. if ($subName !== null) {
  15316. $value = array($subName => $value);
  15317. }
  15318. $children = preg_replace(
  15319. '#'.$whitespace.'}$#',
  15320. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  15321. $children
  15322. );
  15323. } else {
  15324. if ($subName !== null) {
  15325. $value = array($subName => $value);
  15326. }
  15327. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  15328. }
  15329. }
  15330. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  15331. return $m['start'] . $children . $m['end'];
  15332. }, $this->contents);
  15333. return true;
  15334. }
  15335. public function removeSubNode($mainNode, $name)
  15336. {
  15337. $decoded = JsonFile::parseJson($this->contents);
  15338. if (empty($decoded[$mainNode])) {
  15339. return true;
  15340. }
  15341. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  15342. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  15343. try {
  15344. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  15345. return false;
  15346. }
  15347. } catch (\RuntimeException $e) {
  15348. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  15349. return false;
  15350. }
  15351. throw $e;
  15352. }
  15353. $children = $match['content'];
  15354. if (!@json_decode($children, true)) {
  15355. return false;
  15356. }
  15357. $subName = null;
  15358. if (in_array($mainNode, array('config', 'extra')) && false !== strpos($name, '.')) {
  15359. list($name, $subName) = explode('.', $name, 2);
  15360. }
  15361. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  15362. return true;
  15363. }
  15364. if ($this->pregMatch('{"'.preg_quote($name).'"\s*:}i', $children)) {
  15365. if (preg_match_all('{'.self::$DEFINES.'"'.preg_quote($name).'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  15366. $bestMatch = '';
  15367. foreach ($matches[0] as $match) {
  15368. if (strlen($bestMatch) < strlen($match)) {
  15369. $bestMatch = $match;
  15370. }
  15371. }
  15372. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  15373. if (1 !== $count) {
  15374. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  15375. if (1 !== $count) {
  15376. return false;
  15377. }
  15378. }
  15379. }
  15380. } else {
  15381. $childrenClean = $children;
  15382. }
  15383. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  15384. if (empty($match['content'])) {
  15385. $newline = $this->newline;
  15386. $indent = $this->indent;
  15387. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  15388. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  15389. }, $this->contents);
  15390. if ($subName !== null) {
  15391. $curVal = json_decode($children, true);
  15392. unset($curVal[$name][$subName]);
  15393. $this->addSubNode($mainNode, $name, $curVal[$name]);
  15394. }
  15395. return true;
  15396. }
  15397. $that = $this;
  15398. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  15399. if ($subName !== null) {
  15400. $curVal = json_decode($matches['content'], true);
  15401. unset($curVal[$name][$subName]);
  15402. $childrenClean = $that->format($curVal, 0);
  15403. }
  15404. return $matches['start'] . $childrenClean . $matches['end'];
  15405. }, $this->contents);
  15406. return true;
  15407. }
  15408. public function addMainKey($key, $content)
  15409. {
  15410. $decoded = JsonFile::parseJson($this->contents);
  15411. $content = $this->format($content);
  15412. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15413. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  15414. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  15415. if (!@json_decode('{'.$matches['key'].'}')) {
  15416. return false;
  15417. }
  15418. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  15419. return true;
  15420. }
  15421. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  15422. $this->contents = preg_replace(
  15423. '#'.$match[1].'\}$#',
  15424. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  15425. $this->contents
  15426. );
  15427. return true;
  15428. }
  15429. $this->contents = preg_replace(
  15430. '#\}$#',
  15431. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  15432. $this->contents
  15433. );
  15434. return true;
  15435. }
  15436. public function removeMainKey($key)
  15437. {
  15438. $decoded = JsonFile::parseJson($this->contents);
  15439. if (!array_key_exists($key, $decoded)) {
  15440. return true;
  15441. }
  15442. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15443. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  15444. if ($this->pregMatch($regex, $this->contents, $matches)) {
  15445. if (!@json_decode('{'.$matches['removal'].'}')) {
  15446. return false;
  15447. }
  15448. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  15449. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  15450. }
  15451. $this->contents = $matches['start'] . $matches['end'];
  15452. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  15453. $this->contents = "{\n}";
  15454. }
  15455. return true;
  15456. }
  15457. return false;
  15458. }
  15459. public function format($data, $depth = 0)
  15460. {
  15461. if (is_array($data)) {
  15462. reset($data);
  15463. if (is_numeric(key($data))) {
  15464. foreach ($data as $key => $val) {
  15465. $data[$key] = $this->format($val, $depth + 1);
  15466. }
  15467. return '['.implode(', ', $data).']';
  15468. }
  15469. $out = '{' . $this->newline;
  15470. $elems = array();
  15471. foreach ($data as $key => $val) {
  15472. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  15473. }
  15474. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  15475. }
  15476. return JsonFile::encode($data);
  15477. }
  15478. protected function detectIndenting()
  15479. {
  15480. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  15481. $this->indent = $match[1];
  15482. } else {
  15483. $this->indent = ' ';
  15484. }
  15485. }
  15486. protected function pregMatch($re, $str, &$matches = array())
  15487. {
  15488. $count = preg_match($re, $str, $matches);
  15489. if ($count === false) {
  15490. switch (preg_last_error()) {
  15491. case PREG_NO_ERROR:
  15492. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  15493. case PREG_INTERNAL_ERROR:
  15494. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  15495. case PREG_BACKTRACK_LIMIT_ERROR:
  15496. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  15497. case PREG_RECURSION_LIMIT_ERROR:
  15498. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  15499. case PREG_BAD_UTF8_ERROR:
  15500. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  15501. case PREG_BAD_UTF8_OFFSET_ERROR:
  15502. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  15503. case 6:
  15504. if (PHP_VERSION_ID > 70000) {
  15505. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  15506. }
  15507. default:
  15508. throw new \RuntimeException('Failed to execute regex: Unknown error');
  15509. }
  15510. }
  15511. return $count;
  15512. }
  15513. }
  15514. <?php
  15515. namespace Composer\Json;
  15516. use Exception;
  15517. class JsonValidationException extends Exception
  15518. {
  15519. protected $errors;
  15520. public function __construct($message, $errors = array(), Exception $previous = null)
  15521. {
  15522. $this->errors = $errors;
  15523. parent::__construct($message, 0, $previous);
  15524. }
  15525. public function getErrors()
  15526. {
  15527. return $this->errors;
  15528. }
  15529. }
  15530. <?php
  15531. namespace Composer\Package;
  15532. use Composer\Semver\Constraint\Constraint;
  15533. use Composer\Package\Version\VersionParser;
  15534. class AliasPackage extends BasePackage implements CompletePackageInterface
  15535. {
  15536. protected $version;
  15537. protected $prettyVersion;
  15538. protected $dev;
  15539. protected $rootPackageAlias = false;
  15540. protected $stability;
  15541. protected $aliasOf;
  15542. protected $requires;
  15543. protected $devRequires;
  15544. protected $conflicts;
  15545. protected $provides;
  15546. protected $replaces;
  15547. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  15548. {
  15549. parent::__construct($aliasOf->getName());
  15550. $this->version = $version;
  15551. $this->prettyVersion = $prettyVersion;
  15552. $this->aliasOf = $aliasOf;
  15553. $this->stability = VersionParser::parseStability($version);
  15554. $this->dev = $this->stability === 'dev';
  15555. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  15556. $links = $aliasOf->{'get' . ucfirst($type)}();
  15557. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  15558. }
  15559. }
  15560. public function getAliasOf()
  15561. {
  15562. return $this->aliasOf;
  15563. }
  15564. public function getVersion()
  15565. {
  15566. return $this->version;
  15567. }
  15568. public function getStability()
  15569. {
  15570. return $this->stability;
  15571. }
  15572. public function getPrettyVersion()
  15573. {
  15574. return $this->prettyVersion;
  15575. }
  15576. public function isDev()
  15577. {
  15578. return $this->dev;
  15579. }
  15580. public function getRequires()
  15581. {
  15582. return $this->requires;
  15583. }
  15584. public function getConflicts()
  15585. {
  15586. return $this->conflicts;
  15587. }
  15588. public function getProvides()
  15589. {
  15590. return $this->provides;
  15591. }
  15592. public function getReplaces()
  15593. {
  15594. return $this->replaces;
  15595. }
  15596. public function getDevRequires()
  15597. {
  15598. return $this->devRequires;
  15599. }
  15600. public function setRootPackageAlias($value)
  15601. {
  15602. return $this->rootPackageAlias = $value;
  15603. }
  15604. public function isRootPackageAlias()
  15605. {
  15606. return $this->rootPackageAlias;
  15607. }
  15608. protected function replaceSelfVersionDependencies(array $links, $linkType)
  15609. {
  15610. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  15611. $newLinks = array();
  15612. foreach ($links as $link) {
  15613. if ('self.version' === $link->getPrettyConstraint()) {
  15614. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  15615. }
  15616. }
  15617. $links = array_merge($links, $newLinks);
  15618. } else {
  15619. foreach ($links as $index => $link) {
  15620. if ('self.version' === $link->getPrettyConstraint()) {
  15621. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  15622. }
  15623. }
  15624. }
  15625. return $links;
  15626. }
  15627. public function getType()
  15628. {
  15629. return $this->aliasOf->getType();
  15630. }
  15631. public function getTargetDir()
  15632. {
  15633. return $this->aliasOf->getTargetDir();
  15634. }
  15635. public function getExtra()
  15636. {
  15637. return $this->aliasOf->getExtra();
  15638. }
  15639. public function setInstallationSource($type)
  15640. {
  15641. $this->aliasOf->setInstallationSource($type);
  15642. }
  15643. public function getInstallationSource()
  15644. {
  15645. return $this->aliasOf->getInstallationSource();
  15646. }
  15647. public function getSourceType()
  15648. {
  15649. return $this->aliasOf->getSourceType();
  15650. }
  15651. public function getSourceUrl()
  15652. {
  15653. return $this->aliasOf->getSourceUrl();
  15654. }
  15655. public function getSourceUrls()
  15656. {
  15657. return $this->aliasOf->getSourceUrls();
  15658. }
  15659. public function getSourceReference()
  15660. {
  15661. return $this->aliasOf->getSourceReference();
  15662. }
  15663. public function setSourceReference($reference)
  15664. {
  15665. return $this->aliasOf->setSourceReference($reference);
  15666. }
  15667. public function setSourceMirrors($mirrors)
  15668. {
  15669. return $this->aliasOf->setSourceMirrors($mirrors);
  15670. }
  15671. public function getSourceMirrors()
  15672. {
  15673. return $this->aliasOf->getSourceMirrors();
  15674. }
  15675. public function getDistType()
  15676. {
  15677. return $this->aliasOf->getDistType();
  15678. }
  15679. public function getDistUrl()
  15680. {
  15681. return $this->aliasOf->getDistUrl();
  15682. }
  15683. public function getDistUrls()
  15684. {
  15685. return $this->aliasOf->getDistUrls();
  15686. }
  15687. public function getDistReference()
  15688. {
  15689. return $this->aliasOf->getDistReference();
  15690. }
  15691. public function setDistReference($reference)
  15692. {
  15693. return $this->aliasOf->setDistReference($reference);
  15694. }
  15695. public function getDistSha1Checksum()
  15696. {
  15697. return $this->aliasOf->getDistSha1Checksum();
  15698. }
  15699. public function setTransportOptions(array $options)
  15700. {
  15701. return $this->aliasOf->setTransportOptions($options);
  15702. }
  15703. public function getTransportOptions()
  15704. {
  15705. return $this->aliasOf->getTransportOptions();
  15706. }
  15707. public function setDistMirrors($mirrors)
  15708. {
  15709. return $this->aliasOf->setDistMirrors($mirrors);
  15710. }
  15711. public function getDistMirrors()
  15712. {
  15713. return $this->aliasOf->getDistMirrors();
  15714. }
  15715. public function getScripts()
  15716. {
  15717. return $this->aliasOf->getScripts();
  15718. }
  15719. public function getLicense()
  15720. {
  15721. return $this->aliasOf->getLicense();
  15722. }
  15723. public function getAutoload()
  15724. {
  15725. return $this->aliasOf->getAutoload();
  15726. }
  15727. public function getDevAutoload()
  15728. {
  15729. return $this->aliasOf->getDevAutoload();
  15730. }
  15731. public function getIncludePaths()
  15732. {
  15733. return $this->aliasOf->getIncludePaths();
  15734. }
  15735. public function getRepositories()
  15736. {
  15737. return $this->aliasOf->getRepositories();
  15738. }
  15739. public function getReleaseDate()
  15740. {
  15741. return $this->aliasOf->getReleaseDate();
  15742. }
  15743. public function getBinaries()
  15744. {
  15745. return $this->aliasOf->getBinaries();
  15746. }
  15747. public function getKeywords()
  15748. {
  15749. return $this->aliasOf->getKeywords();
  15750. }
  15751. public function getDescription()
  15752. {
  15753. return $this->aliasOf->getDescription();
  15754. }
  15755. public function getHomepage()
  15756. {
  15757. return $this->aliasOf->getHomepage();
  15758. }
  15759. public function getSuggests()
  15760. {
  15761. return $this->aliasOf->getSuggests();
  15762. }
  15763. public function getAuthors()
  15764. {
  15765. return $this->aliasOf->getAuthors();
  15766. }
  15767. public function getSupport()
  15768. {
  15769. return $this->aliasOf->getSupport();
  15770. }
  15771. public function getNotificationUrl()
  15772. {
  15773. return $this->aliasOf->getNotificationUrl();
  15774. }
  15775. public function getArchiveExcludes()
  15776. {
  15777. return $this->aliasOf->getArchiveExcludes();
  15778. }
  15779. public function isAbandoned()
  15780. {
  15781. return $this->aliasOf->isAbandoned();
  15782. }
  15783. public function getReplacementPackage()
  15784. {
  15785. return $this->aliasOf->getReplacementPackage();
  15786. }
  15787. public function __toString()
  15788. {
  15789. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  15790. }
  15791. }
  15792. <?php
  15793. namespace Composer\Package\Archiver;
  15794. use FilterIterator;
  15795. use PharData;
  15796. class ArchivableFilesFilter extends FilterIterator
  15797. {
  15798. private $dirs = array();
  15799. public function accept()
  15800. {
  15801. $file = $this->getInnerIterator()->current();
  15802. if ($file->isDir()) {
  15803. $this->dirs[] = (string) $file;
  15804. return false;
  15805. }
  15806. return true;
  15807. }
  15808. public function addEmptyDir(PharData $phar, $sources)
  15809. {
  15810. foreach ($this->dirs as $filepath) {
  15811. $localname = str_replace($sources . "/", '', $filepath);
  15812. $phar->addEmptyDir($localname);
  15813. }
  15814. }
  15815. }
  15816. <?php
  15817. namespace Composer\Package\Archiver;
  15818. use Composer\Util\Filesystem;
  15819. use FilesystemIterator;
  15820. use Symfony\Component\Finder\Finder;
  15821. use Symfony\Component\Finder\SplFileInfo;
  15822. class ArchivableFilesFinder extends \FilterIterator
  15823. {
  15824. protected $finder;
  15825. public function __construct($sources, array $excludes, $ignoreFilters = false)
  15826. {
  15827. $fs = new Filesystem();
  15828. $sources = $fs->normalizePath($sources);
  15829. if ($ignoreFilters) {
  15830. $filters = array();
  15831. } else {
  15832. $filters = array(
  15833. new HgExcludeFilter($sources),
  15834. new GitExcludeFilter($sources),
  15835. new ComposerExcludeFilter($sources, $excludes),
  15836. );
  15837. }
  15838. $this->finder = new Finder();
  15839. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  15840. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  15841. return false;
  15842. }
  15843. $relativePath = preg_replace(
  15844. '#^'.preg_quote($sources, '#').'#',
  15845. '',
  15846. $fs->normalizePath($file->getRealPath())
  15847. );
  15848. $exclude = false;
  15849. foreach ($filters as $filter) {
  15850. $exclude = $filter->filter($relativePath, $exclude);
  15851. }
  15852. return !$exclude;
  15853. };
  15854. if (method_exists($filter, 'bindTo')) {
  15855. $filter = $filter->bindTo(null);
  15856. }
  15857. $this->finder
  15858. ->in($sources)
  15859. ->filter($filter)
  15860. ->ignoreVCS(true)
  15861. ->ignoreDotFiles(false);
  15862. parent::__construct($this->finder->getIterator());
  15863. }
  15864. public function accept()
  15865. {
  15866. $current = $this->getInnerIterator()->current();
  15867. if (!$current->isDir()) {
  15868. return true;
  15869. }
  15870. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  15871. return !$iterator->valid();
  15872. }
  15873. }
  15874. <?php
  15875. namespace Composer\Package\Archiver;
  15876. use Composer\Downloader\DownloadManager;
  15877. use Composer\Package\PackageInterface;
  15878. use Composer\Package\RootPackageInterface;
  15879. use Composer\Util\Filesystem;
  15880. use Composer\Json\JsonFile;
  15881. class ArchiveManager
  15882. {
  15883. protected $downloadManager;
  15884. protected $archivers = array();
  15885. protected $overwriteFiles = true;
  15886. public function __construct(DownloadManager $downloadManager)
  15887. {
  15888. $this->downloadManager = $downloadManager;
  15889. }
  15890. public function addArchiver(ArchiverInterface $archiver)
  15891. {
  15892. $this->archivers[] = $archiver;
  15893. }
  15894. public function setOverwriteFiles($overwriteFiles)
  15895. {
  15896. $this->overwriteFiles = $overwriteFiles;
  15897. return $this;
  15898. }
  15899. public function getPackageFilename(PackageInterface $package)
  15900. {
  15901. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  15902. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  15903. $nameParts = array_merge($nameParts, array($package->getDistReference(), $package->getDistType()));
  15904. } else {
  15905. $nameParts = array_merge($nameParts, array($package->getPrettyVersion(), $package->getDistReference()));
  15906. }
  15907. if ($package->getSourceReference()) {
  15908. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  15909. }
  15910. $name = implode('-', array_filter($nameParts, function ($p) {
  15911. return !empty($p);
  15912. }));
  15913. return str_replace('/', '-', $name);
  15914. }
  15915. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  15916. {
  15917. if (empty($format)) {
  15918. throw new \InvalidArgumentException('Format must be specified');
  15919. }
  15920. $usableArchiver = null;
  15921. foreach ($this->archivers as $archiver) {
  15922. if ($archiver->supports($format, $package->getSourceType())) {
  15923. $usableArchiver = $archiver;
  15924. break;
  15925. }
  15926. }
  15927. if (null === $usableArchiver) {
  15928. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  15929. }
  15930. $filesystem = new Filesystem();
  15931. if (null === $fileName) {
  15932. $packageName = $this->getPackageFilename($package);
  15933. } else {
  15934. $packageName = $fileName;
  15935. }
  15936. $filesystem->ensureDirectoryExists($targetDir);
  15937. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  15938. $filesystem->ensureDirectoryExists(dirname($target));
  15939. if (!$this->overwriteFiles && file_exists($target)) {
  15940. return $target;
  15941. }
  15942. if ($package instanceof RootPackageInterface) {
  15943. $sourcePath = realpath('.');
  15944. } else {
  15945. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  15946. $filesystem->ensureDirectoryExists($sourcePath);
  15947. $this->downloadManager->download($package, $sourcePath);
  15948. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  15949. $jsonFile = new JsonFile($composerJsonPath);
  15950. $jsonData = $jsonFile->read();
  15951. if (!empty($jsonData['archive']['exclude'])) {
  15952. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  15953. }
  15954. }
  15955. }
  15956. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  15957. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  15958. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  15959. $filesystem->rename($archivePath, $target);
  15960. if (!$package instanceof RootPackageInterface) {
  15961. $filesystem->removeDirectory($sourcePath);
  15962. }
  15963. $filesystem->remove($tempTarget);
  15964. return $target;
  15965. }
  15966. }
  15967. <?php
  15968. namespace Composer\Package\Archiver;
  15969. interface ArchiverInterface
  15970. {
  15971. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  15972. public function supports($format, $sourceType);
  15973. }
  15974. <?php
  15975. namespace Composer\Package\Archiver;
  15976. use Symfony\Component\Finder;
  15977. abstract class BaseExcludeFilter
  15978. {
  15979. protected $sourcePath;
  15980. protected $excludePatterns;
  15981. public function __construct($sourcePath)
  15982. {
  15983. $this->sourcePath = $sourcePath;
  15984. $this->excludePatterns = array();
  15985. }
  15986. public function filter($relativePath, $exclude)
  15987. {
  15988. foreach ($this->excludePatterns as $patternData) {
  15989. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  15990. if ($stripLeadingSlash) {
  15991. $path = substr($relativePath, 1);
  15992. } else {
  15993. $path = $relativePath;
  15994. }
  15995. if (preg_match($pattern, $path)) {
  15996. $exclude = !$negate;
  15997. }
  15998. }
  15999. return $exclude;
  16000. }
  16001. protected function parseLines(array $lines, $lineParser)
  16002. {
  16003. return array_filter(
  16004. array_map(
  16005. function ($line) use ($lineParser) {
  16006. $line = trim($line);
  16007. if (!$line || 0 === strpos($line, '#')) {
  16008. return null;
  16009. }
  16010. return call_user_func($lineParser, $line);
  16011. },
  16012. $lines
  16013. ),
  16014. function ($pattern) {
  16015. return $pattern !== null;
  16016. }
  16017. );
  16018. }
  16019. protected function generatePatterns($rules)
  16020. {
  16021. $patterns = array();
  16022. foreach ($rules as $rule) {
  16023. $patterns[] = $this->generatePattern($rule);
  16024. }
  16025. return $patterns;
  16026. }
  16027. protected function generatePattern($rule)
  16028. {
  16029. $negate = false;
  16030. $pattern = '{';
  16031. if (strlen($rule) && $rule[0] === '!') {
  16032. $negate = true;
  16033. $rule = substr($rule, 1);
  16034. }
  16035. if (strlen($rule) && $rule[0] === '/') {
  16036. $pattern .= '^/';
  16037. $rule = substr($rule, 1);
  16038. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  16039. $pattern .= '/';
  16040. $rule = substr($rule, 0, -1);
  16041. } elseif (false === strpos($rule, '/')) {
  16042. $pattern .= '/';
  16043. }
  16044. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  16045. return array($pattern . '}', $negate, false);
  16046. }
  16047. }
  16048. <?php
  16049. namespace Composer\Package\Archiver;
  16050. class ComposerExcludeFilter extends BaseExcludeFilter
  16051. {
  16052. public function __construct($sourcePath, array $excludeRules)
  16053. {
  16054. parent::__construct($sourcePath);
  16055. $this->excludePatterns = $this->generatePatterns($excludeRules);
  16056. }
  16057. }
  16058. <?php
  16059. namespace Composer\Package\Archiver;
  16060. class GitExcludeFilter extends BaseExcludeFilter
  16061. {
  16062. public function __construct($sourcePath)
  16063. {
  16064. parent::__construct($sourcePath);
  16065. if (file_exists($sourcePath.'/.gitignore')) {
  16066. $this->excludePatterns = $this->parseLines(
  16067. file($sourcePath.'/.gitignore'),
  16068. array($this, 'parseGitIgnoreLine')
  16069. );
  16070. }
  16071. if (file_exists($sourcePath.'/.gitattributes')) {
  16072. $this->excludePatterns = array_merge(
  16073. $this->excludePatterns,
  16074. $this->parseLines(
  16075. file($sourcePath.'/.gitattributes'),
  16076. array($this, 'parseGitAttributesLine')
  16077. ));
  16078. }
  16079. }
  16080. public function parseGitIgnoreLine($line)
  16081. {
  16082. return $this->generatePattern($line);
  16083. }
  16084. public function parseGitAttributesLine($line)
  16085. {
  16086. $parts = preg_split('#\s+#', $line);
  16087. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  16088. return $this->generatePattern($parts[0]);
  16089. }
  16090. return null;
  16091. }
  16092. }
  16093. <?php
  16094. namespace Composer\Package\Archiver;
  16095. use Symfony\Component\Finder;
  16096. class HgExcludeFilter extends BaseExcludeFilter
  16097. {
  16098. const HG_IGNORE_REGEX = 1;
  16099. const HG_IGNORE_GLOB = 2;
  16100. protected $patternMode;
  16101. public function __construct($sourcePath)
  16102. {
  16103. parent::__construct($sourcePath);
  16104. $this->patternMode = self::HG_IGNORE_REGEX;
  16105. if (file_exists($sourcePath.'/.hgignore')) {
  16106. $this->excludePatterns = $this->parseLines(
  16107. file($sourcePath.'/.hgignore'),
  16108. array($this, 'parseHgIgnoreLine')
  16109. );
  16110. }
  16111. }
  16112. public function parseHgIgnoreLine($line)
  16113. {
  16114. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  16115. if ($matches[1] === 'glob') {
  16116. $this->patternMode = self::HG_IGNORE_GLOB;
  16117. } else {
  16118. $this->patternMode = self::HG_IGNORE_REGEX;
  16119. }
  16120. return null;
  16121. }
  16122. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  16123. return $this->patternFromGlob($line);
  16124. }
  16125. return $this->patternFromRegex($line);
  16126. }
  16127. protected function patternFromGlob($line)
  16128. {
  16129. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  16130. $pattern = str_replace('[^/]*', '.*', $pattern);
  16131. return array($pattern, false, true);
  16132. }
  16133. public function patternFromRegex($line)
  16134. {
  16135. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  16136. return array($pattern, false, true);
  16137. }
  16138. }
  16139. <?php
  16140. namespace Composer\Package\Archiver;
  16141. class PharArchiver implements ArchiverInterface
  16142. {
  16143. protected static $formats = array(
  16144. 'zip' => \Phar::ZIP,
  16145. 'tar' => \Phar::TAR,
  16146. 'tar.gz' => \Phar::TAR,
  16147. 'tar.bz2' => \Phar::TAR,
  16148. );
  16149. protected static $compressFormats = array(
  16150. 'tar.gz' => \Phar::GZ,
  16151. 'tar.bz2' => \Phar::BZ2,
  16152. );
  16153. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16154. {
  16155. $sources = realpath($sources);
  16156. if (file_exists($target)) {
  16157. unlink($target);
  16158. }
  16159. try {
  16160. $filename = substr($target, 0, strrpos($target, $format) - 1);
  16161. if (isset(static::$compressFormats[$format])) {
  16162. $target = $filename . '.tar';
  16163. }
  16164. $phar = new \PharData($target, null, null, static::$formats[$format]);
  16165. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16166. $filesOnly = new ArchivableFilesFilter($files);
  16167. $phar->buildFromIterator($filesOnly, $sources);
  16168. $filesOnly->addEmptyDir($phar, $sources);
  16169. if (isset(static::$compressFormats[$format])) {
  16170. if (!$phar->canCompress(static::$compressFormats[$format])) {
  16171. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  16172. }
  16173. unlink($target);
  16174. $phar->compress(static::$compressFormats[$format]);
  16175. $target = $filename . '.' . $format;
  16176. }
  16177. return $target;
  16178. } catch (\UnexpectedValueException $e) {
  16179. $message = sprintf("Could not create archive '%s' from '%s': %s",
  16180. $target,
  16181. $sources,
  16182. $e->getMessage()
  16183. );
  16184. throw new \RuntimeException($message, $e->getCode(), $e);
  16185. }
  16186. }
  16187. public function supports($format, $sourceType)
  16188. {
  16189. return isset(static::$formats[$format]);
  16190. }
  16191. }
  16192. <?php
  16193. namespace Composer\Package\Archiver;
  16194. use ZipArchive;
  16195. use Composer\Util\Filesystem;
  16196. class ZipArchiver implements ArchiverInterface
  16197. {
  16198. protected static $formats = array(
  16199. 'zip' => 1,
  16200. );
  16201. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16202. {
  16203. $fs = new Filesystem();
  16204. $sources = $fs->normalizePath($sources);
  16205. $zip = new ZipArchive();
  16206. $res = $zip->open($target, ZipArchive::CREATE);
  16207. if ($res === true) {
  16208. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16209. foreach ($files as $file) {
  16210. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  16211. $localname = str_replace($sources.'/', '', $filepath);
  16212. if ($file->isDir()) {
  16213. $zip->addEmptyDir($localname);
  16214. } else {
  16215. $zip->addFile($filepath, $localname);
  16216. }
  16217. }
  16218. if ($zip->close()) {
  16219. return $target;
  16220. }
  16221. }
  16222. $message = sprintf("Could not create archive '%s' from '%s': %s",
  16223. $target,
  16224. $sources,
  16225. $zip->getStatusString()
  16226. );
  16227. throw new \RuntimeException($message);
  16228. }
  16229. public function supports($format, $sourceType)
  16230. {
  16231. return isset(static::$formats[$format]) && $this->compressionAvailable();
  16232. }
  16233. private function compressionAvailable()
  16234. {
  16235. return class_exists('ZipArchive');
  16236. }
  16237. }
  16238. <?php
  16239. namespace Composer\Package;
  16240. use Composer\Repository\RepositoryInterface;
  16241. use Composer\Repository\PlatformRepository;
  16242. abstract class BasePackage implements PackageInterface
  16243. {
  16244. public static $supportedLinkTypes = array(
  16245. 'require' => array('description' => 'requires', 'method' => 'requires'),
  16246. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  16247. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  16248. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  16249. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  16250. );
  16251. const STABILITY_STABLE = 0;
  16252. const STABILITY_RC = 5;
  16253. const STABILITY_BETA = 10;
  16254. const STABILITY_ALPHA = 15;
  16255. const STABILITY_DEV = 20;
  16256. public static $stabilities = array(
  16257. 'stable' => self::STABILITY_STABLE,
  16258. 'RC' => self::STABILITY_RC,
  16259. 'beta' => self::STABILITY_BETA,
  16260. 'alpha' => self::STABILITY_ALPHA,
  16261. 'dev' => self::STABILITY_DEV,
  16262. );
  16263. public $id;
  16264. protected $name;
  16265. protected $prettyName;
  16266. protected $repository;
  16267. protected $transportOptions = array();
  16268. public function __construct($name)
  16269. {
  16270. $this->prettyName = $name;
  16271. $this->name = strtolower($name);
  16272. $this->id = -1;
  16273. }
  16274. public function getName()
  16275. {
  16276. return $this->name;
  16277. }
  16278. public function getPrettyName()
  16279. {
  16280. return $this->prettyName;
  16281. }
  16282. public function getNames()
  16283. {
  16284. $names = array(
  16285. $this->getName() => true,
  16286. );
  16287. foreach ($this->getProvides() as $link) {
  16288. $names[$link->getTarget()] = true;
  16289. }
  16290. foreach ($this->getReplaces() as $link) {
  16291. $names[$link->getTarget()] = true;
  16292. }
  16293. return array_keys($names);
  16294. }
  16295. public function setId($id)
  16296. {
  16297. $this->id = $id;
  16298. }
  16299. public function getId()
  16300. {
  16301. return $this->id;
  16302. }
  16303. public function setRepository(RepositoryInterface $repository)
  16304. {
  16305. if ($this->repository && $repository !== $this->repository) {
  16306. throw new \LogicException('A package can only be added to one repository');
  16307. }
  16308. $this->repository = $repository;
  16309. }
  16310. public function getRepository()
  16311. {
  16312. return $this->repository;
  16313. }
  16314. public function getTransportOptions()
  16315. {
  16316. return $this->transportOptions;
  16317. }
  16318. public function setTransportOptions(array $options)
  16319. {
  16320. $this->transportOptions = $options;
  16321. }
  16322. public function isPlatform()
  16323. {
  16324. return $this->getRepository() instanceof PlatformRepository;
  16325. }
  16326. public function getUniqueName()
  16327. {
  16328. return $this->getName().'-'.$this->getVersion();
  16329. }
  16330. public function equals(PackageInterface $package)
  16331. {
  16332. $self = $this;
  16333. if ($this instanceof AliasPackage) {
  16334. $self = $this->getAliasOf();
  16335. }
  16336. if ($package instanceof AliasPackage) {
  16337. $package = $package->getAliasOf();
  16338. }
  16339. return $package === $self;
  16340. }
  16341. public function __toString()
  16342. {
  16343. return $this->getUniqueName();
  16344. }
  16345. public function getPrettyString()
  16346. {
  16347. return $this->getPrettyName().' '.$this->getPrettyVersion();
  16348. }
  16349. public function getFullPrettyVersion($truncate = true)
  16350. {
  16351. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  16352. return $this->getPrettyVersion();
  16353. }
  16354. if ($truncate && strlen($this->getSourceReference()) === 40) {
  16355. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  16356. }
  16357. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  16358. }
  16359. public function getStabilityPriority()
  16360. {
  16361. return self::$stabilities[$this->getStability()];
  16362. }
  16363. public function __clone()
  16364. {
  16365. $this->repository = null;
  16366. $this->id = -1;
  16367. }
  16368. }
  16369. <?php
  16370. namespace Composer\Package;
  16371. class CompletePackage extends Package implements CompletePackageInterface
  16372. {
  16373. protected $repositories;
  16374. protected $license = array();
  16375. protected $keywords;
  16376. protected $authors;
  16377. protected $description;
  16378. protected $homepage;
  16379. protected $scripts = array();
  16380. protected $support = array();
  16381. protected $abandoned = false;
  16382. public function setScripts(array $scripts)
  16383. {
  16384. $this->scripts = $scripts;
  16385. }
  16386. public function getScripts()
  16387. {
  16388. return $this->scripts;
  16389. }
  16390. public function setRepositories($repositories)
  16391. {
  16392. $this->repositories = $repositories;
  16393. }
  16394. public function getRepositories()
  16395. {
  16396. return $this->repositories;
  16397. }
  16398. public function setLicense(array $license)
  16399. {
  16400. $this->license = $license;
  16401. }
  16402. public function getLicense()
  16403. {
  16404. return $this->license;
  16405. }
  16406. public function setKeywords(array $keywords)
  16407. {
  16408. $this->keywords = $keywords;
  16409. }
  16410. public function getKeywords()
  16411. {
  16412. return $this->keywords;
  16413. }
  16414. public function setAuthors(array $authors)
  16415. {
  16416. $this->authors = $authors;
  16417. }
  16418. public function getAuthors()
  16419. {
  16420. return $this->authors;
  16421. }
  16422. public function setDescription($description)
  16423. {
  16424. $this->description = $description;
  16425. }
  16426. public function getDescription()
  16427. {
  16428. return $this->description;
  16429. }
  16430. public function setHomepage($homepage)
  16431. {
  16432. $this->homepage = $homepage;
  16433. }
  16434. public function getHomepage()
  16435. {
  16436. return $this->homepage;
  16437. }
  16438. public function setSupport(array $support)
  16439. {
  16440. $this->support = $support;
  16441. }
  16442. public function getSupport()
  16443. {
  16444. return $this->support;
  16445. }
  16446. public function isAbandoned()
  16447. {
  16448. return (bool) $this->abandoned;
  16449. }
  16450. public function setAbandoned($abandoned)
  16451. {
  16452. $this->abandoned = $abandoned;
  16453. }
  16454. public function getReplacementPackage()
  16455. {
  16456. return is_string($this->abandoned) ? $this->abandoned : null;
  16457. }
  16458. }
  16459. <?php
  16460. namespace Composer\Package;
  16461. interface CompletePackageInterface extends PackageInterface
  16462. {
  16463. public function getScripts();
  16464. public function getRepositories();
  16465. public function getLicense();
  16466. public function getKeywords();
  16467. public function getDescription();
  16468. public function getHomepage();
  16469. public function getAuthors();
  16470. public function getSupport();
  16471. public function isAbandoned();
  16472. public function getReplacementPackage();
  16473. }
  16474. <?php
  16475. namespace Composer\Package\Dumper;
  16476. use Composer\Package\BasePackage;
  16477. use Composer\Package\PackageInterface;
  16478. use Composer\Package\CompletePackageInterface;
  16479. use Composer\Package\RootPackageInterface;
  16480. class ArrayDumper
  16481. {
  16482. public function dump(PackageInterface $package)
  16483. {
  16484. $keys = array(
  16485. 'binaries' => 'bin',
  16486. 'type',
  16487. 'extra',
  16488. 'installationSource' => 'installation-source',
  16489. 'autoload',
  16490. 'devAutoload' => 'autoload-dev',
  16491. 'notificationUrl' => 'notification-url',
  16492. 'includePaths' => 'include-path',
  16493. );
  16494. $data = array();
  16495. $data['name'] = $package->getPrettyName();
  16496. $data['version'] = $package->getPrettyVersion();
  16497. $data['version_normalized'] = $package->getVersion();
  16498. if ($package->getTargetDir()) {
  16499. $data['target-dir'] = $package->getTargetDir();
  16500. }
  16501. if ($package->getSourceType()) {
  16502. $data['source']['type'] = $package->getSourceType();
  16503. $data['source']['url'] = $package->getSourceUrl();
  16504. $data['source']['reference'] = $package->getSourceReference();
  16505. if ($mirrors = $package->getSourceMirrors()) {
  16506. $data['source']['mirrors'] = $mirrors;
  16507. }
  16508. }
  16509. if ($package->getDistType()) {
  16510. $data['dist']['type'] = $package->getDistType();
  16511. $data['dist']['url'] = $package->getDistUrl();
  16512. $data['dist']['reference'] = $package->getDistReference();
  16513. $data['dist']['shasum'] = $package->getDistSha1Checksum();
  16514. if ($mirrors = $package->getDistMirrors()) {
  16515. $data['dist']['mirrors'] = $mirrors;
  16516. }
  16517. }
  16518. if ($package->getArchiveExcludes()) {
  16519. $data['archive']['exclude'] = $package->getArchiveExcludes();
  16520. }
  16521. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  16522. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  16523. foreach ($links as $link) {
  16524. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  16525. }
  16526. ksort($data[$type]);
  16527. }
  16528. }
  16529. if ($packages = $package->getSuggests()) {
  16530. ksort($packages);
  16531. $data['suggest'] = $packages;
  16532. }
  16533. if ($package->getReleaseDate()) {
  16534. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  16535. }
  16536. $data = $this->dumpValues($package, $keys, $data);
  16537. if ($package instanceof CompletePackageInterface) {
  16538. $keys = array(
  16539. 'scripts',
  16540. 'license',
  16541. 'authors',
  16542. 'description',
  16543. 'homepage',
  16544. 'keywords',
  16545. 'repositories',
  16546. 'support',
  16547. );
  16548. $data = $this->dumpValues($package, $keys, $data);
  16549. if (isset($data['keywords']) && is_array($data['keywords'])) {
  16550. sort($data['keywords']);
  16551. }
  16552. if ($package->isAbandoned()) {
  16553. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  16554. }
  16555. }
  16556. if ($package instanceof RootPackageInterface) {
  16557. $minimumStability = $package->getMinimumStability();
  16558. if ($minimumStability) {
  16559. $data['minimum-stability'] = $minimumStability;
  16560. }
  16561. }
  16562. if (count($package->getTransportOptions()) > 0) {
  16563. $data['transport-options'] = $package->getTransportOptions();
  16564. }
  16565. return $data;
  16566. }
  16567. private function dumpValues(PackageInterface $package, array $keys, array $data)
  16568. {
  16569. foreach ($keys as $method => $key) {
  16570. if (is_numeric($method)) {
  16571. $method = $key;
  16572. }
  16573. $getter = 'get'.ucfirst($method);
  16574. $value = $package->$getter();
  16575. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  16576. $data[$key] = $value;
  16577. }
  16578. }
  16579. return $data;
  16580. }
  16581. }
  16582. <?php
  16583. namespace Composer\Package;
  16584. use Composer\Semver\Constraint\ConstraintInterface;
  16585. class Link
  16586. {
  16587. protected $source;
  16588. protected $target;
  16589. protected $constraint;
  16590. protected $description;
  16591. protected $prettyConstraint;
  16592. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  16593. {
  16594. $this->source = strtolower($source);
  16595. $this->target = strtolower($target);
  16596. $this->constraint = $constraint;
  16597. $this->description = $description;
  16598. $this->prettyConstraint = $prettyConstraint;
  16599. }
  16600. public function getDescription()
  16601. {
  16602. return $this->description;
  16603. }
  16604. public function getSource()
  16605. {
  16606. return $this->source;
  16607. }
  16608. public function getTarget()
  16609. {
  16610. return $this->target;
  16611. }
  16612. public function getConstraint()
  16613. {
  16614. return $this->constraint;
  16615. }
  16616. public function getPrettyConstraint()
  16617. {
  16618. if (null === $this->prettyConstraint) {
  16619. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  16620. }
  16621. return $this->prettyConstraint;
  16622. }
  16623. public function __toString()
  16624. {
  16625. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  16626. }
  16627. public function getPrettyString(PackageInterface $sourcePackage)
  16628. {
  16629. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  16630. }
  16631. }
  16632. <?php
  16633. namespace Composer\Package\LinkConstraint;
  16634. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  16635. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  16636. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  16637. {
  16638. }
  16639. <?php
  16640. namespace Composer\Package\LinkConstraint;
  16641. use Composer\Semver\Constraint\ConstraintInterface;
  16642. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  16643. interface LinkConstraintInterface extends ConstraintInterface
  16644. {
  16645. }
  16646. <?php
  16647. namespace Composer\Package\LinkConstraint;
  16648. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  16649. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  16650. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  16651. {
  16652. }
  16653. <?php
  16654. namespace Composer\Package\LinkConstraint;
  16655. use Composer\Semver\Constraint\AbstractConstraint;
  16656. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  16657. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  16658. {
  16659. }
  16660. <?php
  16661. namespace Composer\Package\LinkConstraint;
  16662. use Composer\Semver\Constraint\Constraint;
  16663. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  16664. class VersionConstraint extends Constraint implements LinkConstraintInterface
  16665. {
  16666. }
  16667. <?php
  16668. namespace Composer\Package\Loader;
  16669. use Composer\Package;
  16670. use Composer\Package\AliasPackage;
  16671. use Composer\Package\Link;
  16672. use Composer\Package\RootAliasPackage;
  16673. use Composer\Package\RootPackageInterface;
  16674. use Composer\Package\Version\VersionParser;
  16675. use Composer\Semver\VersionParser as SemverVersionParser;
  16676. class ArrayLoader implements LoaderInterface
  16677. {
  16678. protected $versionParser;
  16679. protected $loadOptions;
  16680. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  16681. {
  16682. if (!$parser) {
  16683. $parser = new VersionParser;
  16684. }
  16685. $this->versionParser = $parser;
  16686. $this->loadOptions = $loadOptions;
  16687. }
  16688. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  16689. {
  16690. if (!isset($config['name'])) {
  16691. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  16692. }
  16693. if (!isset($config['version'])) {
  16694. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  16695. }
  16696. if (isset($config['version_normalized'])) {
  16697. $version = $config['version_normalized'];
  16698. } else {
  16699. $version = $this->versionParser->normalize($config['version']);
  16700. }
  16701. $package = new $class($config['name'], $version, $config['version']);
  16702. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  16703. if (isset($config['target-dir'])) {
  16704. $package->setTargetDir($config['target-dir']);
  16705. }
  16706. if (isset($config['extra']) && is_array($config['extra'])) {
  16707. $package->setExtra($config['extra']);
  16708. }
  16709. if (isset($config['bin'])) {
  16710. foreach ((array) $config['bin'] as $key => $bin) {
  16711. $config['bin'][$key] = ltrim($bin, '/');
  16712. }
  16713. $package->setBinaries((array) $config['bin']);
  16714. }
  16715. if (isset($config['installation-source'])) {
  16716. $package->setInstallationSource($config['installation-source']);
  16717. }
  16718. if (isset($config['source'])) {
  16719. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  16720. throw new \UnexpectedValueException(sprintf(
  16721. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  16722. $config['name'],
  16723. json_encode($config['source'])
  16724. ));
  16725. }
  16726. $package->setSourceType($config['source']['type']);
  16727. $package->setSourceUrl($config['source']['url']);
  16728. $package->setSourceReference($config['source']['reference']);
  16729. if (isset($config['source']['mirrors'])) {
  16730. $package->setSourceMirrors($config['source']['mirrors']);
  16731. }
  16732. }
  16733. if (isset($config['dist'])) {
  16734. if (!isset($config['dist']['type'])
  16735. || !isset($config['dist']['url'])) {
  16736. throw new \UnexpectedValueException(sprintf(
  16737. "Package %s's dist key should be specified as ".
  16738. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  16739. $config['name'],
  16740. json_encode($config['dist'])
  16741. ));
  16742. }
  16743. $package->setDistType($config['dist']['type']);
  16744. $package->setDistUrl($config['dist']['url']);
  16745. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  16746. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  16747. if (isset($config['dist']['mirrors'])) {
  16748. $package->setDistMirrors($config['dist']['mirrors']);
  16749. }
  16750. }
  16751. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  16752. if (isset($config[$type])) {
  16753. $method = 'set'.ucfirst($opts['method']);
  16754. $package->{$method}(
  16755. $this->parseLinks(
  16756. $package->getName(),
  16757. $package->getPrettyVersion(),
  16758. $opts['description'],
  16759. $config[$type]
  16760. )
  16761. );
  16762. }
  16763. }
  16764. if (isset($config['suggest']) && is_array($config['suggest'])) {
  16765. foreach ($config['suggest'] as $target => $reason) {
  16766. if ('self.version' === trim($reason)) {
  16767. $config['suggest'][$target] = $package->getPrettyVersion();
  16768. }
  16769. }
  16770. $package->setSuggests($config['suggest']);
  16771. }
  16772. if (isset($config['autoload'])) {
  16773. $package->setAutoload($config['autoload']);
  16774. }
  16775. if (isset($config['autoload-dev'])) {
  16776. $package->setDevAutoload($config['autoload-dev']);
  16777. }
  16778. if (isset($config['include-path'])) {
  16779. $package->setIncludePaths($config['include-path']);
  16780. }
  16781. if (!empty($config['time'])) {
  16782. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  16783. try {
  16784. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  16785. $package->setReleaseDate($date);
  16786. } catch (\Exception $e) {
  16787. }
  16788. }
  16789. if (!empty($config['notification-url'])) {
  16790. $package->setNotificationUrl($config['notification-url']);
  16791. }
  16792. if (!empty($config['archive']['exclude'])) {
  16793. $package->setArchiveExcludes($config['archive']['exclude']);
  16794. }
  16795. if ($package instanceof Package\CompletePackageInterface) {
  16796. if (isset($config['scripts']) && is_array($config['scripts'])) {
  16797. foreach ($config['scripts'] as $event => $listeners) {
  16798. $config['scripts'][$event] = (array) $listeners;
  16799. }
  16800. if (isset($config['scripts']['composer'])) {
  16801. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  16802. }
  16803. $package->setScripts($config['scripts']);
  16804. }
  16805. if (!empty($config['description']) && is_string($config['description'])) {
  16806. $package->setDescription($config['description']);
  16807. }
  16808. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  16809. $package->setHomepage($config['homepage']);
  16810. }
  16811. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  16812. $package->setKeywords($config['keywords']);
  16813. }
  16814. if (!empty($config['license'])) {
  16815. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  16816. }
  16817. if (!empty($config['authors']) && is_array($config['authors'])) {
  16818. $package->setAuthors($config['authors']);
  16819. }
  16820. if (isset($config['support'])) {
  16821. $package->setSupport($config['support']);
  16822. }
  16823. if (isset($config['abandoned'])) {
  16824. $package->setAbandoned($config['abandoned']);
  16825. }
  16826. }
  16827. if ($aliasNormalized = $this->getBranchAlias($config)) {
  16828. if ($package instanceof RootPackageInterface) {
  16829. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  16830. } else {
  16831. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  16832. }
  16833. }
  16834. if ($this->loadOptions && isset($config['transport-options'])) {
  16835. $package->setTransportOptions($config['transport-options']);
  16836. }
  16837. return $package;
  16838. }
  16839. public function parseLinks($source, $sourceVersion, $description, $links)
  16840. {
  16841. $res = array();
  16842. foreach ($links as $target => $constraint) {
  16843. if (!is_string($constraint)) {
  16844. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  16845. }
  16846. if ('self.version' === $constraint) {
  16847. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  16848. } else {
  16849. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  16850. }
  16851. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  16852. }
  16853. return $res;
  16854. }
  16855. public function getBranchAlias(array $config)
  16856. {
  16857. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  16858. || !isset($config['extra']['branch-alias'])
  16859. || !is_array($config['extra']['branch-alias'])
  16860. ) {
  16861. return;
  16862. }
  16863. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  16864. if ('-dev' !== substr($targetBranch, -4)) {
  16865. continue;
  16866. }
  16867. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  16868. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  16869. continue;
  16870. }
  16871. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  16872. continue;
  16873. }
  16874. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  16875. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  16876. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  16877. ) {
  16878. continue;
  16879. }
  16880. return $validatedTargetBranch;
  16881. }
  16882. }
  16883. }
  16884. <?php
  16885. namespace Composer\Package\Loader;
  16886. class InvalidPackageException extends \Exception
  16887. {
  16888. private $errors;
  16889. private $warnings;
  16890. private $data;
  16891. public function __construct(array $errors, array $warnings, array $data)
  16892. {
  16893. $this->errors = $errors;
  16894. $this->warnings = $warnings;
  16895. $this->data = $data;
  16896. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  16897. }
  16898. public function getData()
  16899. {
  16900. return $this->data;
  16901. }
  16902. public function getErrors()
  16903. {
  16904. return $this->errors;
  16905. }
  16906. public function getWarnings()
  16907. {
  16908. return $this->warnings;
  16909. }
  16910. }
  16911. <?php
  16912. namespace Composer\Package\Loader;
  16913. use Composer\Json\JsonFile;
  16914. class JsonLoader
  16915. {
  16916. private $loader;
  16917. public function __construct(LoaderInterface $loader)
  16918. {
  16919. $this->loader = $loader;
  16920. }
  16921. public function load($json)
  16922. {
  16923. if ($json instanceof JsonFile) {
  16924. $config = $json->read();
  16925. } elseif (file_exists($json)) {
  16926. $config = JsonFile::parseJson(file_get_contents($json), $json);
  16927. } elseif (is_string($json)) {
  16928. $config = JsonFile::parseJson($json);
  16929. }
  16930. return $this->loader->load($config);
  16931. }
  16932. }
  16933. <?php
  16934. namespace Composer\Package\Loader;
  16935. interface LoaderInterface
  16936. {
  16937. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  16938. }
  16939. <?php
  16940. namespace Composer\Package\Loader;
  16941. use Composer\Package\BasePackage;
  16942. use Composer\Package\AliasPackage;
  16943. use Composer\Config;
  16944. use Composer\Package\RootPackageInterface;
  16945. use Composer\Repository\RepositoryFactory;
  16946. use Composer\Package\Version\VersionGuesser;
  16947. use Composer\Package\Version\VersionParser;
  16948. use Composer\Repository\RepositoryManager;
  16949. use Composer\Util\ProcessExecutor;
  16950. class RootPackageLoader extends ArrayLoader
  16951. {
  16952. private $manager;
  16953. private $config;
  16954. private $versionGuesser;
  16955. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null)
  16956. {
  16957. parent::__construct($parser);
  16958. $this->manager = $manager;
  16959. $this->config = $config;
  16960. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  16961. }
  16962. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  16963. {
  16964. if (!isset($config['name'])) {
  16965. $config['name'] = '__root__';
  16966. }
  16967. $autoVersioned = false;
  16968. if (!isset($config['version'])) {
  16969. $commit = null;
  16970. if (getenv('COMPOSER_ROOT_VERSION')) {
  16971. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  16972. } else {
  16973. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  16974. if ($versionData) {
  16975. $config['version'] = $versionData['pretty_version'];
  16976. $config['version_normalized'] = $versionData['version'];
  16977. $commit = $versionData['commit'];
  16978. }
  16979. }
  16980. if (!isset($config['version'])) {
  16981. $config['version'] = '1.0.0';
  16982. $autoVersioned = true;
  16983. }
  16984. if ($commit) {
  16985. $config['source'] = array(
  16986. 'type' => '',
  16987. 'url' => '',
  16988. 'reference' => $commit,
  16989. );
  16990. $config['dist'] = array(
  16991. 'type' => '',
  16992. 'url' => '',
  16993. 'reference' => $commit,
  16994. );
  16995. }
  16996. }
  16997. $realPackage = $package = parent::load($config, $class);
  16998. if ($realPackage instanceof AliasPackage) {
  16999. $realPackage = $package->getAliasOf();
  17000. }
  17001. if ($autoVersioned) {
  17002. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  17003. }
  17004. if (isset($config['minimum-stability'])) {
  17005. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  17006. }
  17007. $aliases = array();
  17008. $stabilityFlags = array();
  17009. $references = array();
  17010. foreach (array('require', 'require-dev') as $linkType) {
  17011. if (isset($config[$linkType])) {
  17012. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  17013. $method = 'get'.ucfirst($linkInfo['method']);
  17014. $links = array();
  17015. foreach ($realPackage->$method() as $link) {
  17016. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  17017. }
  17018. $aliases = $this->extractAliases($links, $aliases);
  17019. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  17020. $references = $this->extractReferences($links, $references);
  17021. }
  17022. }
  17023. if (isset($links[$config['name']])) {
  17024. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  17025. 'Did you accidentally name your root package after an external package?', $config['name']));
  17026. }
  17027. $realPackage->setAliases($aliases);
  17028. $realPackage->setStabilityFlags($stabilityFlags);
  17029. $realPackage->setReferences($references);
  17030. if (isset($config['prefer-stable'])) {
  17031. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  17032. }
  17033. if (isset($config['config'])) {
  17034. $realPackage->setConfig($config['config']);
  17035. }
  17036. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  17037. foreach ($repos as $repo) {
  17038. $this->manager->addRepository($repo);
  17039. }
  17040. $realPackage->setRepositories($this->config->getRepositories());
  17041. return $package;
  17042. }
  17043. private function extractAliases(array $requires, array $aliases)
  17044. {
  17045. foreach ($requires as $reqName => $reqVersion) {
  17046. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  17047. $aliases[] = array(
  17048. 'package' => strtolower($reqName),
  17049. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  17050. 'alias' => $match[2],
  17051. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  17052. );
  17053. }
  17054. }
  17055. return $aliases;
  17056. }
  17057. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  17058. {
  17059. $stabilities = BasePackage::$stabilities;
  17060. $minimumStability = $stabilities[$minimumStability];
  17061. foreach ($requires as $reqName => $reqVersion) {
  17062. $constraints = array();
  17063. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  17064. foreach ($orSplit as $orConstraint) {
  17065. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  17066. foreach ($andSplit as $andConstraint) {
  17067. $constraints[] = $andConstraint;
  17068. }
  17069. }
  17070. $match = false;
  17071. foreach ($constraints as $constraint) {
  17072. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  17073. $name = strtolower($reqName);
  17074. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  17075. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  17076. continue;
  17077. }
  17078. $stabilityFlags[$name] = $stability;
  17079. $match = true;
  17080. }
  17081. }
  17082. if ($match) {
  17083. continue;
  17084. }
  17085. foreach ($constraints as $constraint) {
  17086. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  17087. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  17088. $name = strtolower($reqName);
  17089. $stability = $stabilities[$stabilityName];
  17090. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  17091. continue;
  17092. }
  17093. $stabilityFlags[$name] = $stability;
  17094. }
  17095. }
  17096. }
  17097. return $stabilityFlags;
  17098. }
  17099. private function extractReferences(array $requires, array $references)
  17100. {
  17101. foreach ($requires as $reqName => $reqVersion) {
  17102. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  17103. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === ($stabilityName = VersionParser::parseStability($reqVersion))) {
  17104. $name = strtolower($reqName);
  17105. $references[$name] = $match[1];
  17106. }
  17107. }
  17108. return $references;
  17109. }
  17110. }
  17111. <?php
  17112. namespace Composer\Package\Loader;
  17113. use Composer\Package;
  17114. use Composer\Package\BasePackage;
  17115. use Composer\Semver\Constraint\Constraint;
  17116. use Composer\Package\Version\VersionParser;
  17117. use Composer\Repository\PlatformRepository;
  17118. use Composer\Spdx\SpdxLicenses;
  17119. class ValidatingArrayLoader implements LoaderInterface
  17120. {
  17121. const CHECK_ALL = 3;
  17122. const CHECK_UNBOUND_CONSTRAINTS = 1;
  17123. const CHECK_STRICT_CONSTRAINTS = 2;
  17124. private $loader;
  17125. private $versionParser;
  17126. private $errors;
  17127. private $warnings;
  17128. private $config;
  17129. private $strictName;
  17130. private $flags;
  17131. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  17132. {
  17133. $this->loader = $loader;
  17134. $this->versionParser = $parser ?: new VersionParser();
  17135. $this->strictName = $strictName;
  17136. $this->flags = $flags;
  17137. }
  17138. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17139. {
  17140. $this->errors = array();
  17141. $this->warnings = array();
  17142. $this->config = $config;
  17143. if ($this->strictName) {
  17144. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  17145. } else {
  17146. $this->validateString('name', true);
  17147. }
  17148. if (!empty($this->config['version'])) {
  17149. try {
  17150. $this->versionParser->normalize($this->config['version']);
  17151. } catch (\Exception $e) {
  17152. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  17153. unset($this->config['version']);
  17154. }
  17155. }
  17156. if (!empty($this->config['config']['platform'])) {
  17157. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  17158. try {
  17159. $this->versionParser->normalize($platform);
  17160. } catch (\Exception $e) {
  17161. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  17162. }
  17163. }
  17164. }
  17165. $this->validateRegex('type', '[A-Za-z0-9-]+');
  17166. $this->validateString('target-dir');
  17167. $this->validateArray('extra');
  17168. if (isset($this->config['bin'])) {
  17169. if (is_string($this->config['bin'])) {
  17170. $this->validateString('bin');
  17171. } else {
  17172. $this->validateFlatArray('bin');
  17173. }
  17174. }
  17175. $this->validateArray('scripts');
  17176. $this->validateString('description');
  17177. $this->validateUrl('homepage');
  17178. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  17179. $releaseDate = null;
  17180. $this->validateString('time');
  17181. if (!empty($this->config['time'])) {
  17182. try {
  17183. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  17184. } catch (\Exception $e) {
  17185. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  17186. unset($this->config['time']);
  17187. }
  17188. }
  17189. if (isset($this->config['license'])) {
  17190. if (is_string($this->config['license'])) {
  17191. $this->validateRegex('license', '[A-Za-z0-9+. ()-]+');
  17192. } else {
  17193. $this->validateFlatArray('license', '[A-Za-z0-9+. ()-]+');
  17194. }
  17195. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  17196. $licenses = (array) $this->config['license'];
  17197. foreach ($licenses as $key => $license) {
  17198. if ('proprietary' === $license) {
  17199. unset($licenses[$key]);
  17200. }
  17201. }
  17202. $licenseValidator = new SpdxLicenses();
  17203. if (count($licenses) === 1 && !$licenseValidator->validate($licenses) && $licenseValidator->validate(trim($licenses[0]))) {
  17204. $this->warnings[] = sprintf(
  17205. 'License %s must not contain extra spaces, make sure to trim it.',
  17206. json_encode($this->config['license'])
  17207. );
  17208. } elseif (array() !== $licenses && !$licenseValidator->validate($licenses)) {
  17209. $this->warnings[] = sprintf(
  17210. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  17211. 'If the software is closed-source, you may use "proprietary" as license.',
  17212. json_encode($this->config['license'])
  17213. );
  17214. } else if (!$releaseDate || $releaseDate->format('Y-m-d H:i:s') >= '2018-01-20 00:00:00') {
  17215. foreach ($licenses as $license) {
  17216. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  17217. if ($spdxLicense && $spdxLicense[3]) {
  17218. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  17219. $this->warnings[] = sprintf(
  17220. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  17221. $license
  17222. );
  17223. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  17224. $this->warnings[] = sprintf(
  17225. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  17226. $license
  17227. );
  17228. } else {
  17229. $this->warnings[] = sprintf(
  17230. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  17231. $license
  17232. );
  17233. }
  17234. }
  17235. }
  17236. }
  17237. }
  17238. }
  17239. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  17240. foreach ($this->config['authors'] as $key => $author) {
  17241. if (!is_array($author)) {
  17242. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  17243. unset($this->config['authors'][$key]);
  17244. continue;
  17245. }
  17246. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  17247. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  17248. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  17249. unset($this->config['authors'][$key][$authorData]);
  17250. }
  17251. }
  17252. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  17253. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  17254. unset($this->config['authors'][$key]['homepage']);
  17255. }
  17256. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  17257. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  17258. unset($this->config['authors'][$key]['email']);
  17259. }
  17260. if (empty($this->config['authors'][$key])) {
  17261. unset($this->config['authors'][$key]);
  17262. }
  17263. }
  17264. if (empty($this->config['authors'])) {
  17265. unset($this->config['authors']);
  17266. }
  17267. }
  17268. if ($this->validateArray('support') && !empty($this->config['support'])) {
  17269. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss') as $key) {
  17270. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  17271. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  17272. unset($this->config['support'][$key]);
  17273. }
  17274. }
  17275. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  17276. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  17277. unset($this->config['support']['email']);
  17278. }
  17279. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  17280. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  17281. unset($this->config['support']['irc']);
  17282. }
  17283. foreach (array('issues', 'forum', 'wiki', 'source', 'docs') as $key) {
  17284. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  17285. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  17286. unset($this->config['support'][$key]);
  17287. }
  17288. }
  17289. if (empty($this->config['support'])) {
  17290. unset($this->config['support']);
  17291. }
  17292. }
  17293. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  17294. $stableConstraint = new Constraint('=', '1.0.0');
  17295. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  17296. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  17297. foreach ($this->config[$linkType] as $package => $constraint) {
  17298. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  17299. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  17300. }
  17301. if (!is_string($constraint)) {
  17302. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  17303. unset($this->config[$linkType][$package]);
  17304. } elseif ('self.version' !== $constraint) {
  17305. try {
  17306. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  17307. } catch (\Exception $e) {
  17308. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  17309. unset($this->config[$linkType][$package]);
  17310. continue;
  17311. }
  17312. if (
  17313. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  17314. && 'require' === $linkType
  17315. && $linkConstraint->matches($unboundConstraint)
  17316. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  17317. ) {
  17318. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  17319. } elseif (
  17320. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  17321. && 'require' === $linkType
  17322. && substr($linkConstraint, 0, 1) === '='
  17323. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  17324. ) {
  17325. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  17326. }
  17327. }
  17328. }
  17329. }
  17330. }
  17331. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  17332. foreach ($this->config['suggest'] as $package => $description) {
  17333. if (!is_string($description)) {
  17334. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  17335. unset($this->config['suggest'][$package]);
  17336. }
  17337. }
  17338. }
  17339. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  17340. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  17341. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  17342. unset($this->config['minimum-stability']);
  17343. }
  17344. }
  17345. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  17346. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  17347. foreach ($this->config['autoload'] as $type => $typeConfig) {
  17348. if (!in_array($type, $types)) {
  17349. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  17350. unset($this->config['autoload'][$type]);
  17351. }
  17352. if ($type === 'psr-4') {
  17353. foreach ($typeConfig as $namespace => $dirs) {
  17354. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  17355. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  17356. }
  17357. }
  17358. }
  17359. }
  17360. }
  17361. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  17362. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  17363. unset($this->config['autoload']['psr-4']);
  17364. }
  17365. $this->validateFlatArray('include-path');
  17366. $this->validateArray('transport-options');
  17367. if (isset($this->config['extra']['branch-alias'])) {
  17368. if (!is_array($this->config['extra']['branch-alias'])) {
  17369. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  17370. } else {
  17371. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  17372. if ('-dev' !== substr($targetBranch, -4)) {
  17373. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  17374. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17375. continue;
  17376. }
  17377. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  17378. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  17379. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  17380. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17381. continue;
  17382. }
  17383. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  17384. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  17385. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  17386. ) {
  17387. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  17388. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  17389. }
  17390. }
  17391. }
  17392. }
  17393. if ($this->errors) {
  17394. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  17395. }
  17396. $package = $this->loader->load($this->config, $class);
  17397. $this->config = null;
  17398. return $package;
  17399. }
  17400. public function getWarnings()
  17401. {
  17402. return $this->warnings;
  17403. }
  17404. public function getErrors()
  17405. {
  17406. return $this->errors;
  17407. }
  17408. private function validateRegex($property, $regex, $mandatory = false)
  17409. {
  17410. if (!$this->validateString($property, $mandatory)) {
  17411. return false;
  17412. }
  17413. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  17414. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  17415. if ($mandatory) {
  17416. $this->errors[] = $message;
  17417. } else {
  17418. $this->warnings[] = $message;
  17419. }
  17420. unset($this->config[$property]);
  17421. return false;
  17422. }
  17423. return true;
  17424. }
  17425. private function validateString($property, $mandatory = false)
  17426. {
  17427. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  17428. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  17429. unset($this->config[$property]);
  17430. return false;
  17431. }
  17432. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  17433. if ($mandatory) {
  17434. $this->errors[] = $property.' : must be present';
  17435. }
  17436. unset($this->config[$property]);
  17437. return false;
  17438. }
  17439. return true;
  17440. }
  17441. private function validateArray($property, $mandatory = false)
  17442. {
  17443. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  17444. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  17445. unset($this->config[$property]);
  17446. return false;
  17447. }
  17448. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  17449. if ($mandatory) {
  17450. $this->errors[] = $property.' : must be present and contain at least one element';
  17451. }
  17452. unset($this->config[$property]);
  17453. return false;
  17454. }
  17455. return true;
  17456. }
  17457. private function validateFlatArray($property, $regex = null, $mandatory = false)
  17458. {
  17459. if (!$this->validateArray($property, $mandatory)) {
  17460. return false;
  17461. }
  17462. $pass = true;
  17463. foreach ($this->config[$property] as $key => $value) {
  17464. if (!is_string($value) && !is_numeric($value)) {
  17465. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  17466. unset($this->config[$property][$key]);
  17467. $pass = false;
  17468. continue;
  17469. }
  17470. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  17471. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  17472. unset($this->config[$property][$key]);
  17473. $pass = false;
  17474. }
  17475. }
  17476. return $pass;
  17477. }
  17478. private function validateUrl($property, $mandatory = false)
  17479. {
  17480. if (!$this->validateString($property, $mandatory)) {
  17481. return false;
  17482. }
  17483. if (!$this->filterUrl($this->config[$property])) {
  17484. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  17485. unset($this->config[$property]);
  17486. return false;
  17487. }
  17488. return true;
  17489. }
  17490. private function filterUrl($value, array $schemes = array('http', 'https'))
  17491. {
  17492. if ($value === '') {
  17493. return true;
  17494. }
  17495. $bits = parse_url($value);
  17496. if (empty($bits['scheme']) || empty($bits['host'])) {
  17497. return false;
  17498. }
  17499. if (!in_array($bits['scheme'], $schemes, true)) {
  17500. return false;
  17501. }
  17502. return true;
  17503. }
  17504. }
  17505. <?php
  17506. namespace Composer\Package;
  17507. use Composer\Json\JsonFile;
  17508. use Composer\Installer\InstallationManager;
  17509. use Composer\Repository\RepositoryManager;
  17510. use Composer\Util\ProcessExecutor;
  17511. use Composer\Repository\ArrayRepository;
  17512. use Composer\Package\Dumper\ArrayDumper;
  17513. use Composer\Package\Loader\ArrayLoader;
  17514. use Composer\Util\Git as GitUtil;
  17515. use Composer\IO\IOInterface;
  17516. use Seld\JsonLint\ParsingException;
  17517. class Locker
  17518. {
  17519. private $lockFile;
  17520. private $repositoryManager;
  17521. private $installationManager;
  17522. private $hash;
  17523. private $contentHash;
  17524. private $loader;
  17525. private $dumper;
  17526. private $process;
  17527. private $lockDataCache;
  17528. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  17529. {
  17530. $this->lockFile = $lockFile;
  17531. $this->repositoryManager = $repositoryManager;
  17532. $this->installationManager = $installationManager;
  17533. $this->hash = md5($composerFileContents);
  17534. $this->contentHash = self::getContentHash($composerFileContents);
  17535. $this->loader = new ArrayLoader(null, true);
  17536. $this->dumper = new ArrayDumper();
  17537. $this->process = new ProcessExecutor($io);
  17538. }
  17539. public static function getContentHash($composerFileContents)
  17540. {
  17541. $content = json_decode($composerFileContents, true);
  17542. $relevantKeys = array(
  17543. 'name',
  17544. 'version',
  17545. 'require',
  17546. 'require-dev',
  17547. 'conflict',
  17548. 'replace',
  17549. 'provide',
  17550. 'minimum-stability',
  17551. 'prefer-stable',
  17552. 'repositories',
  17553. 'extra',
  17554. );
  17555. $relevantContent = array();
  17556. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  17557. $relevantContent[$key] = $content[$key];
  17558. }
  17559. if (isset($content['config']['platform'])) {
  17560. $relevantContent['config']['platform'] = $content['config']['platform'];
  17561. }
  17562. ksort($relevantContent);
  17563. return md5(json_encode($relevantContent));
  17564. }
  17565. public function isLocked()
  17566. {
  17567. if (!$this->lockFile->exists()) {
  17568. return false;
  17569. }
  17570. $data = $this->getLockData();
  17571. return isset($data['packages']);
  17572. }
  17573. public function isFresh()
  17574. {
  17575. $lock = $this->lockFile->read();
  17576. if (!empty($lock['content-hash'])) {
  17577. return $this->contentHash === $lock['content-hash'];
  17578. }
  17579. if (!empty($lock['hash'])) {
  17580. return $this->hash === $lock['hash'];
  17581. }
  17582. return false;
  17583. }
  17584. public function getLockedRepository($withDevReqs = false)
  17585. {
  17586. $lockData = $this->getLockData();
  17587. $packages = new ArrayRepository();
  17588. $lockedPackages = $lockData['packages'];
  17589. if ($withDevReqs) {
  17590. if (isset($lockData['packages-dev'])) {
  17591. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  17592. } else {
  17593. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.');
  17594. }
  17595. }
  17596. if (empty($lockedPackages)) {
  17597. return $packages;
  17598. }
  17599. if (isset($lockedPackages[0]['name'])) {
  17600. foreach ($lockedPackages as $info) {
  17601. $packages->addPackage($this->loader->load($info));
  17602. }
  17603. return $packages;
  17604. }
  17605. throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
  17606. }
  17607. public function getPlatformRequirements($withDevReqs = false)
  17608. {
  17609. $lockData = $this->getLockData();
  17610. $requirements = array();
  17611. if (!empty($lockData['platform'])) {
  17612. $requirements = $this->loader->parseLinks(
  17613. '__ROOT__',
  17614. '1.0.0',
  17615. 'requires',
  17616. isset($lockData['platform']) ? $lockData['platform'] : array()
  17617. );
  17618. }
  17619. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  17620. $devRequirements = $this->loader->parseLinks(
  17621. '__ROOT__',
  17622. '1.0.0',
  17623. 'requires',
  17624. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  17625. );
  17626. $requirements = array_merge($requirements, $devRequirements);
  17627. }
  17628. return $requirements;
  17629. }
  17630. public function getMinimumStability()
  17631. {
  17632. $lockData = $this->getLockData();
  17633. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  17634. }
  17635. public function getStabilityFlags()
  17636. {
  17637. $lockData = $this->getLockData();
  17638. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  17639. }
  17640. public function getPreferStable()
  17641. {
  17642. $lockData = $this->getLockData();
  17643. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  17644. }
  17645. public function getPreferLowest()
  17646. {
  17647. $lockData = $this->getLockData();
  17648. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  17649. }
  17650. public function getPlatformOverrides()
  17651. {
  17652. $lockData = $this->getLockData();
  17653. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  17654. }
  17655. public function getAliases()
  17656. {
  17657. $lockData = $this->getLockData();
  17658. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  17659. }
  17660. public function getLockData()
  17661. {
  17662. if (null !== $this->lockDataCache) {
  17663. return $this->lockDataCache;
  17664. }
  17665. if (!$this->lockFile->exists()) {
  17666. throw new \LogicException('No lockfile found. Unable to read locked packages');
  17667. }
  17668. return $this->lockDataCache = $this->lockFile->read();
  17669. }
  17670. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  17671. {
  17672. $lock = array(
  17673. '_readme' => array('This file locks the dependencies of your project to a known state',
  17674. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file',
  17675. 'This file is @gener'.'ated automatically', ),
  17676. 'content-hash' => $this->contentHash,
  17677. 'packages' => null,
  17678. 'packages-dev' => null,
  17679. 'aliases' => array(),
  17680. 'minimum-stability' => $minimumStability,
  17681. 'stability-flags' => $stabilityFlags,
  17682. 'prefer-stable' => $preferStable,
  17683. 'prefer-lowest' => $preferLowest,
  17684. );
  17685. foreach ($aliases as $package => $versions) {
  17686. foreach ($versions as $version => $alias) {
  17687. $lock['aliases'][] = array(
  17688. 'alias' => $alias['alias'],
  17689. 'alias_normalized' => $alias['alias_normalized'],
  17690. 'version' => $version,
  17691. 'package' => $package,
  17692. );
  17693. }
  17694. }
  17695. $lock['packages'] = $this->lockPackages($packages);
  17696. if (null !== $devPackages) {
  17697. $lock['packages-dev'] = $this->lockPackages($devPackages);
  17698. }
  17699. $lock['platform'] = $platformReqs;
  17700. $lock['platform-dev'] = $platformDevReqs;
  17701. if ($platformOverrides) {
  17702. $lock['platform-overrides'] = $platformOverrides;
  17703. }
  17704. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  17705. if ($this->lockFile->exists()) {
  17706. unlink($this->lockFile->getPath());
  17707. }
  17708. return false;
  17709. }
  17710. try {
  17711. $isLocked = $this->isLocked();
  17712. } catch (ParsingException $e) {
  17713. $isLocked = false;
  17714. }
  17715. if (!$isLocked || $lock !== $this->getLockData()) {
  17716. $this->lockFile->write($lock);
  17717. $this->lockDataCache = null;
  17718. return true;
  17719. }
  17720. return false;
  17721. }
  17722. private function lockPackages(array $packages)
  17723. {
  17724. $locked = array();
  17725. foreach ($packages as $package) {
  17726. if ($package instanceof AliasPackage) {
  17727. continue;
  17728. }
  17729. $name = $package->getPrettyName();
  17730. $version = $package->getPrettyVersion();
  17731. if (!$name || !$version) {
  17732. throw new \LogicException(sprintf(
  17733. 'Package "%s" has no version or name and can not be locked', $package
  17734. ));
  17735. }
  17736. $spec = $this->dumper->dump($package);
  17737. unset($spec['version_normalized']);
  17738. $time = isset($spec['time']) ? $spec['time'] : null;
  17739. unset($spec['time']);
  17740. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  17741. $time = $this->getPackageTime($package) ?: $time;
  17742. }
  17743. if (null !== $time) {
  17744. $spec['time'] = $time;
  17745. }
  17746. unset($spec['installation-source']);
  17747. $locked[] = $spec;
  17748. }
  17749. usort($locked, function ($a, $b) {
  17750. $comparison = strcmp($a['name'], $b['name']);
  17751. if (0 !== $comparison) {
  17752. return $comparison;
  17753. }
  17754. return strcmp($a['version'], $b['version']);
  17755. });
  17756. return $locked;
  17757. }
  17758. private function getPackageTime(PackageInterface $package)
  17759. {
  17760. if (!function_exists('proc_open')) {
  17761. return null;
  17762. }
  17763. $path = realpath($this->installationManager->getInstallPath($package));
  17764. $sourceType = $package->getSourceType();
  17765. $datetime = null;
  17766. if ($path && in_array($sourceType, array('git', 'hg'))) {
  17767. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  17768. switch ($sourceType) {
  17769. case 'git':
  17770. GitUtil::cleanEnv();
  17771. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  17772. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  17773. }
  17774. break;
  17775. case 'hg':
  17776. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  17777. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  17778. }
  17779. break;
  17780. }
  17781. }
  17782. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  17783. }
  17784. }
  17785. <?php
  17786. namespace Composer\Package;
  17787. use Composer\Package\Version\VersionParser;
  17788. use Composer\Util\ComposerMirror;
  17789. class Package extends BasePackage
  17790. {
  17791. protected $type;
  17792. protected $targetDir;
  17793. protected $installationSource;
  17794. protected $sourceType;
  17795. protected $sourceUrl;
  17796. protected $sourceReference;
  17797. protected $sourceMirrors;
  17798. protected $distType;
  17799. protected $distUrl;
  17800. protected $distReference;
  17801. protected $distSha1Checksum;
  17802. protected $distMirrors;
  17803. protected $version;
  17804. protected $prettyVersion;
  17805. protected $releaseDate;
  17806. protected $extra = array();
  17807. protected $binaries = array();
  17808. protected $dev;
  17809. protected $stability;
  17810. protected $notificationUrl;
  17811. protected $requires = array();
  17812. protected $conflicts = array();
  17813. protected $provides = array();
  17814. protected $replaces = array();
  17815. protected $devRequires = array();
  17816. protected $suggests = array();
  17817. protected $autoload = array();
  17818. protected $devAutoload = array();
  17819. protected $includePaths = array();
  17820. protected $archiveExcludes = array();
  17821. public function __construct($name, $version, $prettyVersion)
  17822. {
  17823. parent::__construct($name);
  17824. $this->version = $version;
  17825. $this->prettyVersion = $prettyVersion;
  17826. $this->stability = VersionParser::parseStability($version);
  17827. $this->dev = $this->stability === 'dev';
  17828. }
  17829. public function isDev()
  17830. {
  17831. return $this->dev;
  17832. }
  17833. public function setType($type)
  17834. {
  17835. $this->type = $type;
  17836. }
  17837. public function getType()
  17838. {
  17839. return $this->type ?: 'library';
  17840. }
  17841. public function getStability()
  17842. {
  17843. return $this->stability;
  17844. }
  17845. public function setTargetDir($targetDir)
  17846. {
  17847. $this->targetDir = $targetDir;
  17848. }
  17849. public function getTargetDir()
  17850. {
  17851. if (null === $this->targetDir) {
  17852. return;
  17853. }
  17854. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  17855. }
  17856. public function setExtra(array $extra)
  17857. {
  17858. $this->extra = $extra;
  17859. }
  17860. public function getExtra()
  17861. {
  17862. return $this->extra;
  17863. }
  17864. public function setBinaries(array $binaries)
  17865. {
  17866. $this->binaries = $binaries;
  17867. }
  17868. public function getBinaries()
  17869. {
  17870. return $this->binaries;
  17871. }
  17872. public function setInstallationSource($type)
  17873. {
  17874. $this->installationSource = $type;
  17875. }
  17876. public function getInstallationSource()
  17877. {
  17878. return $this->installationSource;
  17879. }
  17880. public function setSourceType($type)
  17881. {
  17882. $this->sourceType = $type;
  17883. }
  17884. public function getSourceType()
  17885. {
  17886. return $this->sourceType;
  17887. }
  17888. public function setSourceUrl($url)
  17889. {
  17890. $this->sourceUrl = $url;
  17891. }
  17892. public function getSourceUrl()
  17893. {
  17894. return $this->sourceUrl;
  17895. }
  17896. public function setSourceReference($reference)
  17897. {
  17898. $this->sourceReference = $reference;
  17899. }
  17900. public function getSourceReference()
  17901. {
  17902. return $this->sourceReference;
  17903. }
  17904. public function setSourceMirrors($mirrors)
  17905. {
  17906. $this->sourceMirrors = $mirrors;
  17907. }
  17908. public function getSourceMirrors()
  17909. {
  17910. return $this->sourceMirrors;
  17911. }
  17912. public function getSourceUrls()
  17913. {
  17914. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  17915. }
  17916. public function setDistType($type)
  17917. {
  17918. $this->distType = $type;
  17919. }
  17920. public function getDistType()
  17921. {
  17922. return $this->distType;
  17923. }
  17924. public function setDistUrl($url)
  17925. {
  17926. $this->distUrl = $url;
  17927. }
  17928. public function getDistUrl()
  17929. {
  17930. return $this->distUrl;
  17931. }
  17932. public function setDistReference($reference)
  17933. {
  17934. $this->distReference = $reference;
  17935. }
  17936. public function getDistReference()
  17937. {
  17938. return $this->distReference;
  17939. }
  17940. public function setDistSha1Checksum($sha1checksum)
  17941. {
  17942. $this->distSha1Checksum = $sha1checksum;
  17943. }
  17944. public function getDistSha1Checksum()
  17945. {
  17946. return $this->distSha1Checksum;
  17947. }
  17948. public function setDistMirrors($mirrors)
  17949. {
  17950. $this->distMirrors = $mirrors;
  17951. }
  17952. public function getDistMirrors()
  17953. {
  17954. return $this->distMirrors;
  17955. }
  17956. public function getDistUrls()
  17957. {
  17958. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  17959. }
  17960. public function getVersion()
  17961. {
  17962. return $this->version;
  17963. }
  17964. public function getPrettyVersion()
  17965. {
  17966. return $this->prettyVersion;
  17967. }
  17968. public function setReleaseDate(\DateTime $releaseDate)
  17969. {
  17970. $this->releaseDate = $releaseDate;
  17971. }
  17972. public function getReleaseDate()
  17973. {
  17974. return $this->releaseDate;
  17975. }
  17976. public function setRequires(array $requires)
  17977. {
  17978. $this->requires = $requires;
  17979. }
  17980. public function getRequires()
  17981. {
  17982. return $this->requires;
  17983. }
  17984. public function setConflicts(array $conflicts)
  17985. {
  17986. $this->conflicts = $conflicts;
  17987. }
  17988. public function getConflicts()
  17989. {
  17990. return $this->conflicts;
  17991. }
  17992. public function setProvides(array $provides)
  17993. {
  17994. $this->provides = $provides;
  17995. }
  17996. public function getProvides()
  17997. {
  17998. return $this->provides;
  17999. }
  18000. public function setReplaces(array $replaces)
  18001. {
  18002. $this->replaces = $replaces;
  18003. }
  18004. public function getReplaces()
  18005. {
  18006. return $this->replaces;
  18007. }
  18008. public function setDevRequires(array $devRequires)
  18009. {
  18010. $this->devRequires = $devRequires;
  18011. }
  18012. public function getDevRequires()
  18013. {
  18014. return $this->devRequires;
  18015. }
  18016. public function setSuggests(array $suggests)
  18017. {
  18018. $this->suggests = $suggests;
  18019. }
  18020. public function getSuggests()
  18021. {
  18022. return $this->suggests;
  18023. }
  18024. public function setAutoload(array $autoload)
  18025. {
  18026. $this->autoload = $autoload;
  18027. }
  18028. public function getAutoload()
  18029. {
  18030. return $this->autoload;
  18031. }
  18032. public function setDevAutoload(array $devAutoload)
  18033. {
  18034. $this->devAutoload = $devAutoload;
  18035. }
  18036. public function getDevAutoload()
  18037. {
  18038. return $this->devAutoload;
  18039. }
  18040. public function setIncludePaths(array $includePaths)
  18041. {
  18042. $this->includePaths = $includePaths;
  18043. }
  18044. public function getIncludePaths()
  18045. {
  18046. return $this->includePaths;
  18047. }
  18048. public function setNotificationUrl($notificationUrl)
  18049. {
  18050. $this->notificationUrl = $notificationUrl;
  18051. }
  18052. public function getNotificationUrl()
  18053. {
  18054. return $this->notificationUrl;
  18055. }
  18056. public function setArchiveExcludes(array $excludes)
  18057. {
  18058. $this->archiveExcludes = $excludes;
  18059. }
  18060. public function getArchiveExcludes()
  18061. {
  18062. return $this->archiveExcludes;
  18063. }
  18064. public function replaceVersion($version, $prettyVersion)
  18065. {
  18066. $this->version = $version;
  18067. $this->prettyVersion = $prettyVersion;
  18068. $this->stability = VersionParser::parseStability($version);
  18069. $this->dev = $this->stability === 'dev';
  18070. }
  18071. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  18072. {
  18073. if (!$url) {
  18074. return array();
  18075. }
  18076. $urls = array($url);
  18077. if ($mirrors) {
  18078. foreach ($mirrors as $mirror) {
  18079. if ($urlType === 'dist') {
  18080. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  18081. } elseif ($urlType === 'source' && $type === 'git') {
  18082. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  18083. } elseif ($urlType === 'source' && $type === 'hg') {
  18084. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  18085. }
  18086. if (!in_array($mirrorUrl, $urls)) {
  18087. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  18088. $func($urls, $mirrorUrl);
  18089. }
  18090. }
  18091. }
  18092. return $urls;
  18093. }
  18094. }
  18095. <?php
  18096. namespace Composer\Package;
  18097. use Composer\Repository\RepositoryInterface;
  18098. interface PackageInterface
  18099. {
  18100. public function getName();
  18101. public function getPrettyName();
  18102. public function getNames();
  18103. public function setId($id);
  18104. public function getId();
  18105. public function isDev();
  18106. public function getType();
  18107. public function getTargetDir();
  18108. public function getExtra();
  18109. public function setInstallationSource($type);
  18110. public function getInstallationSource();
  18111. public function getSourceType();
  18112. public function getSourceUrl();
  18113. public function getSourceUrls();
  18114. public function getSourceReference();
  18115. public function getSourceMirrors();
  18116. public function getDistType();
  18117. public function getDistUrl();
  18118. public function getDistUrls();
  18119. public function getDistReference();
  18120. public function getDistSha1Checksum();
  18121. public function getDistMirrors();
  18122. public function getVersion();
  18123. public function getPrettyVersion();
  18124. public function getFullPrettyVersion($truncate = true);
  18125. public function getReleaseDate();
  18126. public function getStability();
  18127. public function getRequires();
  18128. public function getConflicts();
  18129. public function getProvides();
  18130. public function getReplaces();
  18131. public function getDevRequires();
  18132. public function getSuggests();
  18133. public function getAutoload();
  18134. public function getDevAutoload();
  18135. public function getIncludePaths();
  18136. public function setRepository(RepositoryInterface $repository);
  18137. public function getRepository();
  18138. public function getBinaries();
  18139. public function getUniqueName();
  18140. public function getNotificationUrl();
  18141. public function __toString();
  18142. public function getPrettyString();
  18143. public function getArchiveExcludes();
  18144. public function getTransportOptions();
  18145. }
  18146. <?php
  18147. namespace Composer\Package;
  18148. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  18149. {
  18150. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  18151. {
  18152. parent::__construct($aliasOf, $version, $prettyVersion);
  18153. }
  18154. public function getAliases()
  18155. {
  18156. return $this->aliasOf->getAliases();
  18157. }
  18158. public function getMinimumStability()
  18159. {
  18160. return $this->aliasOf->getMinimumStability();
  18161. }
  18162. public function getStabilityFlags()
  18163. {
  18164. return $this->aliasOf->getStabilityFlags();
  18165. }
  18166. public function getReferences()
  18167. {
  18168. return $this->aliasOf->getReferences();
  18169. }
  18170. public function getPreferStable()
  18171. {
  18172. return $this->aliasOf->getPreferStable();
  18173. }
  18174. public function getConfig()
  18175. {
  18176. return $this->aliasOf->getConfig();
  18177. }
  18178. public function setRequires(array $require)
  18179. {
  18180. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  18181. $this->aliasOf->setRequires($require);
  18182. }
  18183. public function setDevRequires(array $devRequire)
  18184. {
  18185. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  18186. $this->aliasOf->setDevRequires($devRequire);
  18187. }
  18188. public function setConflicts(array $conflicts)
  18189. {
  18190. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  18191. $this->aliasOf->setConflicts($conflicts);
  18192. }
  18193. public function setProvides(array $provides)
  18194. {
  18195. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  18196. $this->aliasOf->setProvides($provides);
  18197. }
  18198. public function setReplaces(array $replaces)
  18199. {
  18200. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  18201. $this->aliasOf->setReplaces($replaces);
  18202. }
  18203. public function setRepositories($repositories)
  18204. {
  18205. $this->aliasOf->setRepositories($repositories);
  18206. }
  18207. public function setAutoload(array $autoload)
  18208. {
  18209. $this->aliasOf->setAutoload($autoload);
  18210. }
  18211. public function setDevAutoload(array $devAutoload)
  18212. {
  18213. $this->aliasOf->setDevAutoload($devAutoload);
  18214. }
  18215. public function setStabilityFlags(array $stabilityFlags)
  18216. {
  18217. $this->aliasOf->setStabilityFlags($stabilityFlags);
  18218. }
  18219. public function setSuggests(array $suggests)
  18220. {
  18221. $this->aliasOf->setSuggests($suggests);
  18222. }
  18223. public function setExtra(array $extra)
  18224. {
  18225. $this->aliasOf->setExtra($extra);
  18226. }
  18227. public function __clone()
  18228. {
  18229. parent::__clone();
  18230. $this->aliasOf = clone $this->aliasOf;
  18231. }
  18232. }
  18233. <?php
  18234. namespace Composer\Package;
  18235. class RootPackage extends CompletePackage implements RootPackageInterface
  18236. {
  18237. protected $minimumStability = 'stable';
  18238. protected $preferStable = false;
  18239. protected $stabilityFlags = array();
  18240. protected $config = array();
  18241. protected $references = array();
  18242. protected $aliases = array();
  18243. public function setMinimumStability($minimumStability)
  18244. {
  18245. $this->minimumStability = $minimumStability;
  18246. }
  18247. public function getMinimumStability()
  18248. {
  18249. return $this->minimumStability;
  18250. }
  18251. public function setStabilityFlags(array $stabilityFlags)
  18252. {
  18253. $this->stabilityFlags = $stabilityFlags;
  18254. }
  18255. public function getStabilityFlags()
  18256. {
  18257. return $this->stabilityFlags;
  18258. }
  18259. public function setPreferStable($preferStable)
  18260. {
  18261. $this->preferStable = $preferStable;
  18262. }
  18263. public function getPreferStable()
  18264. {
  18265. return $this->preferStable;
  18266. }
  18267. public function setConfig(array $config)
  18268. {
  18269. $this->config = $config;
  18270. }
  18271. public function getConfig()
  18272. {
  18273. return $this->config;
  18274. }
  18275. public function setReferences(array $references)
  18276. {
  18277. $this->references = $references;
  18278. }
  18279. public function getReferences()
  18280. {
  18281. return $this->references;
  18282. }
  18283. public function setAliases(array $aliases)
  18284. {
  18285. $this->aliases = $aliases;
  18286. }
  18287. public function getAliases()
  18288. {
  18289. return $this->aliases;
  18290. }
  18291. }
  18292. <?php
  18293. namespace Composer\Package;
  18294. interface RootPackageInterface extends CompletePackageInterface
  18295. {
  18296. public function getAliases();
  18297. public function getMinimumStability();
  18298. public function getStabilityFlags();
  18299. public function getReferences();
  18300. public function getPreferStable();
  18301. public function getConfig();
  18302. public function setRequires(array $requires);
  18303. public function setDevRequires(array $devRequires);
  18304. public function setConflicts(array $conflicts);
  18305. public function setProvides(array $provides);
  18306. public function setReplaces(array $replaces);
  18307. public function setRepositories($repositories);
  18308. public function setAutoload(array $autoload);
  18309. public function setDevAutoload(array $devAutoload);
  18310. public function setStabilityFlags(array $stabilityFlags);
  18311. public function setSuggests(array $suggests);
  18312. public function setExtra(array $extra);
  18313. }
  18314. <?php
  18315. namespace Composer\Package\Version;
  18316. use Composer\Config;
  18317. use Composer\Repository\Vcs\HgDriver;
  18318. use Composer\IO\NullIO;
  18319. use Composer\Semver\VersionParser as SemverVersionParser;
  18320. use Composer\Util\Git as GitUtil;
  18321. use Composer\Util\ProcessExecutor;
  18322. use Composer\Util\Svn as SvnUtil;
  18323. class VersionGuesser
  18324. {
  18325. private $config;
  18326. private $process;
  18327. private $versionParser;
  18328. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  18329. {
  18330. $this->config = $config;
  18331. $this->process = $process;
  18332. $this->versionParser = $versionParser;
  18333. }
  18334. public function guessVersion(array $packageConfig, $path)
  18335. {
  18336. if (function_exists('proc_open')) {
  18337. $versionData = $this->guessGitVersion($packageConfig, $path);
  18338. if (null !== $versionData && null !== $versionData['version']) {
  18339. return $this->postprocess($versionData);
  18340. }
  18341. $versionData = $this->guessHgVersion($packageConfig, $path);
  18342. if (null !== $versionData && null !== $versionData['version']) {
  18343. return $this->postprocess($versionData);
  18344. }
  18345. $versionData = $this->guessFossilVersion($packageConfig, $path);
  18346. if (null !== $versionData && null !== $versionData['version']) {
  18347. return $this->postprocess($versionData);
  18348. }
  18349. $versionData = $this->guessSvnVersion($packageConfig, $path);
  18350. if (null !== $versionData && null !== $versionData['version']) {
  18351. return $this->postprocess($versionData);
  18352. }
  18353. }
  18354. }
  18355. private function postprocess(array $versionData)
  18356. {
  18357. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  18358. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  18359. }
  18360. return $versionData;
  18361. }
  18362. private function guessGitVersion(array $packageConfig, $path)
  18363. {
  18364. GitUtil::cleanEnv();
  18365. $commit = null;
  18366. $version = null;
  18367. $prettyVersion = null;
  18368. $isDetached = false;
  18369. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  18370. $branches = array();
  18371. $isFeatureBranch = false;
  18372. foreach ($this->process->splitLines($output) as $branch) {
  18373. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  18374. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  18375. $version = 'dev-' . $match[2];
  18376. $prettyVersion = $version;
  18377. $isFeatureBranch = true;
  18378. $isDetached = true;
  18379. } else {
  18380. $version = $this->versionParser->normalizeBranch($match[1]);
  18381. $prettyVersion = 'dev-' . $match[1];
  18382. $isFeatureBranch = 0 === strpos($version, 'dev-');
  18383. }
  18384. if ($match[2]) {
  18385. $commit = $match[2];
  18386. }
  18387. }
  18388. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  18389. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  18390. $branches[] = $match[1];
  18391. }
  18392. }
  18393. }
  18394. if ($isFeatureBranch) {
  18395. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  18396. $version = $result['version'];
  18397. $prettyVersion = $result['pretty_version'];
  18398. }
  18399. }
  18400. if (!$version || $isDetached) {
  18401. $result = $this->versionFromGitTags($path);
  18402. if ($result) {
  18403. $version = $result['version'];
  18404. $prettyVersion = $result['pretty_version'];
  18405. }
  18406. }
  18407. if (!$commit) {
  18408. $command = 'git log --pretty="%H" -n1 HEAD';
  18409. if (0 === $this->process->execute($command, $output, $path)) {
  18410. $commit = trim($output) ?: null;
  18411. }
  18412. }
  18413. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  18414. }
  18415. private function versionFromGitTags($path)
  18416. {
  18417. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  18418. try {
  18419. $version = $this->versionParser->normalize(trim($output));
  18420. return array('version' => $version, 'pretty_version' => trim($output));
  18421. } catch (\Exception $e) {
  18422. }
  18423. }
  18424. return null;
  18425. }
  18426. private function guessHgVersion(array $packageConfig, $path)
  18427. {
  18428. if (0 === $this->process->execute('hg branch', $output, $path)) {
  18429. $branch = trim($output);
  18430. $version = $this->versionParser->normalizeBranch($branch);
  18431. $isFeatureBranch = 0 === strpos($version, 'dev-');
  18432. if ('9999999-dev' === $version) {
  18433. $version = 'dev-' . $branch;
  18434. }
  18435. if (!$isFeatureBranch) {
  18436. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  18437. }
  18438. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  18439. $branches = array_keys($driver->getBranches());
  18440. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  18441. $result['commit'] = '';
  18442. return $result;
  18443. }
  18444. }
  18445. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  18446. {
  18447. $prettyVersion = $version;
  18448. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  18449. || strpos(json_encode($packageConfig), '"self.version"')
  18450. ) {
  18451. $branch = preg_replace('{^dev-}', '', $version);
  18452. $length = PHP_INT_MAX;
  18453. $nonFeatureBranches = '';
  18454. if (!empty($packageConfig['non-feature-branches'])) {
  18455. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  18456. }
  18457. foreach ($branches as $candidate) {
  18458. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  18459. break;
  18460. }
  18461. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  18462. continue;
  18463. }
  18464. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  18465. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  18466. continue;
  18467. }
  18468. if (strlen($output) < $length) {
  18469. $length = strlen($output);
  18470. $version = $this->versionParser->normalizeBranch($candidate);
  18471. $prettyVersion = 'dev-' . $match[1];
  18472. if ('9999999-dev' === $version) {
  18473. $version = $prettyVersion;
  18474. }
  18475. }
  18476. }
  18477. }
  18478. return array('version' => $version, 'pretty_version' => $prettyVersion);
  18479. }
  18480. private function guessFossilVersion(array $packageConfig, $path)
  18481. {
  18482. $version = null;
  18483. $prettyVersion = null;
  18484. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  18485. $branch = trim($output);
  18486. $version = $this->versionParser->normalizeBranch($branch);
  18487. $prettyVersion = 'dev-' . $branch;
  18488. if ('9999999-dev' === $version) {
  18489. $version = $prettyVersion;
  18490. }
  18491. }
  18492. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  18493. try {
  18494. $version = $this->versionParser->normalize(trim($output));
  18495. $prettyVersion = trim($output);
  18496. } catch (\Exception $e) {
  18497. }
  18498. }
  18499. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18500. }
  18501. private function guessSvnVersion(array $packageConfig, $path)
  18502. {
  18503. SvnUtil::cleanEnv();
  18504. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  18505. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  18506. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  18507. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  18508. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  18509. if (preg_match($urlPattern, $output, $matches)) {
  18510. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  18511. $version = $this->versionParser->normalizeBranch($matches[3]);
  18512. $prettyVersion = 'dev-' . $matches[3];
  18513. if ('9999999-dev' === $version) {
  18514. $version = $prettyVersion;
  18515. }
  18516. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18517. }
  18518. $prettyVersion = trim($matches[1]);
  18519. $version = $this->versionParser->normalize($prettyVersion);
  18520. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  18521. }
  18522. }
  18523. }
  18524. }
  18525. <?php
  18526. namespace Composer\Package\Version;
  18527. use Composer\Repository\PlatformRepository;
  18528. use Composer\Semver\VersionParser as SemverVersionParser;
  18529. class VersionParser extends SemverVersionParser
  18530. {
  18531. private static $constraints = array();
  18532. public function parseConstraints($constraints)
  18533. {
  18534. if (!isset(self::$constraints[$constraints])) {
  18535. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  18536. }
  18537. return self::$constraints[$constraints];
  18538. }
  18539. public function parseNameVersionPairs(array $pairs)
  18540. {
  18541. $pairs = array_values($pairs);
  18542. $result = array();
  18543. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  18544. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  18545. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  18546. $pair .= ' '.$pairs[$i + 1];
  18547. $i++;
  18548. }
  18549. if (strpos($pair, ' ')) {
  18550. list($name, $version) = explode(' ', $pair, 2);
  18551. $result[] = array('name' => $name, 'version' => $version);
  18552. } else {
  18553. $result[] = array('name' => $pair);
  18554. }
  18555. }
  18556. return $result;
  18557. }
  18558. }
  18559. <?php
  18560. namespace Composer\Package\Version;
  18561. use Composer\DependencyResolver\Pool;
  18562. use Composer\Package\BasePackage;
  18563. use Composer\Package\PackageInterface;
  18564. use Composer\Package\Loader\ArrayLoader;
  18565. use Composer\Package\Dumper\ArrayDumper;
  18566. use Composer\Semver\Constraint\Constraint;
  18567. class VersionSelector
  18568. {
  18569. private $pool;
  18570. private $parser;
  18571. public function __construct(Pool $pool)
  18572. {
  18573. $this->pool = $pool;
  18574. }
  18575. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  18576. {
  18577. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  18578. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  18579. if ($targetPhpVersion) {
  18580. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  18581. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  18582. $reqs = $pkg->getRequires();
  18583. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  18584. });
  18585. }
  18586. if (!$candidates) {
  18587. return false;
  18588. }
  18589. $package = reset($candidates);
  18590. $minPriority = BasePackage::$stabilities[$preferredStability];
  18591. foreach ($candidates as $candidate) {
  18592. $candidatePriority = $candidate->getStabilityPriority();
  18593. $currentPriority = $package->getStabilityPriority();
  18594. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  18595. continue;
  18596. }
  18597. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  18598. $package = $candidate;
  18599. continue;
  18600. }
  18601. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  18602. $package = $candidate;
  18603. continue;
  18604. }
  18605. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  18606. $package = $candidate;
  18607. }
  18608. }
  18609. return $package;
  18610. }
  18611. public function findRecommendedRequireVersion(PackageInterface $package)
  18612. {
  18613. $version = $package->getVersion();
  18614. if (!$package->isDev()) {
  18615. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  18616. }
  18617. $loader = new ArrayLoader($this->getParser());
  18618. $dumper = new ArrayDumper();
  18619. $extra = $loader->getBranchAlias($dumper->dump($package));
  18620. if ($extra) {
  18621. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  18622. if ($count) {
  18623. $extra = str_replace('.9999999', '.0', $extra);
  18624. return $this->transformVersion($extra, $extra, 'dev');
  18625. }
  18626. }
  18627. return $package->getPrettyVersion();
  18628. }
  18629. private function transformVersion($version, $prettyVersion, $stability)
  18630. {
  18631. $semanticVersionParts = explode('.', $version);
  18632. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  18633. if ($semanticVersionParts[0] === '0') {
  18634. unset($semanticVersionParts[3]);
  18635. } else {
  18636. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  18637. }
  18638. $version = implode('.', $semanticVersionParts);
  18639. } else {
  18640. return $prettyVersion;
  18641. }
  18642. if ($stability != 'stable') {
  18643. $version .= '@'.$stability;
  18644. }
  18645. return '^' . $version;
  18646. }
  18647. private function getParser()
  18648. {
  18649. if ($this->parser === null) {
  18650. $this->parser = new VersionParser();
  18651. }
  18652. return $this->parser;
  18653. }
  18654. }
  18655. <?php
  18656. namespace Composer\Plugin\Capability;
  18657. interface Capability
  18658. {
  18659. }
  18660. <?php
  18661. namespace Composer\Plugin\Capability;
  18662. interface CommandProvider extends Capability
  18663. {
  18664. public function getCommands();
  18665. }
  18666. <?php
  18667. namespace Composer\Plugin;
  18668. interface Capable
  18669. {
  18670. public function getCapabilities();
  18671. }
  18672. <?php
  18673. namespace Composer\Plugin;
  18674. use Composer\EventDispatcher\Event;
  18675. use Symfony\Component\Console\Input\InputInterface;
  18676. use Symfony\Component\Console\Output\OutputInterface;
  18677. class CommandEvent extends Event
  18678. {
  18679. private $commandName;
  18680. private $input;
  18681. private $output;
  18682. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  18683. {
  18684. parent::__construct($name, $args, $flags);
  18685. $this->commandName = $commandName;
  18686. $this->input = $input;
  18687. $this->output = $output;
  18688. }
  18689. public function getInput()
  18690. {
  18691. return $this->input;
  18692. }
  18693. public function getOutput()
  18694. {
  18695. return $this->output;
  18696. }
  18697. public function getCommandName()
  18698. {
  18699. return $this->commandName;
  18700. }
  18701. }
  18702. <?php
  18703. namespace Composer\Plugin;
  18704. class PluginEvents
  18705. {
  18706. const INIT = 'init';
  18707. const COMMAND = 'command';
  18708. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  18709. }
  18710. <?php
  18711. namespace Composer\Plugin;
  18712. use Composer\Composer;
  18713. use Composer\IO\IOInterface;
  18714. interface PluginInterface
  18715. {
  18716. const PLUGIN_API_VERSION = '1.1.0';
  18717. public function activate(Composer $composer, IOInterface $io);
  18718. }
  18719. <?php
  18720. namespace Composer\Plugin;
  18721. use Composer\Composer;
  18722. use Composer\EventDispatcher\EventSubscriberInterface;
  18723. use Composer\IO\IOInterface;
  18724. use Composer\Package\Package;
  18725. use Composer\Package\Version\VersionParser;
  18726. use Composer\Repository\RepositoryInterface;
  18727. use Composer\Package\AliasPackage;
  18728. use Composer\Package\PackageInterface;
  18729. use Composer\Package\Link;
  18730. use Composer\Semver\Constraint\Constraint;
  18731. use Composer\DependencyResolver\Pool;
  18732. use Composer\Plugin\Capability\Capability;
  18733. class PluginManager
  18734. {
  18735. protected $composer;
  18736. protected $io;
  18737. protected $globalComposer;
  18738. protected $versionParser;
  18739. protected $disablePlugins = false;
  18740. protected $plugins = array();
  18741. protected $registeredPlugins = array();
  18742. private static $classCounter = 0;
  18743. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  18744. {
  18745. $this->io = $io;
  18746. $this->composer = $composer;
  18747. $this->globalComposer = $globalComposer;
  18748. $this->versionParser = new VersionParser();
  18749. $this->disablePlugins = $disablePlugins;
  18750. }
  18751. public function loadInstalledPlugins()
  18752. {
  18753. if ($this->disablePlugins) {
  18754. return;
  18755. }
  18756. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  18757. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  18758. if ($repo) {
  18759. $this->loadRepository($repo);
  18760. }
  18761. if ($globalRepo) {
  18762. $this->loadRepository($globalRepo);
  18763. }
  18764. }
  18765. public function getPlugins()
  18766. {
  18767. return $this->plugins;
  18768. }
  18769. public function getGlobalComposer()
  18770. {
  18771. return $this->globalComposer;
  18772. }
  18773. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  18774. {
  18775. if ($this->disablePlugins) {
  18776. return;
  18777. }
  18778. if ($package->getType() === 'composer-plugin') {
  18779. $requiresComposer = null;
  18780. foreach ($package->getRequires() as $link) {
  18781. if ('composer-plugin-api' === $link->getTarget()) {
  18782. $requiresComposer = $link->getConstraint();
  18783. break;
  18784. }
  18785. }
  18786. if (!$requiresComposer) {
  18787. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  18788. }
  18789. $currentPluginApiVersion = $this->getPluginApiVersion();
  18790. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  18791. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  18792. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example).</warning>');
  18793. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  18794. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
  18795. return;
  18796. }
  18797. }
  18798. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  18799. if (in_array($package->getName(), $this->registeredPlugins)) {
  18800. return;
  18801. }
  18802. $extra = $package->getExtra();
  18803. if (empty($extra['class'])) {
  18804. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  18805. }
  18806. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  18807. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  18808. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  18809. $pool = new Pool('dev');
  18810. $pool->addRepository($localRepo);
  18811. if ($globalRepo) {
  18812. $pool->addRepository($globalRepo);
  18813. }
  18814. $autoloadPackages = array($package->getName() => $package);
  18815. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  18816. $generator = $this->composer->getAutoloadGenerator();
  18817. $autoloads = array();
  18818. foreach ($autoloadPackages as $autoloadPackage) {
  18819. $downloadPath = $this->getInstallPath($autoloadPackage, ($globalRepo && $globalRepo->hasPackage($autoloadPackage)));
  18820. $autoloads[] = array($autoloadPackage, $downloadPath);
  18821. }
  18822. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  18823. $classLoader = $generator->createLoader($map);
  18824. $classLoader->register();
  18825. foreach ($classes as $class) {
  18826. if (class_exists($class, false)) {
  18827. $class = trim($class, '\\');
  18828. $path = $classLoader->findFile($class);
  18829. $code = file_get_contents($path);
  18830. $separatorPos = strrpos($class, '\\');
  18831. $className = $class;
  18832. if ($separatorPos) {
  18833. $className = substr($class, $separatorPos + 1);
  18834. }
  18835. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  18836. $code = str_replace('__FILE__', var_export($path, true), $code);
  18837. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  18838. $code = str_replace('__CLASS__', var_export($class, true), $code);
  18839. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  18840. eval($code);
  18841. $class .= '_composer_tmp'.self::$classCounter;
  18842. self::$classCounter++;
  18843. }
  18844. if ($oldInstallerPlugin) {
  18845. $installer = new $class($this->io, $this->composer);
  18846. $this->composer->getInstallationManager()->addInstaller($installer);
  18847. } elseif (class_exists($class)) {
  18848. $plugin = new $class();
  18849. $this->addPlugin($plugin);
  18850. $this->registeredPlugins[] = $package->getName();
  18851. } elseif ($failOnMissingClasses) {
  18852. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  18853. }
  18854. }
  18855. }
  18856. protected function getPluginApiVersion()
  18857. {
  18858. return PluginInterface::PLUGIN_API_VERSION;
  18859. }
  18860. public function addPlugin(PluginInterface $plugin)
  18861. {
  18862. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  18863. $this->plugins[] = $plugin;
  18864. $plugin->activate($this->composer, $this->io);
  18865. if ($plugin instanceof EventSubscriberInterface) {
  18866. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  18867. }
  18868. }
  18869. private function loadRepository(RepositoryInterface $repo)
  18870. {
  18871. foreach ($repo->getPackages() as $package) {
  18872. if ($package instanceof AliasPackage) {
  18873. continue;
  18874. }
  18875. if ('composer-plugin' === $package->getType()) {
  18876. $this->registerPackage($package);
  18877. } elseif ('composer-installer' === $package->getType()) {
  18878. $this->registerPackage($package);
  18879. }
  18880. }
  18881. }
  18882. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  18883. {
  18884. $requires = array_merge(
  18885. $package->getRequires(),
  18886. $package->getDevRequires()
  18887. );
  18888. foreach ($requires as $requireLink) {
  18889. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  18890. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  18891. $collected[$requiredPackage->getName()] = $requiredPackage;
  18892. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  18893. }
  18894. }
  18895. return $collected;
  18896. }
  18897. private function lookupInstalledPackage(Pool $pool, Link $link)
  18898. {
  18899. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  18900. return (!empty($packages)) ? $packages[0] : null;
  18901. }
  18902. private function getInstallPath(PackageInterface $package, $global = false)
  18903. {
  18904. if (!$global) {
  18905. return $this->composer->getInstallationManager()->getInstallPath($package);
  18906. }
  18907. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  18908. }
  18909. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  18910. {
  18911. if (!($plugin instanceof Capable)) {
  18912. return null;
  18913. }
  18914. $capabilities = (array) $plugin->getCapabilities();
  18915. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  18916. return trim($capabilities[$capability]);
  18917. }
  18918. if (
  18919. array_key_exists($capability, $capabilities)
  18920. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  18921. ) {
  18922. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  18923. }
  18924. }
  18925. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  18926. {
  18927. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  18928. if (!class_exists($capabilityClass)) {
  18929. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  18930. }
  18931. $ctorArgs['plugin'] = $plugin;
  18932. $capabilityObj = new $capabilityClass($ctorArgs);
  18933. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  18934. throw new \RuntimeException(
  18935. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  18936. );
  18937. }
  18938. return $capabilityObj;
  18939. }
  18940. }
  18941. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  18942. {
  18943. $capabilities = array();
  18944. foreach ($this->getPlugins() as $plugin) {
  18945. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  18946. $capabilities[] = $capability;
  18947. }
  18948. }
  18949. return $capabilities;
  18950. }
  18951. }
  18952. <?php
  18953. namespace Composer\Plugin;
  18954. use Composer\EventDispatcher\Event;
  18955. use Composer\Util\RemoteFilesystem;
  18956. class PreFileDownloadEvent extends Event
  18957. {
  18958. private $rfs;
  18959. private $processedUrl;
  18960. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  18961. {
  18962. parent::__construct($name);
  18963. $this->rfs = $rfs;
  18964. $this->processedUrl = $processedUrl;
  18965. }
  18966. public function getRemoteFilesystem()
  18967. {
  18968. return $this->rfs;
  18969. }
  18970. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  18971. {
  18972. $this->rfs = $rfs;
  18973. }
  18974. public function getProcessedUrl()
  18975. {
  18976. return $this->processedUrl;
  18977. }
  18978. }
  18979. <?php
  18980. namespace Composer\Question;
  18981. use Symfony\Component\Console\Exception\InvalidArgumentException;
  18982. use Symfony\Component\Console\Question\Question;
  18983. class StrictConfirmationQuestion extends Question
  18984. {
  18985. private $trueAnswerRegex;
  18986. private $falseAnswerRegex;
  18987. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  18988. {
  18989. parent::__construct($question, (bool) $default);
  18990. $this->trueAnswerRegex = $trueAnswerRegex;
  18991. $this->falseAnswerRegex = $falseAnswerRegex;
  18992. $this->setNormalizer($this->getDefaultNormalizer());
  18993. $this->setValidator($this->getDefaultValidator());
  18994. }
  18995. private function getDefaultNormalizer()
  18996. {
  18997. $default = $this->getDefault();
  18998. $trueRegex = $this->trueAnswerRegex;
  18999. $falseRegex = $this->falseAnswerRegex;
  19000. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  19001. if (is_bool($answer)) {
  19002. return $answer;
  19003. }
  19004. if (empty($answer) && !empty($default)) {
  19005. return $default;
  19006. }
  19007. if (preg_match($trueRegex, $answer)) {
  19008. return true;
  19009. }
  19010. if (preg_match($falseRegex, $answer)) {
  19011. return false;
  19012. }
  19013. return null;
  19014. };
  19015. }
  19016. private function getDefaultValidator()
  19017. {
  19018. return function ($answer) {
  19019. if (!is_bool($answer)) {
  19020. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  19021. }
  19022. return $answer;
  19023. };
  19024. }
  19025. }
  19026. <?php
  19027. namespace Composer\Repository;
  19028. use Composer\Package\AliasPackage;
  19029. use Composer\Package\PackageInterface;
  19030. use Composer\Package\CompletePackageInterface;
  19031. use Composer\Package\Version\VersionParser;
  19032. use Composer\Semver\Constraint\ConstraintInterface;
  19033. use Composer\Semver\Constraint\Constraint;
  19034. class ArrayRepository extends BaseRepository
  19035. {
  19036. protected $packages;
  19037. public function __construct(array $packages = array())
  19038. {
  19039. foreach ($packages as $package) {
  19040. $this->addPackage($package);
  19041. }
  19042. }
  19043. public function findPackage($name, $constraint)
  19044. {
  19045. $name = strtolower($name);
  19046. if (!$constraint instanceof ConstraintInterface) {
  19047. $versionParser = new VersionParser();
  19048. $constraint = $versionParser->parseConstraints($constraint);
  19049. }
  19050. foreach ($this->getPackages() as $package) {
  19051. if ($name === $package->getName()) {
  19052. $pkgConstraint = new Constraint('==', $package->getVersion());
  19053. if ($constraint->matches($pkgConstraint)) {
  19054. return $package;
  19055. }
  19056. }
  19057. }
  19058. return null;
  19059. }
  19060. public function findPackages($name, $constraint = null)
  19061. {
  19062. $name = strtolower($name);
  19063. $packages = array();
  19064. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19065. $versionParser = new VersionParser();
  19066. $constraint = $versionParser->parseConstraints($constraint);
  19067. }
  19068. foreach ($this->getPackages() as $package) {
  19069. if ($name === $package->getName()) {
  19070. $pkgConstraint = new Constraint('==', $package->getVersion());
  19071. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19072. $packages[] = $package;
  19073. }
  19074. }
  19075. }
  19076. return $packages;
  19077. }
  19078. public function search($query, $mode = 0, $type = null)
  19079. {
  19080. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19081. $matches = array();
  19082. foreach ($this->getPackages() as $package) {
  19083. $name = $package->getName();
  19084. if (isset($matches[$name])) {
  19085. continue;
  19086. }
  19087. if (preg_match($regex, $name)
  19088. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  19089. ) {
  19090. if (null !== $type && $package->getType() !== $type) {
  19091. continue;
  19092. }
  19093. $matches[$name] = array(
  19094. 'name' => $package->getPrettyName(),
  19095. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  19096. );
  19097. }
  19098. }
  19099. return array_values($matches);
  19100. }
  19101. public function hasPackage(PackageInterface $package)
  19102. {
  19103. $packageId = $package->getUniqueName();
  19104. foreach ($this->getPackages() as $repoPackage) {
  19105. if ($packageId === $repoPackage->getUniqueName()) {
  19106. return true;
  19107. }
  19108. }
  19109. return false;
  19110. }
  19111. public function addPackage(PackageInterface $package)
  19112. {
  19113. if (null === $this->packages) {
  19114. $this->initialize();
  19115. }
  19116. $package->setRepository($this);
  19117. $this->packages[] = $package;
  19118. if ($package instanceof AliasPackage) {
  19119. $aliasedPackage = $package->getAliasOf();
  19120. if (null === $aliasedPackage->getRepository()) {
  19121. $this->addPackage($aliasedPackage);
  19122. }
  19123. }
  19124. }
  19125. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  19126. {
  19127. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  19128. }
  19129. public function removePackage(PackageInterface $package)
  19130. {
  19131. $packageId = $package->getUniqueName();
  19132. foreach ($this->getPackages() as $key => $repoPackage) {
  19133. if ($packageId === $repoPackage->getUniqueName()) {
  19134. array_splice($this->packages, $key, 1);
  19135. return;
  19136. }
  19137. }
  19138. }
  19139. public function getPackages()
  19140. {
  19141. if (null === $this->packages) {
  19142. $this->initialize();
  19143. }
  19144. return $this->packages;
  19145. }
  19146. public function count()
  19147. {
  19148. return count($this->packages);
  19149. }
  19150. protected function initialize()
  19151. {
  19152. $this->packages = array();
  19153. }
  19154. }
  19155. <?php
  19156. namespace Composer\Repository;
  19157. use Composer\IO\IOInterface;
  19158. use Composer\Json\JsonFile;
  19159. use Composer\Package\Loader\ArrayLoader;
  19160. use Composer\Package\Loader\LoaderInterface;
  19161. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19162. {
  19163. protected $loader;
  19164. protected $lookup;
  19165. protected $repoConfig;
  19166. private $io;
  19167. public function __construct(array $repoConfig, IOInterface $io)
  19168. {
  19169. parent::__construct();
  19170. if (!extension_loaded('zip')) {
  19171. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  19172. }
  19173. $this->loader = new ArrayLoader();
  19174. $this->lookup = $repoConfig['url'];
  19175. $this->io = $io;
  19176. $this->repoConfig = $repoConfig;
  19177. }
  19178. public function getRepoConfig()
  19179. {
  19180. return $this->repoConfig;
  19181. }
  19182. protected function initialize()
  19183. {
  19184. parent::initialize();
  19185. $this->scanDirectory($this->lookup);
  19186. }
  19187. private function scanDirectory($path)
  19188. {
  19189. $io = $this->io;
  19190. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  19191. $iterator = new \RecursiveIteratorIterator($directory);
  19192. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  19193. foreach ($regex as $file) {
  19194. if (!$file->isFile()) {
  19195. continue;
  19196. }
  19197. $package = $this->getComposerInformation($file);
  19198. if (!$package) {
  19199. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  19200. continue;
  19201. }
  19202. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  19203. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  19204. $this->addPackage($package);
  19205. }
  19206. }
  19207. private function locateFile(\ZipArchive $zip, $filename)
  19208. {
  19209. $indexOfShortestMatch = false;
  19210. $lengthOfShortestMatch = -1;
  19211. for ($i = 0; $i < $zip->numFiles; $i++) {
  19212. $stat = $zip->statIndex($i);
  19213. if (strcmp(basename($stat['name']), $filename) === 0) {
  19214. $directoryName = dirname($stat['name']);
  19215. if ($directoryName == '.') {
  19216. return $i;
  19217. }
  19218. if (strpos($directoryName, '\\') !== false ||
  19219. strpos($directoryName, '/') !== false) {
  19220. continue;
  19221. }
  19222. $length = strlen($stat['name']);
  19223. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  19224. $contents = $zip->getFromIndex($i);
  19225. if ($contents !== false) {
  19226. $indexOfShortestMatch = $i;
  19227. $lengthOfShortestMatch = $length;
  19228. }
  19229. }
  19230. }
  19231. }
  19232. return $indexOfShortestMatch;
  19233. }
  19234. private function getComposerInformation(\SplFileInfo $file)
  19235. {
  19236. $zip = new \ZipArchive();
  19237. $zip->open($file->getPathname());
  19238. if (0 == $zip->numFiles) {
  19239. return false;
  19240. }
  19241. $foundFileIndex = $this->locateFile($zip, 'composer.json');
  19242. if (false === $foundFileIndex) {
  19243. return false;
  19244. }
  19245. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  19246. $composerFile = "zip://{$file->getPathname()}#$configurationFileName";
  19247. $json = file_get_contents($composerFile);
  19248. $package = JsonFile::parseJson($json, $composerFile);
  19249. $package['dist'] = array(
  19250. 'type' => 'zip',
  19251. 'url' => strtr($file->getPathname(), '\\', '/'),
  19252. 'shasum' => sha1_file($file->getRealPath()),
  19253. );
  19254. try {
  19255. $package = $this->loader->load($package);
  19256. } catch (\UnexpectedValueException $e) {
  19257. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  19258. }
  19259. return $package;
  19260. }
  19261. }
  19262. <?php
  19263. namespace Composer\Repository;
  19264. use Composer\Package\RootPackageInterface;
  19265. use Composer\Semver\Constraint\ConstraintInterface;
  19266. use Composer\Semver\Constraint\Constraint;
  19267. use Composer\Package\Link;
  19268. abstract class BaseRepository implements RepositoryInterface
  19269. {
  19270. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  19271. {
  19272. $needles = (array) $needle;
  19273. $results = array();
  19274. if (null === $packagesFound) {
  19275. $packagesFound = $needles;
  19276. }
  19277. $rootPackage = null;
  19278. foreach ($this->getPackages() as $package) {
  19279. if ($package instanceof RootPackageInterface) {
  19280. $rootPackage = $package;
  19281. break;
  19282. }
  19283. }
  19284. foreach ($this->getPackages() as $package) {
  19285. $links = $package->getRequires();
  19286. $packagesInTree = $packagesFound;
  19287. if (!$invert) {
  19288. $links += $package->getReplaces();
  19289. }
  19290. if ($package instanceof RootPackageInterface) {
  19291. $links += $package->getDevRequires();
  19292. }
  19293. foreach ($links as $link) {
  19294. foreach ($needles as $needle) {
  19295. if ($link->getTarget() === $needle) {
  19296. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  19297. if (in_array($link->getSource(), $packagesInTree)) {
  19298. $results[$link->getSource()] = array($package, $link, false);
  19299. continue;
  19300. }
  19301. $packagesInTree[] = $link->getSource();
  19302. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  19303. $results[$link->getSource()] = array($package, $link, $dependents);
  19304. }
  19305. }
  19306. }
  19307. }
  19308. if ($invert && in_array($package->getName(), $needles)) {
  19309. foreach ($package->getConflicts() as $link) {
  19310. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  19311. $version = new Constraint('=', $pkg->getVersion());
  19312. if ($link->getConstraint()->matches($version) === $invert) {
  19313. $results[] = array($package, $link, false);
  19314. }
  19315. }
  19316. }
  19317. }
  19318. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  19319. foreach ($package->getRequires() as $link) {
  19320. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  19321. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  19322. continue;
  19323. }
  19324. $platformPkg = $this->findPackage($link->getTarget(), '*');
  19325. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  19326. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  19327. continue;
  19328. }
  19329. foreach ($this->getPackages() as $pkg) {
  19330. if (!in_array($link->getTarget(), $pkg->getNames())) {
  19331. continue;
  19332. }
  19333. $version = new Constraint('=', $pkg->getVersion());
  19334. if (!$link->getConstraint()->matches($version)) {
  19335. if ($rootPackage) {
  19336. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  19337. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  19338. $results[] = array($package, $link, false);
  19339. $results[] = array($rootPackage, $rootReq, false);
  19340. continue 3;
  19341. }
  19342. }
  19343. $results[] = array($package, $link, false);
  19344. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  19345. } else {
  19346. $results[] = array($package, $link, false);
  19347. }
  19348. }
  19349. continue 2;
  19350. }
  19351. }
  19352. }
  19353. }
  19354. ksort($results);
  19355. return $results;
  19356. }
  19357. }
  19358. <?php
  19359. namespace Composer\Repository;
  19360. use Composer\Package\Loader\ArrayLoader;
  19361. use Composer\Package\PackageInterface;
  19362. use Composer\Package\AliasPackage;
  19363. use Composer\Package\Version\VersionParser;
  19364. use Composer\DependencyResolver\Pool;
  19365. use Composer\Json\JsonFile;
  19366. use Composer\Cache;
  19367. use Composer\Config;
  19368. use Composer\Factory;
  19369. use Composer\IO\IOInterface;
  19370. use Composer\Util\RemoteFilesystem;
  19371. use Composer\Plugin\PluginEvents;
  19372. use Composer\Plugin\PreFileDownloadEvent;
  19373. use Composer\EventDispatcher\EventDispatcher;
  19374. use Composer\Downloader\TransportException;
  19375. use Composer\Semver\Constraint\ConstraintInterface;
  19376. use Composer\Semver\Constraint\Constraint;
  19377. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  19378. {
  19379. protected $config;
  19380. protected $repoConfig;
  19381. protected $options;
  19382. protected $url;
  19383. protected $baseUrl;
  19384. protected $io;
  19385. protected $rfs;
  19386. protected $cache;
  19387. protected $notifyUrl;
  19388. protected $searchUrl;
  19389. protected $hasProviders = false;
  19390. protected $providersUrl;
  19391. protected $lazyProvidersUrl;
  19392. protected $providerListing;
  19393. protected $providers = array();
  19394. protected $providersByUid = array();
  19395. protected $loader;
  19396. protected $rootAliases;
  19397. protected $allowSslDowngrade = false;
  19398. protected $eventDispatcher;
  19399. protected $sourceMirrors;
  19400. protected $distMirrors;
  19401. private $degradedMode = false;
  19402. private $rootData;
  19403. private $hasPartialPackages;
  19404. private $partialPackagesByName;
  19405. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  19406. {
  19407. parent::__construct();
  19408. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  19409. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  19410. }
  19411. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  19412. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  19413. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  19414. }
  19415. $urlBits = parse_url($repoConfig['url']);
  19416. if ($urlBits === false || empty($urlBits['scheme'])) {
  19417. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  19418. }
  19419. if (!isset($repoConfig['options'])) {
  19420. $repoConfig['options'] = array();
  19421. }
  19422. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  19423. $this->allowSslDowngrade = true;
  19424. }
  19425. $this->config = $config;
  19426. $this->options = $repoConfig['options'];
  19427. $this->url = $repoConfig['url'];
  19428. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  19429. $this->io = $io;
  19430. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  19431. $this->loader = new ArrayLoader();
  19432. if ($rfs && $this->options) {
  19433. $rfs = clone $rfs;
  19434. $rfs->setOptions($this->options);
  19435. }
  19436. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  19437. $this->eventDispatcher = $eventDispatcher;
  19438. $this->repoConfig = $repoConfig;
  19439. }
  19440. public function getRepoConfig()
  19441. {
  19442. return $this->repoConfig;
  19443. }
  19444. public function setRootAliases(array $rootAliases)
  19445. {
  19446. $this->rootAliases = $rootAliases;
  19447. }
  19448. public function findPackage($name, $constraint)
  19449. {
  19450. if (!$this->hasProviders()) {
  19451. return parent::findPackage($name, $constraint);
  19452. }
  19453. $name = strtolower($name);
  19454. if (!$constraint instanceof ConstraintInterface) {
  19455. $versionParser = new VersionParser();
  19456. $constraint = $versionParser->parseConstraints($constraint);
  19457. }
  19458. foreach ($this->getProviderNames() as $providerName) {
  19459. if ($name === $providerName) {
  19460. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  19461. foreach ($packages as $package) {
  19462. if ($name === $package->getName()) {
  19463. $pkgConstraint = new Constraint('==', $package->getVersion());
  19464. if ($constraint->matches($pkgConstraint)) {
  19465. return $package;
  19466. }
  19467. }
  19468. }
  19469. break;
  19470. }
  19471. }
  19472. }
  19473. public function findPackages($name, $constraint = null)
  19474. {
  19475. if (!$this->hasProviders()) {
  19476. return parent::findPackages($name, $constraint);
  19477. }
  19478. $name = strtolower($name);
  19479. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  19480. $versionParser = new VersionParser();
  19481. $constraint = $versionParser->parseConstraints($constraint);
  19482. }
  19483. $packages = array();
  19484. foreach ($this->getProviderNames() as $providerName) {
  19485. if ($name === $providerName) {
  19486. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  19487. foreach ($candidates as $package) {
  19488. if ($name === $package->getName()) {
  19489. $pkgConstraint = new Constraint('==', $package->getVersion());
  19490. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  19491. $packages[] = $package;
  19492. }
  19493. }
  19494. }
  19495. break;
  19496. }
  19497. }
  19498. return $packages;
  19499. }
  19500. public function getPackages()
  19501. {
  19502. if ($this->hasProviders()) {
  19503. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  19504. }
  19505. return parent::getPackages();
  19506. }
  19507. public function search($query, $mode = 0, $type = null)
  19508. {
  19509. $this->loadRootServerFile();
  19510. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  19511. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  19512. $hostname = parse_url($url, PHP_URL_HOST) ?: $url;
  19513. $json = $this->rfs->getContents($hostname, $url, false);
  19514. $results = JsonFile::parseJson($json, $url);
  19515. return $results['results'];
  19516. }
  19517. if ($this->hasProviders()) {
  19518. $results = array();
  19519. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  19520. foreach ($this->getProviderNames() as $name) {
  19521. if (preg_match($regex, $name)) {
  19522. $results[] = array('name' => $name);
  19523. }
  19524. }
  19525. return $results;
  19526. }
  19527. return parent::search($query, $mode);
  19528. }
  19529. public function getProviderNames()
  19530. {
  19531. $this->loadRootServerFile();
  19532. if (null === $this->providerListing) {
  19533. $this->loadProviderListings($this->loadRootServerFile());
  19534. }
  19535. if ($this->lazyProvidersUrl) {
  19536. return array();
  19537. }
  19538. if ($this->providersUrl) {
  19539. return array_keys($this->providerListing);
  19540. }
  19541. return array();
  19542. }
  19543. protected function configurePackageTransportOptions(PackageInterface $package)
  19544. {
  19545. foreach ($package->getDistUrls() as $url) {
  19546. if (strpos($url, $this->baseUrl) === 0) {
  19547. $package->setTransportOptions($this->options);
  19548. return;
  19549. }
  19550. }
  19551. }
  19552. public function hasProviders()
  19553. {
  19554. $this->loadRootServerFile();
  19555. return $this->hasProviders;
  19556. }
  19557. public function resetPackageIds()
  19558. {
  19559. foreach ($this->providersByUid as $package) {
  19560. if ($package instanceof AliasPackage) {
  19561. $package->getAliasOf()->setId(-1);
  19562. }
  19563. $package->setId(-1);
  19564. }
  19565. }
  19566. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  19567. {
  19568. if (isset($this->providers[$name]) && !$bypassFilters) {
  19569. return $this->providers[$name];
  19570. }
  19571. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  19572. $this->initializePartialPackages();
  19573. }
  19574. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  19575. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  19576. return array();
  19577. }
  19578. if (null === $this->providerListing) {
  19579. $this->loadProviderListings($this->loadRootServerFile());
  19580. }
  19581. $useLastModifiedCheck = false;
  19582. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  19583. $hash = null;
  19584. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  19585. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  19586. $useLastModifiedCheck = true;
  19587. } elseif ($this->providersUrl) {
  19588. if (!isset($this->providerListing[$name])) {
  19589. return array();
  19590. }
  19591. $hash = $this->providerListing[$name]['sha256'];
  19592. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  19593. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  19594. } else {
  19595. return array();
  19596. }
  19597. $packages = null;
  19598. if ($cacheKey) {
  19599. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  19600. $packages = json_decode($this->cache->read($cacheKey), true);
  19601. } elseif ($useLastModifiedCheck) {
  19602. if ($contents = $this->cache->read($cacheKey)) {
  19603. $contents = json_decode($contents, true);
  19604. if (isset($contents['last-modified'])) {
  19605. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  19606. if (true === $response) {
  19607. $packages = $contents;
  19608. } elseif ($response) {
  19609. $packages = $response;
  19610. }
  19611. }
  19612. }
  19613. }
  19614. }
  19615. if (!$packages) {
  19616. try {
  19617. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  19618. } catch (TransportException $e) {
  19619. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  19620. $packages = array('packages' => array());
  19621. } else {
  19622. throw $e;
  19623. }
  19624. }
  19625. }
  19626. $loadingPartialPackage = false;
  19627. } else {
  19628. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  19629. $loadingPartialPackage = true;
  19630. }
  19631. $this->providers[$name] = array();
  19632. foreach ($packages['packages'] as $versions) {
  19633. foreach ($versions as $version) {
  19634. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  19635. continue;
  19636. }
  19637. if (isset($this->providersByUid[$version['uid']])) {
  19638. if (!isset($this->providers[$name][$version['uid']])) {
  19639. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  19640. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  19641. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  19642. } else {
  19643. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  19644. }
  19645. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  19646. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  19647. }
  19648. }
  19649. } else {
  19650. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  19651. continue;
  19652. }
  19653. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  19654. $package->setRepository($this);
  19655. if ($package instanceof AliasPackage) {
  19656. $aliased = $package->getAliasOf();
  19657. $aliased->setRepository($this);
  19658. $this->providers[$name][$version['uid']] = $aliased;
  19659. $this->providers[$name][$version['uid'].'-alias'] = $package;
  19660. $this->providersByUid[$version['uid']] = $package;
  19661. } else {
  19662. $this->providers[$name][$version['uid']] = $package;
  19663. $this->providersByUid[$version['uid']] = $package;
  19664. }
  19665. unset($rootAliasData);
  19666. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  19667. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  19668. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  19669. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  19670. }
  19671. if (isset($rootAliasData)) {
  19672. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  19673. $alias->setRepository($this);
  19674. $this->providers[$name][$version['uid'].'-root'] = $alias;
  19675. $this->providersByUid[$version['uid'].'-root'] = $alias;
  19676. }
  19677. }
  19678. }
  19679. }
  19680. $result = $this->providers[$name];
  19681. if ($bypassFilters) {
  19682. foreach ($this->providers[$name] as $uid => $provider) {
  19683. unset($this->providersByUid[$uid]);
  19684. }
  19685. unset($this->providers[$name]);
  19686. }
  19687. return $result;
  19688. }
  19689. protected function initialize()
  19690. {
  19691. parent::initialize();
  19692. $repoData = $this->loadDataFromServer();
  19693. foreach ($repoData as $package) {
  19694. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  19695. }
  19696. }
  19697. public function addPackage(PackageInterface $package)
  19698. {
  19699. parent::addPackage($package);
  19700. $this->configurePackageTransportOptions($package);
  19701. }
  19702. protected function loadRootServerFile()
  19703. {
  19704. if (null !== $this->rootData) {
  19705. return $this->rootData;
  19706. }
  19707. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  19708. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  19709. }
  19710. $jsonUrlParts = parse_url($this->url);
  19711. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  19712. $jsonUrl = $this->url;
  19713. } else {
  19714. $jsonUrl = $this->url . '/packages.json';
  19715. }
  19716. $data = $this->fetchFile($jsonUrl, 'packages.json');
  19717. if (!empty($data['notify-batch'])) {
  19718. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  19719. } elseif (!empty($data['notify'])) {
  19720. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  19721. }
  19722. if (!empty($data['search'])) {
  19723. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  19724. }
  19725. if (!empty($data['mirrors'])) {
  19726. foreach ($data['mirrors'] as $mirror) {
  19727. if (!empty($mirror['git-url'])) {
  19728. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  19729. }
  19730. if (!empty($mirror['hg-url'])) {
  19731. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  19732. }
  19733. if (!empty($mirror['dist-url'])) {
  19734. $this->distMirrors[] = array(
  19735. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  19736. 'preferred' => !empty($mirror['preferred']),
  19737. );
  19738. }
  19739. }
  19740. }
  19741. if (!empty($data['providers-lazy-url'])) {
  19742. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  19743. $this->hasProviders = true;
  19744. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  19745. }
  19746. if ($this->allowSslDowngrade) {
  19747. $this->url = str_replace('https://', 'http://', $this->url);
  19748. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  19749. }
  19750. if (!empty($data['providers-url'])) {
  19751. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  19752. $this->hasProviders = true;
  19753. }
  19754. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  19755. $this->hasProviders = true;
  19756. }
  19757. if (preg_match('{^https?://packagist.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  19758. $this->url = 'https://packagist.org';
  19759. $this->baseUrl = 'https://packagist.org';
  19760. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://packagist.org/p/%package%.json');
  19761. $this->providersUrl = null;
  19762. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  19763. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  19764. $this->providersUrl = null;
  19765. }
  19766. return $this->rootData = $data;
  19767. }
  19768. protected function canonicalizeUrl($url)
  19769. {
  19770. if ('/' === $url[0]) {
  19771. return preg_replace('{(https?://[^/]+).*}i', '$1' . $url, $this->url);
  19772. }
  19773. return $url;
  19774. }
  19775. protected function loadDataFromServer()
  19776. {
  19777. $data = $this->loadRootServerFile();
  19778. return $this->loadIncludes($data);
  19779. }
  19780. protected function loadProviderListings($data)
  19781. {
  19782. if (isset($data['providers'])) {
  19783. if (!is_array($this->providerListing)) {
  19784. $this->providerListing = array();
  19785. }
  19786. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  19787. }
  19788. if ($this->providersUrl && isset($data['provider-includes'])) {
  19789. $includes = $data['provider-includes'];
  19790. foreach ($includes as $include => $metadata) {
  19791. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  19792. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  19793. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  19794. $includedData = json_decode($this->cache->read($cacheKey), true);
  19795. } else {
  19796. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  19797. }
  19798. $this->loadProviderListings($includedData);
  19799. }
  19800. }
  19801. }
  19802. protected function loadIncludes($data)
  19803. {
  19804. $packages = array();
  19805. if (!isset($data['packages']) && !isset($data['includes'])) {
  19806. foreach ($data as $pkg) {
  19807. foreach ($pkg['versions'] as $metadata) {
  19808. $packages[] = $metadata;
  19809. }
  19810. }
  19811. return $packages;
  19812. }
  19813. if (isset($data['packages'])) {
  19814. foreach ($data['packages'] as $package => $versions) {
  19815. foreach ($versions as $version => $metadata) {
  19816. $packages[] = $metadata;
  19817. }
  19818. }
  19819. }
  19820. if (isset($data['includes'])) {
  19821. foreach ($data['includes'] as $include => $metadata) {
  19822. if ($this->cache->sha1($include) === $metadata['sha1']) {
  19823. $includedData = json_decode($this->cache->read($include), true);
  19824. } else {
  19825. $includedData = $this->fetchFile($include);
  19826. }
  19827. $packages = array_merge($packages, $this->loadIncludes($includedData));
  19828. }
  19829. }
  19830. return $packages;
  19831. }
  19832. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  19833. {
  19834. try {
  19835. if (!isset($data['notification-url'])) {
  19836. $data['notification-url'] = $this->notifyUrl;
  19837. }
  19838. $package = $this->loader->load($data, $class);
  19839. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  19840. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  19841. }
  19842. $package->setDistMirrors($this->distMirrors);
  19843. $this->configurePackageTransportOptions($package);
  19844. return $package;
  19845. } catch (\Exception $e) {
  19846. throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  19847. }
  19848. }
  19849. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  19850. {
  19851. if (null === $cacheKey) {
  19852. $cacheKey = $filename;
  19853. $filename = $this->baseUrl.'/'.$filename;
  19854. }
  19855. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  19856. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  19857. }
  19858. $retries = 3;
  19859. while ($retries--) {
  19860. try {
  19861. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  19862. if ($this->eventDispatcher) {
  19863. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  19864. }
  19865. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  19866. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  19867. $json = $rfs->getContents($hostname, $filename, false);
  19868. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  19869. if ($this->allowSslDowngrade) {
  19870. $this->url = str_replace('http://', 'https://', $this->url);
  19871. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  19872. $filename = str_replace('http://', 'https://', $filename);
  19873. }
  19874. if ($retries) {
  19875. usleep(100000);
  19876. continue;
  19877. }
  19878. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This could indicate a man-in-the-middle attack or e.g. antivirus software corrupting files. Try running composer again and report this if you think it is a mistake.');
  19879. }
  19880. $data = JsonFile::parseJson($json, $filename);
  19881. if (!empty($data['warning'])) {
  19882. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  19883. }
  19884. if (!empty($data['info'])) {
  19885. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  19886. }
  19887. if ($cacheKey) {
  19888. if ($storeLastModifiedTime) {
  19889. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  19890. if ($lastModifiedDate) {
  19891. $data['last-modified'] = $lastModifiedDate;
  19892. $json = json_encode($data);
  19893. }
  19894. }
  19895. $this->cache->write($cacheKey, $json);
  19896. }
  19897. break;
  19898. } catch (\Exception $e) {
  19899. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  19900. throw $e;
  19901. }
  19902. if ($retries) {
  19903. usleep(100000);
  19904. continue;
  19905. }
  19906. if ($e instanceof RepositorySecurityException) {
  19907. throw $e;
  19908. }
  19909. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  19910. if (!$this->degradedMode) {
  19911. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  19912. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  19913. }
  19914. $this->degradedMode = true;
  19915. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  19916. break;
  19917. }
  19918. throw $e;
  19919. }
  19920. }
  19921. return $data;
  19922. }
  19923. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  19924. {
  19925. $retries = 3;
  19926. while ($retries--) {
  19927. try {
  19928. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  19929. if ($this->eventDispatcher) {
  19930. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  19931. }
  19932. $hostname = parse_url($filename, PHP_URL_HOST) ?: $filename;
  19933. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  19934. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  19935. $json = $rfs->getContents($hostname, $filename, false, $options);
  19936. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  19937. return true;
  19938. }
  19939. $data = JsonFile::parseJson($json, $filename);
  19940. if (!empty($data['warning'])) {
  19941. $this->io->writeError('<warning>Warning from '.$this->url.': '.$data['warning'].'</warning>');
  19942. }
  19943. if (!empty($data['info'])) {
  19944. $this->io->writeError('<info>Info from '.$this->url.': '.$data['info'].'</info>');
  19945. }
  19946. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  19947. if ($lastModifiedDate) {
  19948. $data['last-modified'] = $lastModifiedDate;
  19949. $json = json_encode($data);
  19950. }
  19951. $this->cache->write($cacheKey, $json);
  19952. return $data;
  19953. } catch (\Exception $e) {
  19954. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  19955. throw $e;
  19956. }
  19957. if ($retries) {
  19958. usleep(100000);
  19959. continue;
  19960. }
  19961. if (!$this->degradedMode) {
  19962. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  19963. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  19964. }
  19965. $this->degradedMode = true;
  19966. return true;
  19967. }
  19968. }
  19969. }
  19970. private function initializePartialPackages()
  19971. {
  19972. $rootData = $this->loadRootServerFile();
  19973. $this->partialPackagesByName = array();
  19974. foreach ($rootData['packages'] as $package => $versions) {
  19975. $package = strtolower($package);
  19976. foreach ($versions as $version) {
  19977. $this->partialPackagesByName[$package][] = $version;
  19978. if (!empty($version['provide']) && is_array($version['provide'])) {
  19979. foreach ($version['provide'] as $provided => $providedVersion) {
  19980. $this->partialPackagesByName[strtolower($provided)][] = $version;
  19981. }
  19982. }
  19983. if (!empty($version['replace']) && is_array($version['replace'])) {
  19984. foreach ($version['replace'] as $provided => $providedVersion) {
  19985. $this->partialPackagesByName[strtolower($provided)][] = $version;
  19986. }
  19987. }
  19988. }
  19989. }
  19990. $this->rootData = true;
  19991. }
  19992. }
  19993. <?php
  19994. namespace Composer\Repository;
  19995. use Composer\Package\PackageInterface;
  19996. class CompositeRepository extends BaseRepository
  19997. {
  19998. private $repositories;
  19999. public function __construct(array $repositories)
  20000. {
  20001. $this->repositories = array();
  20002. foreach ($repositories as $repo) {
  20003. $this->addRepository($repo);
  20004. }
  20005. }
  20006. public function getRepositories()
  20007. {
  20008. return $this->repositories;
  20009. }
  20010. public function hasPackage(PackageInterface $package)
  20011. {
  20012. foreach ($this->repositories as $repository) {
  20013. if ($repository->hasPackage($package)) {
  20014. return true;
  20015. }
  20016. }
  20017. return false;
  20018. }
  20019. public function findPackage($name, $constraint)
  20020. {
  20021. foreach ($this->repositories as $repository) {
  20022. $package = $repository->findPackage($name, $constraint);
  20023. if (null !== $package) {
  20024. return $package;
  20025. }
  20026. }
  20027. return null;
  20028. }
  20029. public function findPackages($name, $constraint = null)
  20030. {
  20031. $packages = array();
  20032. foreach ($this->repositories as $repository) {
  20033. $packages[] = $repository->findPackages($name, $constraint);
  20034. }
  20035. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20036. }
  20037. public function search($query, $mode = 0, $type = null)
  20038. {
  20039. $matches = array();
  20040. foreach ($this->repositories as $repository) {
  20041. $matches[] = $repository->search($query, $mode, $type);
  20042. }
  20043. return $matches ? call_user_func_array('array_merge', $matches) : array();
  20044. }
  20045. public function getPackages()
  20046. {
  20047. $packages = array();
  20048. foreach ($this->repositories as $repository) {
  20049. $packages[] = $repository->getPackages();
  20050. }
  20051. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20052. }
  20053. public function removePackage(PackageInterface $package)
  20054. {
  20055. foreach ($this->repositories as $repository) {
  20056. $repository->removePackage($package);
  20057. }
  20058. }
  20059. public function count()
  20060. {
  20061. $total = 0;
  20062. foreach ($this->repositories as $repository) {
  20063. $total += $repository->count();
  20064. }
  20065. return $total;
  20066. }
  20067. public function addRepository(RepositoryInterface $repository)
  20068. {
  20069. if ($repository instanceof self) {
  20070. foreach ($repository->getRepositories() as $repo) {
  20071. $this->addRepository($repo);
  20072. }
  20073. } else {
  20074. $this->repositories[] = $repository;
  20075. }
  20076. }
  20077. }
  20078. <?php
  20079. namespace Composer\Repository;
  20080. interface ConfigurableRepositoryInterface
  20081. {
  20082. public function getRepoConfig();
  20083. }
  20084. <?php
  20085. namespace Composer\Repository;
  20086. use Composer\Json\JsonFile;
  20087. use Composer\Package\Loader\ArrayLoader;
  20088. use Composer\Package\Dumper\ArrayDumper;
  20089. class FilesystemRepository extends WritableArrayRepository
  20090. {
  20091. private $file;
  20092. public function __construct(JsonFile $repositoryFile)
  20093. {
  20094. parent::__construct();
  20095. $this->file = $repositoryFile;
  20096. }
  20097. protected function initialize()
  20098. {
  20099. parent::initialize();
  20100. if (!$this->file->exists()) {
  20101. return;
  20102. }
  20103. try {
  20104. $packages = $this->file->read();
  20105. if (!is_array($packages)) {
  20106. throw new \UnexpectedValueException('Could not parse package list from the repository');
  20107. }
  20108. } catch (\Exception $e) {
  20109. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  20110. }
  20111. $loader = new ArrayLoader(null, true);
  20112. foreach ($packages as $packageData) {
  20113. $package = $loader->load($packageData);
  20114. $this->addPackage($package);
  20115. }
  20116. }
  20117. public function reload()
  20118. {
  20119. $this->packages = null;
  20120. $this->initialize();
  20121. }
  20122. public function write()
  20123. {
  20124. $data = array();
  20125. $dumper = new ArrayDumper();
  20126. foreach ($this->getCanonicalPackages() as $package) {
  20127. $data[] = $dumper->dump($package);
  20128. }
  20129. usort($data, function ($a, $b) {
  20130. return strcmp($a['name'], $b['name']);
  20131. });
  20132. $this->file->write($data);
  20133. }
  20134. }
  20135. <?php
  20136. namespace Composer\Repository;
  20137. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  20138. {
  20139. }
  20140. <?php
  20141. namespace Composer\Repository;
  20142. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  20143. {
  20144. }
  20145. <?php
  20146. namespace Composer\Repository;
  20147. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  20148. {
  20149. }
  20150. <?php
  20151. namespace Composer\Repository;
  20152. class InvalidRepositoryException extends \Exception
  20153. {
  20154. }
  20155. <?php
  20156. namespace Composer\Repository;
  20157. use Composer\Package\Loader\ArrayLoader;
  20158. use Composer\Package\Loader\ValidatingArrayLoader;
  20159. class PackageRepository extends ArrayRepository
  20160. {
  20161. private $config;
  20162. public function __construct(array $config)
  20163. {
  20164. parent::__construct();
  20165. $this->config = $config['package'];
  20166. if (!is_numeric(key($this->config))) {
  20167. $this->config = array($this->config);
  20168. }
  20169. }
  20170. protected function initialize()
  20171. {
  20172. parent::initialize();
  20173. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  20174. foreach ($this->config as $package) {
  20175. try {
  20176. $package = $loader->load($package);
  20177. } catch (\Exception $e) {
  20178. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  20179. }
  20180. $this->addPackage($package);
  20181. }
  20182. }
  20183. }
  20184. <?php
  20185. namespace Composer\Repository;
  20186. use Composer\Config;
  20187. use Composer\IO\IOInterface;
  20188. use Composer\Json\JsonFile;
  20189. use Composer\Package\Loader\ArrayLoader;
  20190. use Composer\Package\Version\VersionGuesser;
  20191. use Composer\Package\Version\VersionParser;
  20192. use Composer\Util\Platform;
  20193. use Composer\Util\ProcessExecutor;
  20194. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20195. {
  20196. private $loader;
  20197. private $versionGuesser;
  20198. private $url;
  20199. private $repoConfig;
  20200. private $process;
  20201. private $options;
  20202. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  20203. {
  20204. if (!isset($repoConfig['url'])) {
  20205. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  20206. }
  20207. $this->loader = new ArrayLoader(null, true);
  20208. $this->url = Platform::expandPath($repoConfig['url']);
  20209. $this->process = new ProcessExecutor($io);
  20210. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  20211. $this->repoConfig = $repoConfig;
  20212. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  20213. parent::__construct();
  20214. }
  20215. public function getRepoConfig()
  20216. {
  20217. return $this->repoConfig;
  20218. }
  20219. protected function initialize()
  20220. {
  20221. parent::initialize();
  20222. foreach ($this->getUrlMatches() as $url) {
  20223. $path = realpath($url) . DIRECTORY_SEPARATOR;
  20224. $composerFilePath = $path.'composer.json';
  20225. if (!file_exists($composerFilePath)) {
  20226. continue;
  20227. }
  20228. $json = file_get_contents($composerFilePath);
  20229. $package = JsonFile::parseJson($json, $composerFilePath);
  20230. $package['dist'] = array(
  20231. 'type' => 'path',
  20232. 'url' => $url,
  20233. 'reference' => sha1($json . serialize($this->options)),
  20234. );
  20235. $package['transport-options'] = $this->options;
  20236. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  20237. if (
  20238. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  20239. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  20240. && $ref1 === $ref2
  20241. ) {
  20242. $package['version'] = $rootVersion;
  20243. }
  20244. }
  20245. if (!isset($package['version'])) {
  20246. $versionData = $this->versionGuesser->guessVersion($package, $path);
  20247. $package['version'] = $versionData['version'] ?: 'dev-master';
  20248. }
  20249. $output = '';
  20250. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  20251. $package['dist']['reference'] = trim($output);
  20252. }
  20253. $package = $this->loader->load($package);
  20254. $this->addPackage($package);
  20255. }
  20256. }
  20257. private function getUrlMatches()
  20258. {
  20259. return array_map(function ($val) {
  20260. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  20261. }, glob($this->url, GLOB_MARK | GLOB_ONLYDIR));
  20262. }
  20263. }
  20264. <?php
  20265. namespace Composer\Repository\Pear;
  20266. use Composer\Util\RemoteFilesystem;
  20267. abstract class BaseChannelReader
  20268. {
  20269. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  20270. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  20271. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  20272. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  20273. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  20274. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  20275. private $rfs;
  20276. protected function __construct(RemoteFilesystem $rfs)
  20277. {
  20278. $this->rfs = $rfs;
  20279. }
  20280. protected function requestContent($origin, $path)
  20281. {
  20282. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  20283. $content = $this->rfs->getContents($origin, $url, false);
  20284. if (!$content) {
  20285. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  20286. }
  20287. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  20288. }
  20289. protected function requestXml($origin, $path)
  20290. {
  20291. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  20292. if (false === $xml) {
  20293. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  20294. }
  20295. return $xml;
  20296. }
  20297. }
  20298. <?php
  20299. namespace Composer\Repository\Pear;
  20300. class ChannelInfo
  20301. {
  20302. private $name;
  20303. private $alias;
  20304. private $packages;
  20305. public function __construct($name, $alias, array $packages)
  20306. {
  20307. $this->name = $name;
  20308. $this->alias = $alias;
  20309. $this->packages = $packages;
  20310. }
  20311. public function getName()
  20312. {
  20313. return $this->name;
  20314. }
  20315. public function getAlias()
  20316. {
  20317. return $this->alias;
  20318. }
  20319. public function getPackages()
  20320. {
  20321. return $this->packages;
  20322. }
  20323. }
  20324. <?php
  20325. namespace Composer\Repository\Pear;
  20326. use Composer\Util\RemoteFilesystem;
  20327. class ChannelReader extends BaseChannelReader
  20328. {
  20329. private $readerMap;
  20330. public function __construct(RemoteFilesystem $rfs)
  20331. {
  20332. parent::__construct($rfs);
  20333. $rest10reader = new ChannelRest10Reader($rfs);
  20334. $rest11reader = new ChannelRest11Reader($rfs);
  20335. $this->readerMap = array(
  20336. 'REST1.3' => $rest11reader,
  20337. 'REST1.2' => $rest11reader,
  20338. 'REST1.1' => $rest11reader,
  20339. 'REST1.0' => $rest10reader,
  20340. );
  20341. }
  20342. public function read($url)
  20343. {
  20344. $xml = $this->requestXml($url, "/channel.xml");
  20345. $channelName = (string) $xml->name;
  20346. $channelAlias = (string) $xml->suggestedalias;
  20347. $supportedVersions = array_keys($this->readerMap);
  20348. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  20349. if (!$selectedRestVersion) {
  20350. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  20351. }
  20352. $reader = $this->readerMap[$selectedRestVersion['version']];
  20353. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  20354. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  20355. }
  20356. private function selectRestVersion($channelXml, $supportedVersions)
  20357. {
  20358. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  20359. foreach ($supportedVersions as $version) {
  20360. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  20361. $testResult = $channelXml->xpath($xpathTest);
  20362. foreach ($testResult as $result) {
  20363. $result = (string) $result;
  20364. if (preg_match('{^https://}i', $result)) {
  20365. return array('version' => $version, 'baseUrl' => $result);
  20366. }
  20367. }
  20368. if (count($testResult) > 0) {
  20369. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  20370. }
  20371. }
  20372. return null;
  20373. }
  20374. }
  20375. <?php
  20376. namespace Composer\Repository\Pear;
  20377. use Composer\Downloader\TransportException;
  20378. class ChannelRest10Reader extends BaseChannelReader
  20379. {
  20380. private $dependencyReader;
  20381. public function __construct($rfs)
  20382. {
  20383. parent::__construct($rfs);
  20384. $this->dependencyReader = new PackageDependencyParser();
  20385. }
  20386. public function read($baseUrl)
  20387. {
  20388. return $this->readPackages($baseUrl);
  20389. }
  20390. private function readPackages($baseUrl)
  20391. {
  20392. $result = array();
  20393. $xmlPath = '/p/packages.xml';
  20394. $xml = $this->requestXml($baseUrl, $xmlPath);
  20395. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  20396. foreach ($xml->xpath('ns:p') as $node) {
  20397. $packageName = (string) $node;
  20398. $packageInfo = $this->readPackage($baseUrl, $packageName);
  20399. $result[] = $packageInfo;
  20400. }
  20401. return $result;
  20402. }
  20403. private function readPackage($baseUrl, $packageName)
  20404. {
  20405. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  20406. $xml = $this->requestXml($baseUrl, $xmlPath);
  20407. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  20408. $channelName = (string) $xml->c;
  20409. $packageName = (string) $xml->n;
  20410. $license = (string) $xml->l;
  20411. $shortDescription = (string) $xml->s;
  20412. $description = (string) $xml->d;
  20413. return new PackageInfo(
  20414. $channelName,
  20415. $packageName,
  20416. $license,
  20417. $shortDescription,
  20418. $description,
  20419. $this->readPackageReleases($baseUrl, $packageName)
  20420. );
  20421. }
  20422. private function readPackageReleases($baseUrl, $packageName)
  20423. {
  20424. $result = array();
  20425. try {
  20426. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  20427. $xml = $this->requestXml($baseUrl, $xmlPath);
  20428. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  20429. foreach ($xml->xpath('ns:r') as $node) {
  20430. $releaseVersion = (string) $node->v;
  20431. $releaseStability = (string) $node->s;
  20432. try {
  20433. $result[$releaseVersion] = new ReleaseInfo(
  20434. $releaseStability,
  20435. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  20436. );
  20437. } catch (TransportException $exception) {
  20438. if ($exception->getCode() != 404) {
  20439. throw $exception;
  20440. }
  20441. }
  20442. }
  20443. } catch (TransportException $exception) {
  20444. if ($exception->getCode() != 404) {
  20445. throw $exception;
  20446. }
  20447. }
  20448. return $result;
  20449. }
  20450. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  20451. {
  20452. $dependencyReader = new PackageDependencyParser();
  20453. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  20454. $content = $this->requestContent($baseUrl, $depthPath);
  20455. $dependencyArray = unserialize($content);
  20456. return $dependencyReader->buildDependencyInfo($dependencyArray);
  20457. }
  20458. }
  20459. <?php
  20460. namespace Composer\Repository\Pear;
  20461. class ChannelRest11Reader extends BaseChannelReader
  20462. {
  20463. private $dependencyReader;
  20464. public function __construct($rfs)
  20465. {
  20466. parent::__construct($rfs);
  20467. $this->dependencyReader = new PackageDependencyParser();
  20468. }
  20469. public function read($baseUrl)
  20470. {
  20471. return $this->readChannelPackages($baseUrl);
  20472. }
  20473. private function readChannelPackages($baseUrl)
  20474. {
  20475. $result = array();
  20476. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  20477. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  20478. foreach ($xml->xpath('ns:c') as $node) {
  20479. $categoryName = (string) $node;
  20480. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  20481. $result = array_merge($result, $categoryPackages);
  20482. }
  20483. return $result;
  20484. }
  20485. private function readCategoryPackages($baseUrl, $categoryName)
  20486. {
  20487. $result = array();
  20488. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  20489. $xml = $this->requestXml($baseUrl, $categoryPath);
  20490. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  20491. foreach ($xml->xpath('ns:pi') as $node) {
  20492. $packageInfo = $this->parsePackage($node);
  20493. $result[] = $packageInfo;
  20494. }
  20495. return $result;
  20496. }
  20497. private function parsePackage($packageInfo)
  20498. {
  20499. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  20500. $channelName = (string) $packageInfo->p->c;
  20501. $packageName = (string) $packageInfo->p->n;
  20502. $license = (string) $packageInfo->p->l;
  20503. $shortDescription = (string) $packageInfo->p->s;
  20504. $description = (string) $packageInfo->p->d;
  20505. $dependencies = array();
  20506. foreach ($packageInfo->xpath('ns:deps') as $node) {
  20507. $dependencyVersion = (string) $node->v;
  20508. $dependencyArray = unserialize((string) $node->d);
  20509. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  20510. $dependencies[$dependencyVersion] = $dependencyInfo;
  20511. }
  20512. $releases = array();
  20513. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  20514. if ($releasesInfo) {
  20515. foreach ($releasesInfo as $node) {
  20516. $releaseVersion = (string) $node->v;
  20517. $releaseStability = (string) $node->s;
  20518. $releases[$releaseVersion] = new ReleaseInfo(
  20519. $releaseStability,
  20520. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  20521. );
  20522. }
  20523. }
  20524. return new PackageInfo(
  20525. $channelName,
  20526. $packageName,
  20527. $license,
  20528. $shortDescription,
  20529. $description,
  20530. $releases
  20531. );
  20532. }
  20533. }
  20534. <?php
  20535. namespace Composer\Repository\Pear;
  20536. class DependencyConstraint
  20537. {
  20538. private $type;
  20539. private $constraint;
  20540. private $channelName;
  20541. private $packageName;
  20542. public function __construct($type, $constraint, $channelName, $packageName)
  20543. {
  20544. $this->type = $type;
  20545. $this->constraint = $constraint;
  20546. $this->channelName = $channelName;
  20547. $this->packageName = $packageName;
  20548. }
  20549. public function getChannelName()
  20550. {
  20551. return $this->channelName;
  20552. }
  20553. public function getConstraint()
  20554. {
  20555. return $this->constraint;
  20556. }
  20557. public function getPackageName()
  20558. {
  20559. return $this->packageName;
  20560. }
  20561. public function getType()
  20562. {
  20563. return $this->type;
  20564. }
  20565. }
  20566. <?php
  20567. namespace Composer\Repository\Pear;
  20568. class DependencyInfo
  20569. {
  20570. private $requires;
  20571. private $optionals;
  20572. public function __construct($requires, $optionals)
  20573. {
  20574. $this->requires = $requires;
  20575. $this->optionals = $optionals;
  20576. }
  20577. public function getRequires()
  20578. {
  20579. return $this->requires;
  20580. }
  20581. public function getOptionals()
  20582. {
  20583. return $this->optionals;
  20584. }
  20585. }
  20586. <?php
  20587. namespace Composer\Repository\Pear;
  20588. class PackageDependencyParser
  20589. {
  20590. public function buildDependencyInfo($depArray)
  20591. {
  20592. if (!is_array($depArray)) {
  20593. return new DependencyInfo(array(), array());
  20594. }
  20595. if (!$this->isHash($depArray)) {
  20596. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  20597. }
  20598. return $this->buildDependency20Info($depArray);
  20599. }
  20600. private function buildDependency10Info($depArray)
  20601. {
  20602. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  20603. $result = array();
  20604. foreach ($depArray as $depItem) {
  20605. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  20606. continue;
  20607. }
  20608. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  20609. ? 'optional'
  20610. : 'required';
  20611. $depType = 'not' == $depItem['rel']
  20612. ? 'conflicts'
  20613. : $depType;
  20614. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  20615. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  20616. ? '*'
  20617. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  20618. switch ($depItem['type']) {
  20619. case 'php':
  20620. $depChannelName = 'php';
  20621. $depPackageName = '';
  20622. break;
  20623. case 'pkg':
  20624. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  20625. $depPackageName = $depItem['name'];
  20626. break;
  20627. case 'ext':
  20628. $depChannelName = 'ext';
  20629. $depPackageName = $depItem['name'];
  20630. break;
  20631. case 'os':
  20632. case 'sapi':
  20633. $depChannelName = '';
  20634. $depPackageName = '';
  20635. break;
  20636. default:
  20637. $depChannelName = '';
  20638. $depPackageName = '';
  20639. break;
  20640. }
  20641. if ('' != $depChannelName) {
  20642. $result[] = new DependencyConstraint(
  20643. $depType,
  20644. $depVersionConstraint,
  20645. $depChannelName,
  20646. $depPackageName
  20647. );
  20648. }
  20649. }
  20650. return $result;
  20651. }
  20652. private function buildDependency20Info($depArray)
  20653. {
  20654. $result = array();
  20655. $optionals = array();
  20656. $defaultOptionals = array();
  20657. foreach ($depArray as $depType => $depTypeGroup) {
  20658. if (!is_array($depTypeGroup)) {
  20659. continue;
  20660. }
  20661. if ('required' == $depType || 'optional' == $depType) {
  20662. foreach ($depTypeGroup as $depItemType => $depItem) {
  20663. switch ($depItemType) {
  20664. case 'php':
  20665. $result[] = new DependencyConstraint(
  20666. $depType,
  20667. $this->parse20VersionConstraint($depItem),
  20668. 'php',
  20669. ''
  20670. );
  20671. break;
  20672. case 'package':
  20673. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  20674. $result = array_merge($result, $deps);
  20675. break;
  20676. case 'extension':
  20677. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  20678. $result = array_merge($result, $deps);
  20679. break;
  20680. case 'subpackage':
  20681. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  20682. $defaultOptionals += $deps;
  20683. break;
  20684. case 'os':
  20685. case 'pearinstaller':
  20686. break;
  20687. default:
  20688. break;
  20689. }
  20690. }
  20691. } elseif ('group' == $depType) {
  20692. if ($this->isHash($depTypeGroup)) {
  20693. $depTypeGroup = array($depTypeGroup);
  20694. }
  20695. foreach ($depTypeGroup as $depItem) {
  20696. $groupName = $depItem['attribs']['name'];
  20697. if (!isset($optionals[$groupName])) {
  20698. $optionals[$groupName] = array();
  20699. }
  20700. if (isset($depItem['subpackage'])) {
  20701. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  20702. } else {
  20703. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  20704. }
  20705. }
  20706. }
  20707. }
  20708. if (count($defaultOptionals) > 0) {
  20709. $optionals['*'] = $defaultOptionals;
  20710. }
  20711. return new DependencyInfo($result, $optionals);
  20712. }
  20713. private function buildDepExtensionConstraints($depItem, $depType)
  20714. {
  20715. if ($this->isHash($depItem)) {
  20716. $depItem = array($depItem);
  20717. }
  20718. $result = array();
  20719. foreach ($depItem as $subDepItem) {
  20720. $depChannelName = 'ext';
  20721. $depPackageName = $subDepItem['name'];
  20722. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  20723. $result[] = new DependencyConstraint(
  20724. $depType,
  20725. $depVersionConstraint,
  20726. $depChannelName,
  20727. $depPackageName
  20728. );
  20729. }
  20730. return $result;
  20731. }
  20732. private function buildDepPackageConstraints($depItem, $depType)
  20733. {
  20734. if ($this->isHash($depItem)) {
  20735. $depItem = array($depItem);
  20736. }
  20737. $result = array();
  20738. foreach ($depItem as $subDepItem) {
  20739. if (!array_key_exists('channel', $subDepItem)) {
  20740. $subDepItem['channel'] = $subDepItem['uri'];
  20741. }
  20742. $depChannelName = $subDepItem['channel'];
  20743. $depPackageName = $subDepItem['name'];
  20744. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  20745. if (isset($subDepItem['conflicts'])) {
  20746. $depType = 'conflicts';
  20747. }
  20748. $result[] = new DependencyConstraint(
  20749. $depType,
  20750. $depVersionConstraint,
  20751. $depChannelName,
  20752. $depPackageName
  20753. );
  20754. }
  20755. return $result;
  20756. }
  20757. private function parse20VersionConstraint(array $data)
  20758. {
  20759. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  20760. $versions = array();
  20761. $values = array_intersect_key($data, $dep20toOperatorMap);
  20762. if (0 == count($values)) {
  20763. return '*';
  20764. }
  20765. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  20766. $versions[] = '>' . $this->parseVersion($values['min']);
  20767. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  20768. $versions[] = '<' . $this->parseVersion($values['max']);
  20769. } else {
  20770. foreach ($values as $op => $version) {
  20771. if ('exclude' == $op && is_array($version)) {
  20772. foreach ($version as $versionPart) {
  20773. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  20774. }
  20775. } else {
  20776. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  20777. }
  20778. }
  20779. }
  20780. return implode(',', $versions);
  20781. }
  20782. private function parseVersion($version)
  20783. {
  20784. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  20785. $version = $matches[1]
  20786. .(!empty($matches[2]) ? $matches[2] : '.0')
  20787. .(!empty($matches[3]) ? $matches[3] : '.0')
  20788. .(!empty($matches[4]) ? $matches[4] : '.0');
  20789. return $version;
  20790. }
  20791. return null;
  20792. }
  20793. private function isHash(array $array)
  20794. {
  20795. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  20796. }
  20797. }
  20798. <?php
  20799. namespace Composer\Repository\Pear;
  20800. class PackageInfo
  20801. {
  20802. private $channelName;
  20803. private $packageName;
  20804. private $license;
  20805. private $shortDescription;
  20806. private $description;
  20807. private $releases;
  20808. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  20809. {
  20810. $this->channelName = $channelName;
  20811. $this->packageName = $packageName;
  20812. $this->license = $license;
  20813. $this->shortDescription = $shortDescription;
  20814. $this->description = $description;
  20815. $this->releases = $releases;
  20816. }
  20817. public function getChannelName()
  20818. {
  20819. return $this->channelName;
  20820. }
  20821. public function getPackageName()
  20822. {
  20823. return $this->packageName;
  20824. }
  20825. public function getDescription()
  20826. {
  20827. return $this->description;
  20828. }
  20829. public function getShortDescription()
  20830. {
  20831. return $this->shortDescription;
  20832. }
  20833. public function getLicense()
  20834. {
  20835. return $this->license;
  20836. }
  20837. public function getReleases()
  20838. {
  20839. return $this->releases;
  20840. }
  20841. }
  20842. <?php
  20843. namespace Composer\Repository\Pear;
  20844. class ReleaseInfo
  20845. {
  20846. private $stability;
  20847. private $dependencyInfo;
  20848. public function __construct($stability, $dependencyInfo)
  20849. {
  20850. $this->stability = $stability;
  20851. $this->dependencyInfo = $dependencyInfo;
  20852. }
  20853. public function getDependencyInfo()
  20854. {
  20855. return $this->dependencyInfo;
  20856. }
  20857. public function getStability()
  20858. {
  20859. return $this->stability;
  20860. }
  20861. }
  20862. <?php
  20863. namespace Composer\Repository;
  20864. use Composer\IO\IOInterface;
  20865. use Composer\Semver\VersionParser as SemverVersionParser;
  20866. use Composer\Package\Version\VersionParser;
  20867. use Composer\Repository\Pear\ChannelReader;
  20868. use Composer\Package\CompletePackage;
  20869. use Composer\Repository\Pear\ChannelInfo;
  20870. use Composer\EventDispatcher\EventDispatcher;
  20871. use Composer\Package\Link;
  20872. use Composer\Semver\Constraint\Constraint;
  20873. use Composer\Util\RemoteFilesystem;
  20874. use Composer\Config;
  20875. use Composer\Factory;
  20876. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20877. {
  20878. private $url;
  20879. private $io;
  20880. private $rfs;
  20881. private $versionParser;
  20882. private $repoConfig;
  20883. private $vendorAlias;
  20884. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  20885. {
  20886. parent::__construct();
  20887. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  20888. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  20889. }
  20890. $urlBits = parse_url($repoConfig['url']);
  20891. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  20892. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  20893. }
  20894. $this->url = rtrim($repoConfig['url'], '/');
  20895. $this->io = $io;
  20896. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  20897. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  20898. $this->versionParser = new VersionParser();
  20899. $this->repoConfig = $repoConfig;
  20900. }
  20901. public function getRepoConfig()
  20902. {
  20903. return $this->repoConfig;
  20904. }
  20905. protected function initialize()
  20906. {
  20907. parent::initialize();
  20908. $this->io->writeError('Initializing PEAR repository '.$this->url);
  20909. $reader = new ChannelReader($this->rfs);
  20910. try {
  20911. $channelInfo = $reader->read($this->url);
  20912. } catch (\Exception $e) {
  20913. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  20914. return;
  20915. }
  20916. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  20917. foreach ($packages as $package) {
  20918. $this->addPackage($package);
  20919. }
  20920. }
  20921. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  20922. {
  20923. $result = array();
  20924. foreach ($channelInfo->getPackages() as $packageDefinition) {
  20925. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  20926. try {
  20927. $normalizedVersion = $versionParser->normalize($version);
  20928. } catch (\UnexpectedValueException $e) {
  20929. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  20930. continue;
  20931. }
  20932. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  20933. $urlBits = parse_url($this->url);
  20934. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  20935. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  20936. $requires = array();
  20937. $suggests = array();
  20938. $conflicts = array();
  20939. $replaces = array();
  20940. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  20941. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  20942. $aliasConstraint = new Constraint('==', $normalizedVersion);
  20943. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  20944. }
  20945. if (!empty($this->vendorAlias)
  20946. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  20947. ) {
  20948. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  20949. $aliasConstraint = new Constraint('==', $normalizedVersion);
  20950. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  20951. }
  20952. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  20953. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  20954. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  20955. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  20956. switch ($dependencyConstraint->getType()) {
  20957. case 'required':
  20958. $requires[] = $link;
  20959. break;
  20960. case 'conflicts':
  20961. $conflicts[] = $link;
  20962. break;
  20963. case 'replaces':
  20964. $replaces[] = $link;
  20965. break;
  20966. }
  20967. }
  20968. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  20969. foreach ($dependencyConstraints as $dependencyConstraint) {
  20970. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  20971. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  20972. }
  20973. }
  20974. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  20975. $package->setType('pear-library');
  20976. $package->setDescription($packageDefinition->getDescription());
  20977. $package->setLicense(array($packageDefinition->getLicense()));
  20978. $package->setDistType('file');
  20979. $package->setDistUrl($distUrl);
  20980. $package->setAutoload(array('classmap' => array('')));
  20981. $package->setIncludePaths(array('/'));
  20982. $package->setRequires($requires);
  20983. $package->setConflicts($conflicts);
  20984. $package->setSuggests($suggests);
  20985. $package->setReplaces($replaces);
  20986. $result[] = $package;
  20987. }
  20988. }
  20989. return $result;
  20990. }
  20991. private function buildComposerPackageName($channelName, $packageName)
  20992. {
  20993. if ('php' === $channelName) {
  20994. return "php";
  20995. }
  20996. if ('ext' === $channelName) {
  20997. return "ext-{$packageName}";
  20998. }
  20999. return "pear-{$channelName}/{$packageName}";
  21000. }
  21001. }
  21002. <?php
  21003. namespace Composer\Repository;
  21004. use Composer\XdebugHandler;
  21005. use Composer\Package\CompletePackage;
  21006. use Composer\Package\PackageInterface;
  21007. use Composer\Package\Version\VersionParser;
  21008. use Composer\Plugin\PluginInterface;
  21009. use Composer\Util\Silencer;
  21010. class PlatformRepository extends ArrayRepository
  21011. {
  21012. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[^/ ]+)$}i';
  21013. private $versionParser;
  21014. private $overrides = array();
  21015. public function __construct(array $packages = array(), array $overrides = array())
  21016. {
  21017. foreach ($overrides as $name => $version) {
  21018. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  21019. }
  21020. parent::__construct($packages);
  21021. }
  21022. protected function initialize()
  21023. {
  21024. parent::initialize();
  21025. $this->versionParser = new VersionParser();
  21026. foreach ($this->overrides as $override) {
  21027. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  21028. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  21029. }
  21030. $this->addOverriddenPackage($override);
  21031. }
  21032. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  21033. $version = $this->versionParser->normalize($prettyVersion);
  21034. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  21035. $composerPluginApi->setDescription('The Composer Plugin API');
  21036. $this->addPackage($composerPluginApi);
  21037. try {
  21038. $prettyVersion = PHP_VERSION;
  21039. $version = $this->versionParser->normalize($prettyVersion);
  21040. } catch (\UnexpectedValueException $e) {
  21041. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  21042. $version = $this->versionParser->normalize($prettyVersion);
  21043. }
  21044. $php = new CompletePackage('php', $version, $prettyVersion);
  21045. $php->setDescription('The PHP interpreter');
  21046. $this->addPackage($php);
  21047. if (PHP_DEBUG) {
  21048. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  21049. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  21050. $this->addPackage($phpdebug);
  21051. }
  21052. if (defined('PHP_ZTS') && PHP_ZTS) {
  21053. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  21054. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  21055. $this->addPackage($phpzts);
  21056. }
  21057. if (PHP_INT_SIZE === 8) {
  21058. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  21059. $php64->setDescription('The PHP interpreter, 64bit');
  21060. $this->addPackage($php64);
  21061. }
  21062. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  21063. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  21064. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  21065. $this->addPackage($phpIpv6);
  21066. }
  21067. $loadedExtensions = get_loaded_extensions();
  21068. foreach ($loadedExtensions as $name) {
  21069. if (in_array($name, array('standard', 'Core'))) {
  21070. continue;
  21071. }
  21072. $reflExt = new \ReflectionExtension($name);
  21073. $prettyVersion = $reflExt->getVersion();
  21074. $this->addExtension($name, $prettyVersion);
  21075. }
  21076. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = strval(getenv(XdebugHandler::ENV_VERSION)))) {
  21077. $this->addExtension('xdebug', $prettyVersion);
  21078. }
  21079. foreach ($loadedExtensions as $name) {
  21080. $prettyVersion = null;
  21081. $description = 'The '.$name.' PHP library';
  21082. switch ($name) {
  21083. case 'curl':
  21084. $curlVersion = curl_version();
  21085. $prettyVersion = $curlVersion['version'];
  21086. break;
  21087. case 'iconv':
  21088. $prettyVersion = ICONV_VERSION;
  21089. break;
  21090. case 'intl':
  21091. $name = 'ICU';
  21092. if (defined('INTL_ICU_VERSION')) {
  21093. $prettyVersion = INTL_ICU_VERSION;
  21094. } else {
  21095. $reflector = new \ReflectionExtension('intl');
  21096. ob_start();
  21097. $reflector->info();
  21098. $output = ob_get_clean();
  21099. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  21100. $prettyVersion = $matches[1];
  21101. }
  21102. break;
  21103. case 'libxml':
  21104. $prettyVersion = LIBXML_DOTTED_VERSION;
  21105. break;
  21106. case 'openssl':
  21107. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  21108. if (empty($match[2])) {
  21109. return $match[1];
  21110. }
  21111. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  21112. return 0;
  21113. }
  21114. $len = strlen($match[2]);
  21115. $patchVersion = ($len - 1) * 26;
  21116. $patchVersion += ord($match[2][$len - 1]) - 96;
  21117. return $match[1].'.'.$patchVersion;
  21118. }, OPENSSL_VERSION_TEXT);
  21119. $description = OPENSSL_VERSION_TEXT;
  21120. break;
  21121. case 'pcre':
  21122. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  21123. break;
  21124. case 'uuid':
  21125. $prettyVersion = phpversion('uuid');
  21126. break;
  21127. case 'xsl':
  21128. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  21129. break;
  21130. default:
  21131. continue 2;
  21132. }
  21133. try {
  21134. $version = $this->versionParser->normalize($prettyVersion);
  21135. } catch (\UnexpectedValueException $e) {
  21136. continue;
  21137. }
  21138. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  21139. $lib->setDescription($description);
  21140. $this->addPackage($lib);
  21141. }
  21142. if (defined('HHVM_VERSION')) {
  21143. try {
  21144. $prettyVersion = HHVM_VERSION;
  21145. $version = $this->versionParser->normalize($prettyVersion);
  21146. } catch (\UnexpectedValueException $e) {
  21147. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', HHVM_VERSION);
  21148. $version = $this->versionParser->normalize($prettyVersion);
  21149. }
  21150. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  21151. $hhvm->setDescription('The HHVM Runtime (64bit)');
  21152. $this->addPackage($hhvm);
  21153. }
  21154. }
  21155. public function addPackage(PackageInterface $package)
  21156. {
  21157. if (isset($this->overrides[$package->getName()])) {
  21158. $overrider = $this->findPackage($package->getName(), '*');
  21159. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  21160. return;
  21161. }
  21162. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  21163. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  21164. $overrider->setDescription($overrider->getDescription().' (actual: '.$package->getPrettyVersion().')');
  21165. return;
  21166. }
  21167. parent::addPackage($package);
  21168. }
  21169. private function addOverriddenPackage(array $override, $name = null)
  21170. {
  21171. $version = $this->versionParser->normalize($override['version']);
  21172. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  21173. $package->setDescription('Package overridden via config.platform');
  21174. $package->setExtra(array('config.platform' => true));
  21175. parent::addPackage($package);
  21176. return $package;
  21177. }
  21178. private function addExtension($name, $prettyVersion)
  21179. {
  21180. $extraDescription = null;
  21181. try {
  21182. $version = $this->versionParser->normalize($prettyVersion);
  21183. } catch (\UnexpectedValueException $e) {
  21184. $extraDescription = ' (actual version: '.$prettyVersion.')';
  21185. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  21186. $prettyVersion = $match[1];
  21187. } else {
  21188. $prettyVersion = '0';
  21189. }
  21190. $version = $this->versionParser->normalize($prettyVersion);
  21191. }
  21192. $packageName = $this->buildPackageName($name);
  21193. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  21194. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  21195. $this->addPackage($ext);
  21196. }
  21197. private function buildPackageName($name)
  21198. {
  21199. return 'ext-' . str_replace(' ', '-', $name);
  21200. }
  21201. }
  21202. <?php
  21203. namespace Composer\Repository;
  21204. use Composer\Factory;
  21205. use Composer\IO\IOInterface;
  21206. use Composer\Config;
  21207. use Composer\EventDispatcher\EventDispatcher;
  21208. use Composer\Util\RemoteFilesystem;
  21209. use Composer\Json\JsonFile;
  21210. class RepositoryFactory
  21211. {
  21212. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  21213. {
  21214. if (0 === strpos($repository, 'http')) {
  21215. $repoConfig = array('type' => 'composer', 'url' => $repository);
  21216. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  21217. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  21218. $data = $json->read();
  21219. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  21220. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  21221. } elseif ($allowFilesystem) {
  21222. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  21223. } else {
  21224. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  21225. }
  21226. } elseif ('{' === substr($repository, 0, 1)) {
  21227. $repoConfig = JsonFile::parseJson($repository);
  21228. } else {
  21229. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  21230. }
  21231. return $repoConfig;
  21232. }
  21233. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  21234. {
  21235. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  21236. return static::createRepo($io, $config, $repoConfig);
  21237. }
  21238. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  21239. {
  21240. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  21241. $repos = static::createRepos($rm, array($repoConfig));
  21242. return reset($repos);
  21243. }
  21244. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  21245. {
  21246. if (!$config) {
  21247. $config = Factory::createConfig($io);
  21248. }
  21249. if (!$rm) {
  21250. if (!$io) {
  21251. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  21252. }
  21253. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  21254. }
  21255. return static::createRepos($rm, $config->getRepositories());
  21256. }
  21257. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21258. {
  21259. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  21260. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  21261. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  21262. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  21263. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  21264. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  21265. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  21266. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  21267. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  21268. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  21269. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  21270. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  21271. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  21272. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  21273. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  21274. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  21275. return $rm;
  21276. }
  21277. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  21278. {
  21279. $repos = array();
  21280. foreach ($repoConfigs as $index => $repo) {
  21281. if (is_string($repo)) {
  21282. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  21283. }
  21284. if (!is_array($repo)) {
  21285. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  21286. }
  21287. if (!isset($repo['type'])) {
  21288. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  21289. }
  21290. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  21291. while (isset($repos[$name])) {
  21292. $name .= '2';
  21293. }
  21294. if ($repo['type'] === 'filesystem') {
  21295. $repos[$name] = new FilesystemRepository($repo['json']);
  21296. } else {
  21297. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  21298. }
  21299. }
  21300. return $repos;
  21301. }
  21302. }
  21303. <?php
  21304. namespace Composer\Repository;
  21305. use Composer\Package\PackageInterface;
  21306. interface RepositoryInterface extends \Countable
  21307. {
  21308. const SEARCH_FULLTEXT = 0;
  21309. const SEARCH_NAME = 1;
  21310. public function hasPackage(PackageInterface $package);
  21311. public function findPackage($name, $constraint);
  21312. public function findPackages($name, $constraint = null);
  21313. public function getPackages();
  21314. public function search($query, $mode = 0);
  21315. }
  21316. <?php
  21317. namespace Composer\Repository;
  21318. use Composer\IO\IOInterface;
  21319. use Composer\Config;
  21320. use Composer\EventDispatcher\EventDispatcher;
  21321. use Composer\Package\PackageInterface;
  21322. use Composer\Util\RemoteFilesystem;
  21323. class RepositoryManager
  21324. {
  21325. private $localRepository;
  21326. private $repositories = array();
  21327. private $repositoryClasses = array();
  21328. private $io;
  21329. private $config;
  21330. private $eventDispatcher;
  21331. private $rfs;
  21332. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21333. {
  21334. $this->io = $io;
  21335. $this->config = $config;
  21336. $this->eventDispatcher = $eventDispatcher;
  21337. $this->rfs = $rfs;
  21338. }
  21339. public function findPackage($name, $constraint)
  21340. {
  21341. foreach ($this->repositories as $repository) {
  21342. if ($package = $repository->findPackage($name, $constraint)) {
  21343. return $package;
  21344. }
  21345. }
  21346. return null;
  21347. }
  21348. public function findPackages($name, $constraint)
  21349. {
  21350. $packages = array();
  21351. foreach ($this->repositories as $repository) {
  21352. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  21353. }
  21354. return $packages;
  21355. }
  21356. public function addRepository(RepositoryInterface $repository)
  21357. {
  21358. $this->repositories[] = $repository;
  21359. }
  21360. public function prependRepository(RepositoryInterface $repository)
  21361. {
  21362. array_unshift($this->repositories, $repository);
  21363. }
  21364. public function createRepository($type, $config, $name = null)
  21365. {
  21366. if (!isset($this->repositoryClasses[$type])) {
  21367. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  21368. }
  21369. if (isset($config['packagist']) && false === $config['packagist']) {
  21370. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  21371. }
  21372. $class = $this->repositoryClasses[$type];
  21373. $reflMethod = new \ReflectionMethod($class, '__construct');
  21374. $params = $reflMethod->getParameters();
  21375. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  21376. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  21377. }
  21378. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  21379. }
  21380. public function setRepositoryClass($type, $class)
  21381. {
  21382. $this->repositoryClasses[$type] = $class;
  21383. }
  21384. public function getRepositories()
  21385. {
  21386. return $this->repositories;
  21387. }
  21388. public function setLocalRepository(WritableRepositoryInterface $repository)
  21389. {
  21390. $this->localRepository = $repository;
  21391. }
  21392. public function getLocalRepository()
  21393. {
  21394. return $this->localRepository;
  21395. }
  21396. }
  21397. <?php
  21398. namespace Composer\Repository;
  21399. class RepositorySecurityException extends \Exception
  21400. {
  21401. }
  21402. <?php
  21403. namespace Composer\Repository\Vcs;
  21404. use Composer\Cache;
  21405. use Composer\Downloader\TransportException;
  21406. use Composer\Json\JsonFile;
  21407. use Composer\Util\Bitbucket;
  21408. abstract class BitbucketDriver extends VcsDriver
  21409. {
  21410. protected $cache;
  21411. protected $owner;
  21412. protected $repository;
  21413. protected $hasIssues;
  21414. protected $rootIdentifier;
  21415. protected $tags;
  21416. protected $branches;
  21417. protected $infoCache = array();
  21418. protected $branchesUrl = '';
  21419. protected $tagsUrl = '';
  21420. protected $homeUrl = '';
  21421. protected $website = '';
  21422. protected $cloneHttpsUrl = '';
  21423. protected $fallbackDriver;
  21424. protected $vcsType;
  21425. public function initialize()
  21426. {
  21427. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#', $this->url, $match);
  21428. $this->owner = $match[1];
  21429. $this->repository = $match[2];
  21430. $this->originUrl = 'bitbucket.org';
  21431. $this->cache = new Cache(
  21432. $this->io,
  21433. implode('/', array(
  21434. $this->config->get('cache-repo-dir'),
  21435. $this->originUrl,
  21436. $this->owner,
  21437. $this->repository,
  21438. ))
  21439. );
  21440. }
  21441. public function getUrl()
  21442. {
  21443. if ($this->fallbackDriver) {
  21444. return $this->fallbackDriver->getUrl();
  21445. }
  21446. return $this->cloneHttpsUrl;
  21447. }
  21448. protected function getRepoData()
  21449. {
  21450. $resource = sprintf(
  21451. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  21452. $this->owner,
  21453. $this->repository,
  21454. http_build_query(
  21455. array('fields' => '-project,-owner'),
  21456. null,
  21457. '&'
  21458. )
  21459. );
  21460. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  21461. if ($this->fallbackDriver) {
  21462. return false;
  21463. }
  21464. $this->parseCloneUrls($repoData['links']['clone']);
  21465. $this->hasIssues = !empty($repoData['has_issues']);
  21466. $this->branchesUrl = $repoData['links']['branches']['href'];
  21467. $this->tagsUrl = $repoData['links']['tags']['href'];
  21468. $this->homeUrl = $repoData['links']['html']['href'];
  21469. $this->website = $repoData['website'];
  21470. $this->vcsType = $repoData['scm'];
  21471. return true;
  21472. }
  21473. public function getComposerInformation($identifier)
  21474. {
  21475. if ($this->fallbackDriver) {
  21476. return $this->fallbackDriver->getComposerInformation($identifier);
  21477. }
  21478. if (!isset($this->infoCache[$identifier])) {
  21479. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  21480. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  21481. }
  21482. $composer = $this->getBaseComposerInformation($identifier);
  21483. if (!isset($composer['support']['source'])) {
  21484. $label = array_search(
  21485. $identifier,
  21486. $this->getTags()
  21487. ) ?: array_search(
  21488. $identifier,
  21489. $this->getBranches()
  21490. ) ?: $identifier;
  21491. if (array_key_exists($label, $tags = $this->getTags())) {
  21492. $hash = $tags[$label];
  21493. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  21494. $hash = $branches[$label];
  21495. }
  21496. if (! isset($hash)) {
  21497. $composer['support']['source'] = sprintf(
  21498. 'https://%s/%s/%s/src',
  21499. $this->originUrl,
  21500. $this->owner,
  21501. $this->repository
  21502. );
  21503. } else {
  21504. $composer['support']['source'] = sprintf(
  21505. 'https://%s/%s/%s/src/%s/?at=%s',
  21506. $this->originUrl,
  21507. $this->owner,
  21508. $this->repository,
  21509. $hash,
  21510. $label
  21511. );
  21512. }
  21513. }
  21514. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  21515. $composer['support']['issues'] = sprintf(
  21516. 'https://%s/%s/%s/issues',
  21517. $this->originUrl,
  21518. $this->owner,
  21519. $this->repository
  21520. );
  21521. }
  21522. if (!isset($composer['homepage'])) {
  21523. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  21524. }
  21525. $this->infoCache[$identifier] = $composer;
  21526. if ($this->shouldCache($identifier)) {
  21527. $this->cache->write($identifier, json_encode($composer));
  21528. }
  21529. }
  21530. return $this->infoCache[$identifier];
  21531. }
  21532. public function getFileContent($file, $identifier)
  21533. {
  21534. if ($this->fallbackDriver) {
  21535. return $this->fallbackDriver->getFileContent($file, $identifier);
  21536. }
  21537. $resource = sprintf(
  21538. 'https://api.bitbucket.org/1.0/repositories/%s/%s/raw/%s/%s',
  21539. $this->owner,
  21540. $this->repository,
  21541. $identifier,
  21542. $file
  21543. );
  21544. return $this->getContentsWithOAuthCredentials($resource);
  21545. }
  21546. public function getChangeDate($identifier)
  21547. {
  21548. if ($this->fallbackDriver) {
  21549. return $this->fallbackDriver->getChangeDate($identifier);
  21550. }
  21551. $resource = sprintf(
  21552. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  21553. $this->owner,
  21554. $this->repository,
  21555. $identifier
  21556. );
  21557. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21558. return new \DateTime($commit['date']);
  21559. }
  21560. public function getSource($identifier)
  21561. {
  21562. if ($this->fallbackDriver) {
  21563. return $this->fallbackDriver->getSource($identifier);
  21564. }
  21565. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  21566. }
  21567. public function getDist($identifier)
  21568. {
  21569. if ($this->fallbackDriver) {
  21570. return $this->fallbackDriver->getDist($identifier);
  21571. }
  21572. $url = sprintf(
  21573. 'https://bitbucket.org/%s/%s/get/%s.zip',
  21574. $this->owner,
  21575. $this->repository,
  21576. $identifier
  21577. );
  21578. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  21579. }
  21580. public function getTags()
  21581. {
  21582. if ($this->fallbackDriver) {
  21583. return $this->fallbackDriver->getTags();
  21584. }
  21585. if (null === $this->tags) {
  21586. $this->tags = array();
  21587. $resource = sprintf(
  21588. '%s?%s',
  21589. $this->tagsUrl,
  21590. http_build_query(
  21591. array(
  21592. 'pagelen' => 100,
  21593. 'fields' => 'values.name,values.target.hash,next',
  21594. 'sort' => '-target.date',
  21595. ),
  21596. null,
  21597. '&'
  21598. )
  21599. );
  21600. $hasNext = true;
  21601. while ($hasNext) {
  21602. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21603. foreach ($tagsData['values'] as $data) {
  21604. $this->tags[$data['name']] = $data['target']['hash'];
  21605. }
  21606. if (empty($tagsData['next'])) {
  21607. $hasNext = false;
  21608. } else {
  21609. $resource = $tagsData['next'];
  21610. }
  21611. }
  21612. if ($this->vcsType === 'hg') {
  21613. unset($this->tags['tip']);
  21614. }
  21615. }
  21616. return $this->tags;
  21617. }
  21618. public function getBranches()
  21619. {
  21620. if ($this->fallbackDriver) {
  21621. return $this->fallbackDriver->getBranches();
  21622. }
  21623. if (null === $this->branches) {
  21624. $this->branches = array();
  21625. $resource = sprintf(
  21626. '%s?%s',
  21627. $this->branchesUrl,
  21628. http_build_query(
  21629. array(
  21630. 'pagelen' => 100,
  21631. 'fields' => 'values.name,values.target.hash,values.heads,next',
  21632. 'sort' => '-target.date',
  21633. ),
  21634. null,
  21635. '&'
  21636. )
  21637. );
  21638. $hasNext = true;
  21639. while ($hasNext) {
  21640. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21641. foreach ($branchData['values'] as $data) {
  21642. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  21643. continue;
  21644. }
  21645. $this->branches[$data['name']] = $data['target']['hash'];
  21646. }
  21647. if (empty($branchData['next'])) {
  21648. $hasNext = false;
  21649. } else {
  21650. $resource = $branchData['next'];
  21651. }
  21652. }
  21653. }
  21654. return $this->branches;
  21655. }
  21656. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  21657. {
  21658. try {
  21659. return parent::getContents($url);
  21660. } catch (TransportException $e) {
  21661. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  21662. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  21663. if (!$this->io->hasAuthentication($this->originUrl)
  21664. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  21665. ) {
  21666. return parent::getContents($url);
  21667. }
  21668. if (!$this->io->isInteractive() && $fetchingRepoData) {
  21669. return $this->attemptCloneFallback();
  21670. }
  21671. }
  21672. throw $e;
  21673. }
  21674. }
  21675. abstract protected function generateSshUrl();
  21676. protected function attemptCloneFallback()
  21677. {
  21678. try {
  21679. $this->setupFallbackDriver($this->generateSshUrl());
  21680. } catch (\RuntimeException $e) {
  21681. $this->fallbackDriver = null;
  21682. $this->io->writeError(
  21683. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  21684. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  21685. );
  21686. throw $e;
  21687. }
  21688. }
  21689. abstract protected function setupFallbackDriver($url);
  21690. protected function parseCloneUrls(array $cloneLinks)
  21691. {
  21692. foreach ($cloneLinks as $cloneLink) {
  21693. if ($cloneLink['name'] === 'https') {
  21694. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  21695. }
  21696. }
  21697. }
  21698. protected function getMainBranchData()
  21699. {
  21700. $resource = sprintf(
  21701. 'https://api.bitbucket.org/1.0/repositories/%s/%s/main-branch',
  21702. $this->owner,
  21703. $this->repository
  21704. );
  21705. return JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  21706. }
  21707. }
  21708. <?php
  21709. namespace Composer\Repository\Vcs;
  21710. use Composer\Config;
  21711. use Composer\Util\ProcessExecutor;
  21712. use Composer\Util\Filesystem;
  21713. use Composer\IO\IOInterface;
  21714. class FossilDriver extends VcsDriver
  21715. {
  21716. protected $tags;
  21717. protected $branches;
  21718. protected $rootIdentifier;
  21719. protected $repoFile;
  21720. protected $checkoutDir;
  21721. protected $infoCache = array();
  21722. public function initialize()
  21723. {
  21724. $this->checkFossil();
  21725. $this->config->prohibitUrlByConfig($this->url, $this->io);
  21726. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  21727. $this->checkoutDir = $this->url;
  21728. } else {
  21729. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  21730. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  21731. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  21732. $this->updateLocalRepo();
  21733. }
  21734. $this->getTags();
  21735. $this->getBranches();
  21736. }
  21737. protected function checkFossil()
  21738. {
  21739. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  21740. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  21741. }
  21742. }
  21743. protected function updateLocalRepo()
  21744. {
  21745. $fs = new Filesystem();
  21746. $fs->ensureDirectoryExists($this->checkoutDir);
  21747. if (!is_writable(dirname($this->checkoutDir))) {
  21748. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  21749. }
  21750. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  21751. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  21752. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  21753. }
  21754. } else {
  21755. $fs->removeDirectory($this->checkoutDir);
  21756. $fs->remove($this->repoFile);
  21757. $fs->ensureDirectoryExists($this->checkoutDir);
  21758. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  21759. $output = $this->process->getErrorOutput();
  21760. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  21761. }
  21762. if (0 !== $this->process->execute(sprintf('fossil open %s', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  21763. $output = $this->process->getErrorOutput();
  21764. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  21765. }
  21766. }
  21767. }
  21768. public function getRootIdentifier()
  21769. {
  21770. if (null === $this->rootIdentifier) {
  21771. $this->rootIdentifier = 'trunk';
  21772. }
  21773. return $this->rootIdentifier;
  21774. }
  21775. public function getUrl()
  21776. {
  21777. return $this->url;
  21778. }
  21779. public function getSource($identifier)
  21780. {
  21781. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  21782. }
  21783. public function getDist($identifier)
  21784. {
  21785. return null;
  21786. }
  21787. public function getFileContent($file, $identifier)
  21788. {
  21789. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  21790. $this->process->execute($command, $content, $this->checkoutDir);
  21791. if (!trim($content)) {
  21792. return null;
  21793. }
  21794. return $content;
  21795. }
  21796. public function getChangeDate($identifier)
  21797. {
  21798. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  21799. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  21800. return new \DateTime($date, new \DateTimeZone('UTC'));
  21801. }
  21802. public function getTags()
  21803. {
  21804. if (null === $this->tags) {
  21805. $tags = array();
  21806. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  21807. foreach ($this->process->splitLines($output) as $tag) {
  21808. $tags[$tag] = $tag;
  21809. }
  21810. $this->tags = $tags;
  21811. }
  21812. return $this->tags;
  21813. }
  21814. public function getBranches()
  21815. {
  21816. if (null === $this->branches) {
  21817. $branches = array();
  21818. $bookmarks = array();
  21819. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  21820. foreach ($this->process->splitLines($output) as $branch) {
  21821. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  21822. $branches[$branch] = $branch;
  21823. }
  21824. $this->branches = $branches;
  21825. }
  21826. return $this->branches;
  21827. }
  21828. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21829. {
  21830. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  21831. return true;
  21832. }
  21833. if (preg_match('!/fossil/|\.fossil!', $url)) {
  21834. return true;
  21835. }
  21836. if (Filesystem::isLocalPath($url)) {
  21837. $url = Filesystem::getPlatformPath($url);
  21838. if (!is_dir($url)) {
  21839. return false;
  21840. }
  21841. $process = new ProcessExecutor();
  21842. if ($process->execute('fossil info', $output, $url) === 0) {
  21843. return true;
  21844. }
  21845. }
  21846. return false;
  21847. }
  21848. }
  21849. <?php
  21850. namespace Composer\Repository\Vcs;
  21851. use Composer\Config;
  21852. use Composer\IO\IOInterface;
  21853. class GitBitbucketDriver extends BitbucketDriver
  21854. {
  21855. public function getRootIdentifier()
  21856. {
  21857. if ($this->fallbackDriver) {
  21858. return $this->fallbackDriver->getRootIdentifier();
  21859. }
  21860. if (null === $this->rootIdentifier) {
  21861. if (! $this->getRepoData()) {
  21862. return $this->fallbackDriver->getRootIdentifier();
  21863. }
  21864. if ($this->vcsType !== 'git') {
  21865. throw new \RuntimeException(
  21866. $this->url.' does not appear to be a git repository, use '.
  21867. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  21868. );
  21869. }
  21870. $mainBranchData = $this->getMainBranchData();
  21871. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  21872. }
  21873. return $this->rootIdentifier;
  21874. }
  21875. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  21876. {
  21877. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
  21878. return false;
  21879. }
  21880. if (!extension_loaded('openssl')) {
  21881. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  21882. return false;
  21883. }
  21884. return true;
  21885. }
  21886. protected function setupFallbackDriver($url)
  21887. {
  21888. $this->fallbackDriver = new GitDriver(
  21889. array('url' => $url),
  21890. $this->io,
  21891. $this->config,
  21892. $this->process,
  21893. $this->remoteFilesystem
  21894. );
  21895. $this->fallbackDriver->initialize();
  21896. }
  21897. protected function generateSshUrl()
  21898. {
  21899. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  21900. }
  21901. }
  21902. <?php
  21903. namespace Composer\Repository\Vcs;
  21904. use Composer\Util\ProcessExecutor;
  21905. use Composer\Util\Filesystem;
  21906. use Composer\Util\Git as GitUtil;
  21907. use Composer\IO\IOInterface;
  21908. use Composer\Cache;
  21909. use Composer\Config;
  21910. class GitDriver extends VcsDriver
  21911. {
  21912. protected $cache;
  21913. protected $tags;
  21914. protected $branches;
  21915. protected $rootIdentifier;
  21916. protected $repoDir;
  21917. protected $infoCache = array();
  21918. public function initialize()
  21919. {
  21920. if (Filesystem::isLocalPath($this->url)) {
  21921. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  21922. $this->repoDir = $this->url;
  21923. $cacheUrl = realpath($this->url);
  21924. } else {
  21925. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  21926. GitUtil::cleanEnv();
  21927. $fs = new Filesystem();
  21928. $fs->ensureDirectoryExists(dirname($this->repoDir));
  21929. if (!is_writable(dirname($this->repoDir))) {
  21930. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  21931. }
  21932. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  21933. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  21934. }
  21935. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  21936. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  21937. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  21938. }
  21939. $cacheUrl = $this->url;
  21940. }
  21941. $this->getTags();
  21942. $this->getBranches();
  21943. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  21944. }
  21945. public function getRootIdentifier()
  21946. {
  21947. if (null === $this->rootIdentifier) {
  21948. $this->rootIdentifier = 'master';
  21949. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  21950. $branches = $this->process->splitLines($output);
  21951. if (!in_array('* master', $branches)) {
  21952. foreach ($branches as $branch) {
  21953. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  21954. $this->rootIdentifier = $match[1];
  21955. break;
  21956. }
  21957. }
  21958. }
  21959. }
  21960. return $this->rootIdentifier;
  21961. }
  21962. public function getUrl()
  21963. {
  21964. return $this->url;
  21965. }
  21966. public function getSource($identifier)
  21967. {
  21968. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  21969. }
  21970. public function getDist($identifier)
  21971. {
  21972. return null;
  21973. }
  21974. public function getFileContent($file, $identifier)
  21975. {
  21976. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  21977. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  21978. if (!trim($content)) {
  21979. return null;
  21980. }
  21981. return $content;
  21982. }
  21983. public function getChangeDate($identifier)
  21984. {
  21985. $this->process->execute(sprintf(
  21986. 'git log -1 --format=%%at %s',
  21987. ProcessExecutor::escape($identifier)
  21988. ), $output, $this->repoDir);
  21989. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  21990. }
  21991. public function getTags()
  21992. {
  21993. if (null === $this->tags) {
  21994. $this->tags = array();
  21995. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  21996. foreach ($output = $this->process->splitLines($output) as $tag) {
  21997. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  21998. $this->tags[$match[2]] = $match[1];
  21999. }
  22000. }
  22001. }
  22002. return $this->tags;
  22003. }
  22004. public function getBranches()
  22005. {
  22006. if (null === $this->branches) {
  22007. $branches = array();
  22008. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  22009. foreach ($this->process->splitLines($output) as $branch) {
  22010. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  22011. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  22012. $branches[$match[1]] = $match[2];
  22013. }
  22014. }
  22015. }
  22016. $this->branches = $branches;
  22017. }
  22018. return $this->branches;
  22019. }
  22020. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22021. {
  22022. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  22023. return true;
  22024. }
  22025. if (Filesystem::isLocalPath($url)) {
  22026. $url = Filesystem::getPlatformPath($url);
  22027. if (!is_dir($url)) {
  22028. return false;
  22029. }
  22030. $process = new ProcessExecutor($io);
  22031. if ($process->execute('git tag', $output, $url) === 0) {
  22032. return true;
  22033. }
  22034. }
  22035. if (!$deep) {
  22036. return false;
  22037. }
  22038. $process = new ProcessExecutor($io);
  22039. return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
  22040. }
  22041. }
  22042. <?php
  22043. namespace Composer\Repository\Vcs;
  22044. use Composer\Config;
  22045. use Composer\Downloader\TransportException;
  22046. use Composer\Json\JsonFile;
  22047. use Composer\Cache;
  22048. use Composer\IO\IOInterface;
  22049. use Composer\Util\GitHub;
  22050. class GitHubDriver extends VcsDriver
  22051. {
  22052. protected $cache;
  22053. protected $owner;
  22054. protected $repository;
  22055. protected $tags;
  22056. protected $branches;
  22057. protected $rootIdentifier;
  22058. protected $repoData;
  22059. protected $hasIssues;
  22060. protected $infoCache = array();
  22061. protected $isPrivate = false;
  22062. protected $gitDriver;
  22063. public function initialize()
  22064. {
  22065. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  22066. $this->owner = $match[3];
  22067. $this->repository = $match[4];
  22068. $this->originUrl = !empty($match[1]) ? $match[1] : $match[2];
  22069. if ($this->originUrl === 'www.github.com') {
  22070. $this->originUrl = 'github.com';
  22071. }
  22072. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  22073. if (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api']) {
  22074. $this->setupGitDriver($this->url);
  22075. return;
  22076. }
  22077. $this->fetchRootIdentifier();
  22078. }
  22079. public function getRepositoryUrl()
  22080. {
  22081. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  22082. }
  22083. public function getRootIdentifier()
  22084. {
  22085. if ($this->gitDriver) {
  22086. return $this->gitDriver->getRootIdentifier();
  22087. }
  22088. return $this->rootIdentifier;
  22089. }
  22090. public function getUrl()
  22091. {
  22092. if ($this->gitDriver) {
  22093. return $this->gitDriver->getUrl();
  22094. }
  22095. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  22096. }
  22097. protected function getApiUrl()
  22098. {
  22099. if ('github.com' === $this->originUrl) {
  22100. $apiUrl = 'api.github.com';
  22101. } else {
  22102. $apiUrl = $this->originUrl . '/api/v3';
  22103. }
  22104. return 'https://' . $apiUrl;
  22105. }
  22106. public function getSource($identifier)
  22107. {
  22108. if ($this->gitDriver) {
  22109. return $this->gitDriver->getSource($identifier);
  22110. }
  22111. if ($this->isPrivate) {
  22112. $url = $this->generateSshUrl();
  22113. } else {
  22114. $url = $this->getUrl();
  22115. }
  22116. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  22117. }
  22118. public function getDist($identifier)
  22119. {
  22120. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  22121. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22122. }
  22123. public function getComposerInformation($identifier)
  22124. {
  22125. if ($this->gitDriver) {
  22126. return $this->gitDriver->getComposerInformation($identifier);
  22127. }
  22128. if (!isset($this->infoCache[$identifier])) {
  22129. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22130. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22131. }
  22132. $composer = $this->getBaseComposerInformation($identifier);
  22133. if ($composer) {
  22134. if (!isset($composer['support']['source'])) {
  22135. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  22136. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  22137. }
  22138. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22139. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  22140. }
  22141. }
  22142. if ($this->shouldCache($identifier)) {
  22143. $this->cache->write($identifier, json_encode($composer));
  22144. }
  22145. $this->infoCache[$identifier] = $composer;
  22146. }
  22147. return $this->infoCache[$identifier];
  22148. }
  22149. public function getFileContent($file, $identifier)
  22150. {
  22151. if ($this->gitDriver) {
  22152. return $this->gitDriver->getFileContent($file, $identifier);
  22153. }
  22154. $notFoundRetries = 2;
  22155. while ($notFoundRetries) {
  22156. try {
  22157. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  22158. $resource = JsonFile::parseJson($this->getContents($resource));
  22159. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  22160. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  22161. }
  22162. return $content;
  22163. } catch (TransportException $e) {
  22164. if (404 !== $e->getCode()) {
  22165. throw $e;
  22166. }
  22167. $notFoundRetries--;
  22168. return null;
  22169. }
  22170. }
  22171. return null;
  22172. }
  22173. public function getChangeDate($identifier)
  22174. {
  22175. if ($this->gitDriver) {
  22176. return $this->gitDriver->getChangeDate($identifier);
  22177. }
  22178. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  22179. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  22180. return new \DateTime($commit['commit']['committer']['date']);
  22181. }
  22182. public function getTags()
  22183. {
  22184. if ($this->gitDriver) {
  22185. return $this->gitDriver->getTags();
  22186. }
  22187. if (null === $this->tags) {
  22188. $this->tags = array();
  22189. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  22190. do {
  22191. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  22192. foreach ($tagsData as $tag) {
  22193. $this->tags[$tag['name']] = $tag['commit']['sha'];
  22194. }
  22195. $resource = $this->getNextPage();
  22196. } while ($resource);
  22197. }
  22198. return $this->tags;
  22199. }
  22200. public function getBranches()
  22201. {
  22202. if ($this->gitDriver) {
  22203. return $this->gitDriver->getBranches();
  22204. }
  22205. if (null === $this->branches) {
  22206. $this->branches = array();
  22207. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  22208. $branchBlacklist = array('gh-pages');
  22209. do {
  22210. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  22211. foreach ($branchData as $branch) {
  22212. $name = substr($branch['ref'], 11);
  22213. if (!in_array($name, $branchBlacklist)) {
  22214. $this->branches[$name] = $branch['object']['sha'];
  22215. }
  22216. }
  22217. $resource = $this->getNextPage();
  22218. } while ($resource);
  22219. }
  22220. return $this->branches;
  22221. }
  22222. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22223. {
  22224. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  22225. return false;
  22226. }
  22227. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  22228. if (!in_array(preg_replace('{^www\.}i', '', $originUrl), $config->get('github-domains'))) {
  22229. return false;
  22230. }
  22231. if (!extension_loaded('openssl')) {
  22232. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22233. return false;
  22234. }
  22235. return true;
  22236. }
  22237. public function getRepoData()
  22238. {
  22239. $this->fetchRootIdentifier();
  22240. return $this->repoData;
  22241. }
  22242. protected function generateSshUrl()
  22243. {
  22244. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  22245. }
  22246. protected function getContents($url, $fetchingRepoData = false)
  22247. {
  22248. try {
  22249. return parent::getContents($url);
  22250. } catch (TransportException $e) {
  22251. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22252. switch ($e->getCode()) {
  22253. case 401:
  22254. case 404:
  22255. if (!$fetchingRepoData) {
  22256. throw $e;
  22257. }
  22258. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  22259. return parent::getContents($url);
  22260. }
  22261. if (!$this->io->isInteractive()) {
  22262. return $this->attemptCloneFallback();
  22263. }
  22264. $scopesIssued = array();
  22265. $scopesNeeded = array();
  22266. if ($headers = $e->getHeaders()) {
  22267. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  22268. $scopesIssued = explode(' ', $scopes);
  22269. }
  22270. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  22271. $scopesNeeded = explode(' ', $scopes);
  22272. }
  22273. }
  22274. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  22275. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  22276. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  22277. }
  22278. return parent::getContents($url);
  22279. case 403:
  22280. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  22281. return parent::getContents($url);
  22282. }
  22283. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22284. return $this->attemptCloneFallback();
  22285. }
  22286. $rateLimited = false;
  22287. foreach ($e->getHeaders() as $header) {
  22288. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  22289. $rateLimited = true;
  22290. }
  22291. }
  22292. if (!$this->io->hasAuthentication($this->originUrl)) {
  22293. if (!$this->io->isInteractive()) {
  22294. $this->io->writeError('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
  22295. throw $e;
  22296. }
  22297. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  22298. return parent::getContents($url);
  22299. }
  22300. if ($rateLimited) {
  22301. $rateLimit = $this->getRateLimit($e->getHeaders());
  22302. $this->io->writeError(sprintf(
  22303. '<error>GitHub API limit (%d calls/hr) is exhausted. You are already authorized so you have to wait until %s before doing more requests</error>',
  22304. $rateLimit['limit'],
  22305. $rateLimit['reset']
  22306. ));
  22307. }
  22308. throw $e;
  22309. default:
  22310. throw $e;
  22311. }
  22312. }
  22313. }
  22314. protected function getRateLimit(array $headers)
  22315. {
  22316. $rateLimit = array(
  22317. 'limit' => '?',
  22318. 'reset' => '?',
  22319. );
  22320. foreach ($headers as $header) {
  22321. $header = trim($header);
  22322. if (false === strpos($header, 'X-RateLimit-')) {
  22323. continue;
  22324. }
  22325. list($type, $value) = explode(':', $header, 2);
  22326. switch ($type) {
  22327. case 'X-RateLimit-Limit':
  22328. $rateLimit['limit'] = (int) trim($value);
  22329. break;
  22330. case 'X-RateLimit-Reset':
  22331. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  22332. break;
  22333. }
  22334. }
  22335. return $rateLimit;
  22336. }
  22337. protected function fetchRootIdentifier()
  22338. {
  22339. if ($this->repoData) {
  22340. return;
  22341. }
  22342. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  22343. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  22344. if (null === $this->repoData && null !== $this->gitDriver) {
  22345. return;
  22346. }
  22347. $this->owner = $this->repoData['owner']['login'];
  22348. $this->repository = $this->repoData['name'];
  22349. $this->isPrivate = !empty($this->repoData['private']);
  22350. if (isset($this->repoData['default_branch'])) {
  22351. $this->rootIdentifier = $this->repoData['default_branch'];
  22352. } elseif (isset($this->repoData['master_branch'])) {
  22353. $this->rootIdentifier = $this->repoData['master_branch'];
  22354. } else {
  22355. $this->rootIdentifier = 'master';
  22356. }
  22357. $this->hasIssues = !empty($this->repoData['has_issues']);
  22358. }
  22359. protected function attemptCloneFallback()
  22360. {
  22361. $this->isPrivate = true;
  22362. try {
  22363. $this->setupGitDriver($this->generateSshUrl());
  22364. return;
  22365. } catch (\RuntimeException $e) {
  22366. $this->gitDriver = null;
  22367. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
  22368. throw $e;
  22369. }
  22370. }
  22371. protected function setupGitDriver($url)
  22372. {
  22373. $this->gitDriver = new GitDriver(
  22374. array('url' => $url),
  22375. $this->io,
  22376. $this->config,
  22377. $this->process,
  22378. $this->remoteFilesystem
  22379. );
  22380. $this->gitDriver->initialize();
  22381. }
  22382. protected function getNextPage()
  22383. {
  22384. $headers = $this->remoteFilesystem->getLastHeaders();
  22385. foreach ($headers as $header) {
  22386. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  22387. $links = explode(',', $match[1]);
  22388. foreach ($links as $link) {
  22389. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  22390. return $match[1];
  22391. }
  22392. }
  22393. }
  22394. }
  22395. }
  22396. }
  22397. <?php
  22398. namespace Composer\Repository\Vcs;
  22399. use Composer\Config;
  22400. use Composer\Cache;
  22401. use Composer\IO\IOInterface;
  22402. use Composer\Json\JsonFile;
  22403. use Composer\Downloader\TransportException;
  22404. use Composer\Util\RemoteFilesystem;
  22405. use Composer\Util\GitLab;
  22406. class GitLabDriver extends VcsDriver
  22407. {
  22408. private $scheme;
  22409. private $namespace;
  22410. private $repository;
  22411. private $project;
  22412. private $commits = array();
  22413. private $tags;
  22414. private $branches;
  22415. protected $gitDriver;
  22416. private $isPrivate = true;
  22417. protected $portNumber;
  22418. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  22419. public function initialize()
  22420. {
  22421. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  22422. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  22423. }
  22424. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  22425. $configuredDomains = $this->config->get('gitlab-domains');
  22426. $urlParts = explode('/', $match['parts']);
  22427. $this->scheme = !empty($match['scheme'])
  22428. ? $match['scheme']
  22429. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  22430. ;
  22431. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts);
  22432. if (!empty($match['port']) && true === is_numeric($match['port'])) {
  22433. $this->portNumber = (int) $match['port'];
  22434. }
  22435. $this->namespace = implode('/', $urlParts);
  22436. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  22437. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  22438. $this->fetchProject();
  22439. }
  22440. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  22441. {
  22442. $this->remoteFilesystem = $remoteFilesystem;
  22443. }
  22444. public function getFileContent($file, $identifier)
  22445. {
  22446. if ($this->gitDriver) {
  22447. return $this->gitDriver->getFileContent($file, $identifier);
  22448. }
  22449. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  22450. $branches = $this->getBranches();
  22451. if (isset($branches[$identifier])) {
  22452. $identifier = $branches[$identifier];
  22453. }
  22454. }
  22455. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  22456. try {
  22457. $content = $this->getContents($resource);
  22458. } catch (TransportException $e) {
  22459. if ($e->getCode() !== 404) {
  22460. throw $e;
  22461. }
  22462. return null;
  22463. }
  22464. return $content;
  22465. }
  22466. public function getChangeDate($identifier)
  22467. {
  22468. if ($this->gitDriver) {
  22469. return $this->gitDriver->getChangeDate($identifier);
  22470. }
  22471. if (isset($this->commits[$identifier])) {
  22472. return new \DateTime($this->commits[$identifier]['committed_date']);
  22473. }
  22474. return new \DateTime();
  22475. }
  22476. public function getRepositoryUrl()
  22477. {
  22478. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  22479. }
  22480. public function getUrl()
  22481. {
  22482. if ($this->gitDriver) {
  22483. return $this->gitDriver->getUrl();
  22484. }
  22485. return $this->project['web_url'];
  22486. }
  22487. public function getDist($identifier)
  22488. {
  22489. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  22490. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22491. }
  22492. public function getSource($identifier)
  22493. {
  22494. if ($this->gitDriver) {
  22495. return $this->gitDriver->getSource($identifier);
  22496. }
  22497. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  22498. }
  22499. public function getRootIdentifier()
  22500. {
  22501. if ($this->gitDriver) {
  22502. return $this->gitDriver->getRootIdentifier();
  22503. }
  22504. return $this->project['default_branch'];
  22505. }
  22506. public function getBranches()
  22507. {
  22508. if ($this->gitDriver) {
  22509. return $this->gitDriver->getBranches();
  22510. }
  22511. if (!$this->branches) {
  22512. $this->branches = $this->getReferences('branches');
  22513. }
  22514. return $this->branches;
  22515. }
  22516. public function getTags()
  22517. {
  22518. if ($this->gitDriver) {
  22519. return $this->gitDriver->getTags();
  22520. }
  22521. if (!$this->tags) {
  22522. $this->tags = $this->getReferences('tags');
  22523. }
  22524. return $this->tags;
  22525. }
  22526. public function getApiUrl()
  22527. {
  22528. $domainName = $this->originUrl;
  22529. $portNumber = (true === is_numeric($this->portNumber)) ? sprintf(':%s', $this->portNumber) : '';
  22530. return $this->scheme.'://'.$domainName.$portNumber.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  22531. }
  22532. private function urlEncodeAll($string)
  22533. {
  22534. $encoded = '';
  22535. for ($i = 0; isset($string[$i]); $i++) {
  22536. $character = $string[$i];
  22537. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  22538. $character = '%' . sprintf('%02X', ord($character));
  22539. }
  22540. $encoded .= $character;
  22541. }
  22542. return $encoded;
  22543. }
  22544. protected function getReferences($type)
  22545. {
  22546. $perPage = 100;
  22547. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  22548. $references = array();
  22549. do {
  22550. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  22551. foreach ($data as $datum) {
  22552. $references[$datum['name']] = $datum['commit']['id'];
  22553. $this->commits[$datum['commit']['id']] = $datum['commit'];
  22554. }
  22555. if (count($data) >= $perPage) {
  22556. $resource = $this->getNextPage();
  22557. } else {
  22558. $resource = false;
  22559. }
  22560. } while ($resource);
  22561. return $references;
  22562. }
  22563. protected function fetchProject()
  22564. {
  22565. $resource = $this->getApiUrl();
  22566. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  22567. if (isset($this->project['visibility'])) {
  22568. $this->isPrivate = $this->project['visibility'] !== 'public';
  22569. } else {
  22570. $this->isPrivate = false;
  22571. }
  22572. }
  22573. protected function attemptCloneFallback()
  22574. {
  22575. try {
  22576. if ($this->isPrivate === false) {
  22577. $url = $this->generatePublicUrl();
  22578. } else {
  22579. $url = $this->generateSshUrl();
  22580. }
  22581. $this->setupGitDriver($url);
  22582. return;
  22583. } catch (\RuntimeException $e) {
  22584. $this->gitDriver = null;
  22585. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  22586. throw $e;
  22587. }
  22588. }
  22589. protected function generateSshUrl()
  22590. {
  22591. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  22592. }
  22593. protected function generatePublicUrl()
  22594. {
  22595. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  22596. }
  22597. protected function setupGitDriver($url)
  22598. {
  22599. $this->gitDriver = new GitDriver(
  22600. array('url' => $url),
  22601. $this->io,
  22602. $this->config,
  22603. $this->process,
  22604. $this->remoteFilesystem
  22605. );
  22606. $this->gitDriver->initialize();
  22607. }
  22608. protected function getContents($url, $fetchingRepoData = false)
  22609. {
  22610. try {
  22611. $res = parent::getContents($url);
  22612. if ($fetchingRepoData) {
  22613. $json = JsonFile::parseJson($res, $url);
  22614. if (!isset($json['default_branch'])) {
  22615. if (!empty($json['id'])) {
  22616. $this->isPrivate = false;
  22617. }
  22618. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  22619. }
  22620. }
  22621. return $res;
  22622. } catch (TransportException $e) {
  22623. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22624. switch ($e->getCode()) {
  22625. case 401:
  22626. case 404:
  22627. if (!$fetchingRepoData) {
  22628. throw $e;
  22629. }
  22630. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  22631. return parent::getContents($url);
  22632. }
  22633. if (!$this->io->isInteractive()) {
  22634. return $this->attemptCloneFallback();
  22635. }
  22636. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  22637. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  22638. return parent::getContents($url);
  22639. case 403:
  22640. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  22641. return parent::getContents($url);
  22642. }
  22643. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22644. return $this->attemptCloneFallback();
  22645. }
  22646. throw $e;
  22647. default:
  22648. throw $e;
  22649. }
  22650. }
  22651. }
  22652. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22653. {
  22654. if (!preg_match(self::URL_REGEX, $url, $match)) {
  22655. return false;
  22656. }
  22657. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  22658. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  22659. $urlParts = explode('/', $match['parts']);
  22660. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts)) {
  22661. return false;
  22662. }
  22663. if ('https' === $scheme && !extension_loaded('openssl')) {
  22664. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22665. return false;
  22666. }
  22667. return true;
  22668. }
  22669. private function getNextPage()
  22670. {
  22671. $headers = $this->remoteFilesystem->getLastHeaders();
  22672. foreach ($headers as $header) {
  22673. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  22674. $links = explode(',', $match[1]);
  22675. foreach ($links as $link) {
  22676. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  22677. return $match[1];
  22678. }
  22679. }
  22680. }
  22681. }
  22682. }
  22683. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts)
  22684. {
  22685. if (in_array($guessedDomain, $configuredDomains)) {
  22686. return $guessedDomain;
  22687. }
  22688. while (null !== ($part = array_shift($urlParts))) {
  22689. $guessedDomain .= '/' . $part;
  22690. if (in_array($guessedDomain, $configuredDomains)) {
  22691. return $guessedDomain;
  22692. }
  22693. }
  22694. return false;
  22695. }
  22696. }
  22697. <?php
  22698. namespace Composer\Repository\Vcs;
  22699. use Composer\Config;
  22700. use Composer\IO\IOInterface;
  22701. class HgBitbucketDriver extends BitbucketDriver
  22702. {
  22703. public function getRootIdentifier()
  22704. {
  22705. if ($this->fallbackDriver) {
  22706. return $this->fallbackDriver->getRootIdentifier();
  22707. }
  22708. if (null === $this->rootIdentifier) {
  22709. if (! $this->getRepoData()) {
  22710. return $this->fallbackDriver->getRootIdentifier();
  22711. }
  22712. if ($this->vcsType !== 'hg') {
  22713. throw new \RuntimeException(
  22714. $this->url.' does not appear to be a mercurial repository, use '.
  22715. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  22716. );
  22717. }
  22718. $mainBranchData = $this->getMainBranchData();
  22719. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  22720. }
  22721. return $this->rootIdentifier;
  22722. }
  22723. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22724. {
  22725. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
  22726. return false;
  22727. }
  22728. if (!extension_loaded('openssl')) {
  22729. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22730. return false;
  22731. }
  22732. return true;
  22733. }
  22734. protected function setupFallbackDriver($url)
  22735. {
  22736. $this->fallbackDriver = new HgDriver(
  22737. array('url' => $url),
  22738. $this->io,
  22739. $this->config,
  22740. $this->process,
  22741. $this->remoteFilesystem
  22742. );
  22743. $this->fallbackDriver->initialize();
  22744. }
  22745. protected function generateSshUrl()
  22746. {
  22747. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  22748. }
  22749. }
  22750. <?php
  22751. namespace Composer\Repository\Vcs;
  22752. use Composer\Config;
  22753. use Composer\Util\ProcessExecutor;
  22754. use Composer\Util\Filesystem;
  22755. use Composer\IO\IOInterface;
  22756. class HgDriver extends VcsDriver
  22757. {
  22758. protected $tags;
  22759. protected $branches;
  22760. protected $rootIdentifier;
  22761. protected $repoDir;
  22762. protected $infoCache = array();
  22763. public function initialize()
  22764. {
  22765. if (Filesystem::isLocalPath($this->url)) {
  22766. $this->repoDir = $this->url;
  22767. } else {
  22768. $cacheDir = $this->config->get('cache-vcs-dir');
  22769. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  22770. $fs = new Filesystem();
  22771. $fs->ensureDirectoryExists($cacheDir);
  22772. if (!is_writable(dirname($this->repoDir))) {
  22773. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  22774. }
  22775. $this->config->prohibitUrlByConfig($this->url, $this->io);
  22776. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  22777. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  22778. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  22779. }
  22780. } else {
  22781. $fs->removeDirectory($this->repoDir);
  22782. if (0 !== $this->process->execute(sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoDir)), $output, $cacheDir)) {
  22783. $output = $this->process->getErrorOutput();
  22784. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  22785. throw new \RuntimeException('Failed to clone '.$this->url.', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  22786. }
  22787. throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);
  22788. }
  22789. }
  22790. }
  22791. $this->getTags();
  22792. $this->getBranches();
  22793. }
  22794. public function getRootIdentifier()
  22795. {
  22796. if (null === $this->rootIdentifier) {
  22797. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  22798. $output = $this->process->splitLines($output);
  22799. $this->rootIdentifier = $output[0];
  22800. }
  22801. return $this->rootIdentifier;
  22802. }
  22803. public function getUrl()
  22804. {
  22805. return $this->url;
  22806. }
  22807. public function getSource($identifier)
  22808. {
  22809. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  22810. }
  22811. public function getDist($identifier)
  22812. {
  22813. return null;
  22814. }
  22815. public function getFileContent($file, $identifier)
  22816. {
  22817. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22818. $this->process->execute($resource, $content, $this->repoDir);
  22819. if (!trim($content)) {
  22820. return;
  22821. }
  22822. return $content;
  22823. }
  22824. public function getChangeDate($identifier)
  22825. {
  22826. $this->process->execute(
  22827. sprintf(
  22828. 'hg log --template "{date|rfc3339date}" -r %s',
  22829. ProcessExecutor::escape($identifier)
  22830. ),
  22831. $output,
  22832. $this->repoDir
  22833. );
  22834. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  22835. }
  22836. public function getTags()
  22837. {
  22838. if (null === $this->tags) {
  22839. $tags = array();
  22840. $this->process->execute('hg tags', $output, $this->repoDir);
  22841. foreach ($this->process->splitLines($output) as $tag) {
  22842. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  22843. $tags[$match[1]] = $match[2];
  22844. }
  22845. }
  22846. unset($tags['tip']);
  22847. $this->tags = $tags;
  22848. }
  22849. return $this->tags;
  22850. }
  22851. public function getBranches()
  22852. {
  22853. if (null === $this->branches) {
  22854. $branches = array();
  22855. $bookmarks = array();
  22856. $this->process->execute('hg branches', $output, $this->repoDir);
  22857. foreach ($this->process->splitLines($output) as $branch) {
  22858. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  22859. $branches[$match[1]] = $match[2];
  22860. }
  22861. }
  22862. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  22863. foreach ($this->process->splitLines($output) as $branch) {
  22864. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  22865. $bookmarks[$match[1]] = $match[2];
  22866. }
  22867. }
  22868. $this->branches = array_merge($bookmarks, $branches);
  22869. }
  22870. return $this->branches;
  22871. }
  22872. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22873. {
  22874. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  22875. return true;
  22876. }
  22877. if (Filesystem::isLocalPath($url)) {
  22878. $url = Filesystem::getPlatformPath($url);
  22879. if (!is_dir($url)) {
  22880. return false;
  22881. }
  22882. $process = new ProcessExecutor();
  22883. if ($process->execute('hg summary', $output, $url) === 0) {
  22884. return true;
  22885. }
  22886. }
  22887. if (!$deep) {
  22888. return false;
  22889. }
  22890. $processExecutor = new ProcessExecutor();
  22891. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  22892. return $exit === 0;
  22893. }
  22894. }
  22895. <?php
  22896. namespace Composer\Repository\Vcs;
  22897. use Composer\Config;
  22898. use Composer\IO\IOInterface;
  22899. use Composer\Util\ProcessExecutor;
  22900. use Composer\Util\Perforce;
  22901. class PerforceDriver extends VcsDriver
  22902. {
  22903. protected $depot;
  22904. protected $branch;
  22905. protected $perforce;
  22906. public function initialize()
  22907. {
  22908. $this->depot = $this->repoConfig['depot'];
  22909. $this->branch = '';
  22910. if (!empty($this->repoConfig['branch'])) {
  22911. $this->branch = $this->repoConfig['branch'];
  22912. }
  22913. $this->initPerforce($this->repoConfig);
  22914. $this->perforce->p4Login();
  22915. $this->perforce->checkStream();
  22916. $this->perforce->writeP4ClientSpec();
  22917. $this->perforce->connectClient();
  22918. return true;
  22919. }
  22920. private function initPerforce($repoConfig)
  22921. {
  22922. if (!empty($this->perforce)) {
  22923. return;
  22924. }
  22925. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  22926. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  22927. }
  22928. public function getFileContent($file, $identifier)
  22929. {
  22930. return $this->perforce->getFileContent($file, $identifier);
  22931. }
  22932. public function getChangeDate($identifier)
  22933. {
  22934. return null;
  22935. }
  22936. public function getRootIdentifier()
  22937. {
  22938. return $this->branch;
  22939. }
  22940. public function getBranches()
  22941. {
  22942. return $this->perforce->getBranches();
  22943. }
  22944. public function getTags()
  22945. {
  22946. return $this->perforce->getTags();
  22947. }
  22948. public function getDist($identifier)
  22949. {
  22950. return null;
  22951. }
  22952. public function getSource($identifier)
  22953. {
  22954. $source = array(
  22955. 'type' => 'perforce',
  22956. 'url' => $this->repoConfig['url'],
  22957. 'reference' => $identifier,
  22958. 'p4user' => $this->perforce->getUser(),
  22959. );
  22960. return $source;
  22961. }
  22962. public function getUrl()
  22963. {
  22964. return $this->url;
  22965. }
  22966. public function hasComposerFile($identifier)
  22967. {
  22968. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  22969. $composerInfoIdentifier = $identifier;
  22970. return !empty($composerInfo);
  22971. }
  22972. public function getContents($url)
  22973. {
  22974. return false;
  22975. }
  22976. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22977. {
  22978. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  22979. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  22980. }
  22981. return false;
  22982. }
  22983. public function cleanup()
  22984. {
  22985. $this->perforce->cleanupClientSpec();
  22986. $this->perforce = null;
  22987. }
  22988. public function getDepot()
  22989. {
  22990. return $this->depot;
  22991. }
  22992. public function getBranch()
  22993. {
  22994. return $this->branch;
  22995. }
  22996. }
  22997. <?php
  22998. namespace Composer\Repository\Vcs;
  22999. use Composer\Cache;
  23000. use Composer\Config;
  23001. use Composer\Json\JsonFile;
  23002. use Composer\Util\ProcessExecutor;
  23003. use Composer\Util\Filesystem;
  23004. use Composer\Util\Svn as SvnUtil;
  23005. use Composer\IO\IOInterface;
  23006. use Composer\Downloader\TransportException;
  23007. class SvnDriver extends VcsDriver
  23008. {
  23009. protected $cache;
  23010. protected $baseUrl;
  23011. protected $tags;
  23012. protected $branches;
  23013. protected $rootIdentifier;
  23014. protected $infoCache = array();
  23015. protected $trunkPath = 'trunk';
  23016. protected $branchesPath = 'branches';
  23017. protected $tagsPath = 'tags';
  23018. protected $packagePath = '';
  23019. protected $cacheCredentials = true;
  23020. private $util;
  23021. public function initialize()
  23022. {
  23023. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  23024. SvnUtil::cleanEnv();
  23025. if (isset($this->repoConfig['trunk-path'])) {
  23026. $this->trunkPath = $this->repoConfig['trunk-path'];
  23027. }
  23028. if (isset($this->repoConfig['branches-path'])) {
  23029. $this->branchesPath = $this->repoConfig['branches-path'];
  23030. }
  23031. if (isset($this->repoConfig['tags-path'])) {
  23032. $this->tagsPath = $this->repoConfig['tags-path'];
  23033. }
  23034. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  23035. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  23036. }
  23037. if (isset($this->repoConfig['package-path'])) {
  23038. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  23039. }
  23040. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  23041. $this->baseUrl = substr($this->url, 0, $pos);
  23042. }
  23043. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  23044. $this->getBranches();
  23045. $this->getTags();
  23046. }
  23047. public function getRootIdentifier()
  23048. {
  23049. return $this->rootIdentifier ?: $this->trunkPath;
  23050. }
  23051. public function getUrl()
  23052. {
  23053. return $this->url;
  23054. }
  23055. public function getSource($identifier)
  23056. {
  23057. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  23058. }
  23059. public function getDist($identifier)
  23060. {
  23061. return null;
  23062. }
  23063. public function getComposerInformation($identifier)
  23064. {
  23065. if (!isset($this->infoCache[$identifier])) {
  23066. if ($res = $this->cache->read($identifier.'.json')) {
  23067. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23068. }
  23069. $composer = $this->getBaseComposerInformation($identifier);
  23070. $this->cache->write($identifier.'.json', json_encode($composer));
  23071. $this->infoCache[$identifier] = $composer;
  23072. }
  23073. return $this->infoCache[$identifier];
  23074. }
  23075. public function getFileContent($file, $identifier)
  23076. {
  23077. $identifier = '/' . trim($identifier, '/') . '/';
  23078. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23079. if (!empty($match[2])) {
  23080. $path = $match[1];
  23081. $rev = $match[2];
  23082. } else {
  23083. $path = $identifier;
  23084. $rev = '';
  23085. }
  23086. try {
  23087. $resource = $path.$file;
  23088. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  23089. if (!trim($output)) {
  23090. return null;
  23091. }
  23092. } catch (\RuntimeException $e) {
  23093. throw new TransportException($e->getMessage());
  23094. }
  23095. return $output;
  23096. }
  23097. public function getChangeDate($identifier)
  23098. {
  23099. $identifier = '/' . trim($identifier, '/') . '/';
  23100. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  23101. if (!empty($match[2])) {
  23102. $path = $match[1];
  23103. $rev = $match[2];
  23104. } else {
  23105. $path = $identifier;
  23106. $rev = '';
  23107. }
  23108. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  23109. foreach ($this->process->splitLines($output) as $line) {
  23110. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  23111. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  23112. }
  23113. }
  23114. return null;
  23115. }
  23116. public function getTags()
  23117. {
  23118. if (null === $this->tags) {
  23119. $this->tags = array();
  23120. if ($this->tagsPath !== false) {
  23121. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  23122. if ($output) {
  23123. foreach ($this->process->splitLines($output) as $line) {
  23124. $line = trim($line);
  23125. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23126. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23127. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  23128. '/' . $this->tagsPath . '/' . $match[2],
  23129. $match[1]
  23130. );
  23131. }
  23132. }
  23133. }
  23134. }
  23135. }
  23136. }
  23137. return $this->tags;
  23138. }
  23139. public function getBranches()
  23140. {
  23141. if (null === $this->branches) {
  23142. $this->branches = array();
  23143. if (false === $this->trunkPath) {
  23144. $trunkParent = $this->baseUrl . '/';
  23145. } else {
  23146. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  23147. }
  23148. $output = $this->execute('svn ls --verbose', $trunkParent);
  23149. if ($output) {
  23150. foreach ($this->process->splitLines($output) as $line) {
  23151. $line = trim($line);
  23152. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23153. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  23154. $this->branches['trunk'] = $this->buildIdentifier(
  23155. '/' . $this->trunkPath,
  23156. $match[1]
  23157. );
  23158. $this->rootIdentifier = $this->branches['trunk'];
  23159. break;
  23160. }
  23161. }
  23162. }
  23163. }
  23164. unset($output);
  23165. if ($this->branchesPath !== false) {
  23166. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  23167. if ($output) {
  23168. foreach ($this->process->splitLines(trim($output)) as $line) {
  23169. $line = trim($line);
  23170. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  23171. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  23172. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  23173. '/' . $this->branchesPath . '/' . $match[2],
  23174. $match[1]
  23175. );
  23176. }
  23177. }
  23178. }
  23179. }
  23180. }
  23181. }
  23182. return $this->branches;
  23183. }
  23184. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23185. {
  23186. $url = self::normalizeUrl($url);
  23187. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  23188. return true;
  23189. }
  23190. if (!$deep && !Filesystem::isLocalPath($url)) {
  23191. return false;
  23192. }
  23193. $processExecutor = new ProcessExecutor();
  23194. $exit = $processExecutor->execute(
  23195. "svn info --non-interactive {$url}",
  23196. $ignoredOutput
  23197. );
  23198. if ($exit === 0) {
  23199. return true;
  23200. }
  23201. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  23202. return true;
  23203. }
  23204. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  23205. return true;
  23206. }
  23207. return false;
  23208. }
  23209. protected static function normalizeUrl($url)
  23210. {
  23211. $fs = new Filesystem();
  23212. if ($fs->isAbsolutePath($url)) {
  23213. return 'file://' . strtr($url, '\\', '/');
  23214. }
  23215. return $url;
  23216. }
  23217. protected function execute($command, $url)
  23218. {
  23219. if (null === $this->util) {
  23220. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  23221. $this->util->setCacheCredentials($this->cacheCredentials);
  23222. }
  23223. try {
  23224. return $this->util->execute($command, $url);
  23225. } catch (\RuntimeException $e) {
  23226. if (0 !== $this->process->execute('svn --version', $ignoredOutput)) {
  23227. throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  23228. }
  23229. throw new \RuntimeException(
  23230. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  23231. );
  23232. }
  23233. }
  23234. protected function buildIdentifier($baseDir, $revision)
  23235. {
  23236. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  23237. }
  23238. }
  23239. <?php
  23240. namespace Composer\Repository\Vcs;
  23241. use Composer\Cache;
  23242. use Composer\Downloader\TransportException;
  23243. use Composer\Config;
  23244. use Composer\Factory;
  23245. use Composer\IO\IOInterface;
  23246. use Composer\Json\JsonFile;
  23247. use Composer\Util\ProcessExecutor;
  23248. use Composer\Util\RemoteFilesystem;
  23249. use Composer\Util\Filesystem;
  23250. abstract class VcsDriver implements VcsDriverInterface
  23251. {
  23252. protected $url;
  23253. protected $originUrl;
  23254. protected $repoConfig;
  23255. protected $io;
  23256. protected $config;
  23257. protected $process;
  23258. protected $remoteFilesystem;
  23259. protected $infoCache = array();
  23260. protected $cache;
  23261. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  23262. {
  23263. if (Filesystem::isLocalPath($repoConfig['url'])) {
  23264. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  23265. }
  23266. $this->url = $repoConfig['url'];
  23267. $this->originUrl = $repoConfig['url'];
  23268. $this->repoConfig = $repoConfig;
  23269. $this->io = $io;
  23270. $this->config = $config;
  23271. $this->process = $process ?: new ProcessExecutor($io);
  23272. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23273. }
  23274. protected function shouldCache($identifier)
  23275. {
  23276. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  23277. }
  23278. public function getComposerInformation($identifier)
  23279. {
  23280. if (!isset($this->infoCache[$identifier])) {
  23281. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23282. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23283. }
  23284. $composer = $this->getBaseComposerInformation($identifier);
  23285. if ($this->shouldCache($identifier)) {
  23286. $this->cache->write($identifier, json_encode($composer));
  23287. }
  23288. $this->infoCache[$identifier] = $composer;
  23289. }
  23290. return $this->infoCache[$identifier];
  23291. }
  23292. protected function getBaseComposerInformation($identifier)
  23293. {
  23294. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  23295. if (!$composerFileContent) {
  23296. return null;
  23297. }
  23298. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  23299. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  23300. $composer['time'] = $changeDate->format(DATE_RFC3339);
  23301. }
  23302. return $composer;
  23303. }
  23304. public function hasComposerFile($identifier)
  23305. {
  23306. try {
  23307. return (bool) $this->getComposerInformation($identifier);
  23308. } catch (TransportException $e) {
  23309. }
  23310. return false;
  23311. }
  23312. protected function getScheme()
  23313. {
  23314. if (extension_loaded('openssl')) {
  23315. return 'https';
  23316. }
  23317. return 'http';
  23318. }
  23319. protected function getContents($url)
  23320. {
  23321. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  23322. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  23323. }
  23324. public function cleanup()
  23325. {
  23326. return;
  23327. }
  23328. }
  23329. <?php
  23330. namespace Composer\Repository\Vcs;
  23331. use Composer\Config;
  23332. use Composer\IO\IOInterface;
  23333. interface VcsDriverInterface
  23334. {
  23335. public function initialize();
  23336. public function getComposerInformation($identifier);
  23337. public function getFileContent($file, $identifier);
  23338. public function getChangeDate($identifier);
  23339. public function getRootIdentifier();
  23340. public function getBranches();
  23341. public function getTags();
  23342. public function getDist($identifier);
  23343. public function getSource($identifier);
  23344. public function getUrl();
  23345. public function hasComposerFile($identifier);
  23346. public function cleanup();
  23347. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  23348. }
  23349. <?php
  23350. namespace Composer\Repository;
  23351. use Composer\Downloader\TransportException;
  23352. use Composer\Repository\Vcs\VcsDriverInterface;
  23353. use Composer\Package\Version\VersionParser;
  23354. use Composer\Package\Loader\ArrayLoader;
  23355. use Composer\Package\Loader\ValidatingArrayLoader;
  23356. use Composer\Package\Loader\InvalidPackageException;
  23357. use Composer\Package\Loader\LoaderInterface;
  23358. use Composer\EventDispatcher\EventDispatcher;
  23359. use Composer\IO\IOInterface;
  23360. use Composer\Config;
  23361. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  23362. {
  23363. protected $url;
  23364. protected $packageName;
  23365. protected $verbose;
  23366. protected $io;
  23367. protected $config;
  23368. protected $versionParser;
  23369. protected $type;
  23370. protected $loader;
  23371. protected $repoConfig;
  23372. protected $branchErrorOccurred = false;
  23373. private $drivers;
  23374. private $driver;
  23375. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null)
  23376. {
  23377. parent::__construct();
  23378. $this->drivers = $drivers ?: array(
  23379. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  23380. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  23381. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  23382. 'git' => 'Composer\Repository\Vcs\GitDriver',
  23383. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  23384. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  23385. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  23386. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  23387. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  23388. );
  23389. $this->url = $repoConfig['url'];
  23390. $this->io = $io;
  23391. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  23392. $this->verbose = $io->isVeryVerbose();
  23393. $this->config = $config;
  23394. $this->repoConfig = $repoConfig;
  23395. }
  23396. public function getRepoConfig()
  23397. {
  23398. return $this->repoConfig;
  23399. }
  23400. public function setLoader(LoaderInterface $loader)
  23401. {
  23402. $this->loader = $loader;
  23403. }
  23404. public function getDriver()
  23405. {
  23406. if ($this->driver) {
  23407. return $this->driver;
  23408. }
  23409. if (isset($this->drivers[$this->type])) {
  23410. $class = $this->drivers[$this->type];
  23411. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  23412. $this->driver->initialize();
  23413. return $this->driver;
  23414. }
  23415. foreach ($this->drivers as $driver) {
  23416. if ($driver::supports($this->io, $this->config, $this->url)) {
  23417. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  23418. $this->driver->initialize();
  23419. return $this->driver;
  23420. }
  23421. }
  23422. foreach ($this->drivers as $driver) {
  23423. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  23424. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  23425. $this->driver->initialize();
  23426. return $this->driver;
  23427. }
  23428. }
  23429. }
  23430. public function hadInvalidBranches()
  23431. {
  23432. return $this->branchErrorOccurred;
  23433. }
  23434. protected function initialize()
  23435. {
  23436. parent::initialize();
  23437. $verbose = $this->verbose;
  23438. $driver = $this->getDriver();
  23439. if (!$driver) {
  23440. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  23441. }
  23442. $this->versionParser = new VersionParser;
  23443. if (!$this->loader) {
  23444. $this->loader = new ArrayLoader($this->versionParser);
  23445. }
  23446. try {
  23447. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  23448. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  23449. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  23450. }
  23451. } catch (\Exception $e) {
  23452. if ($verbose) {
  23453. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  23454. }
  23455. }
  23456. foreach ($driver->getTags() as $tag => $identifier) {
  23457. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  23458. if ($verbose) {
  23459. $this->io->writeError($msg);
  23460. } else {
  23461. $this->io->overwriteError($msg, false);
  23462. }
  23463. $tag = str_replace('release-', '', $tag);
  23464. if (!$parsedTag = $this->validateTag($tag)) {
  23465. if ($verbose) {
  23466. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  23467. }
  23468. continue;
  23469. }
  23470. try {
  23471. if (!$data = $driver->getComposerInformation($identifier)) {
  23472. if ($verbose) {
  23473. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  23474. }
  23475. continue;
  23476. }
  23477. if (isset($data['version'])) {
  23478. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  23479. } else {
  23480. $data['version'] = $tag;
  23481. $data['version_normalized'] = $parsedTag;
  23482. }
  23483. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  23484. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  23485. if ($data['version_normalized'] !== $parsedTag) {
  23486. if ($verbose) {
  23487. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  23488. }
  23489. continue;
  23490. }
  23491. if ($verbose) {
  23492. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  23493. }
  23494. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  23495. } catch (\Exception $e) {
  23496. if ($verbose) {
  23497. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  23498. }
  23499. continue;
  23500. }
  23501. }
  23502. if (!$verbose) {
  23503. $this->io->overwriteError('', false);
  23504. }
  23505. foreach ($driver->getBranches() as $branch => $identifier) {
  23506. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  23507. if ($verbose) {
  23508. $this->io->writeError($msg);
  23509. } else {
  23510. $this->io->overwriteError($msg, false);
  23511. }
  23512. if (!$parsedBranch = $this->validateBranch($branch)) {
  23513. if ($verbose) {
  23514. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  23515. }
  23516. continue;
  23517. }
  23518. try {
  23519. if (!$data = $driver->getComposerInformation($identifier)) {
  23520. if ($verbose) {
  23521. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  23522. }
  23523. continue;
  23524. }
  23525. $data['version'] = $branch;
  23526. $data['version_normalized'] = $parsedBranch;
  23527. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  23528. $data['version'] = 'dev-' . $data['version'];
  23529. } else {
  23530. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  23531. $data['version'] = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  23532. }
  23533. if ($verbose) {
  23534. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  23535. }
  23536. $packageData = $this->preProcess($driver, $data, $identifier);
  23537. $package = $this->loader->load($packageData);
  23538. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  23539. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  23540. }
  23541. $this->addPackage($package);
  23542. } catch (TransportException $e) {
  23543. if ($verbose) {
  23544. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  23545. }
  23546. continue;
  23547. } catch (\Exception $e) {
  23548. if (!$verbose) {
  23549. $this->io->writeError('');
  23550. }
  23551. $this->branchErrorOccurred = true;
  23552. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  23553. $this->io->writeError('');
  23554. continue;
  23555. }
  23556. }
  23557. $driver->cleanup();
  23558. if (!$verbose) {
  23559. $this->io->overwriteError('', false);
  23560. }
  23561. if (!$this->getPackages()) {
  23562. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  23563. }
  23564. }
  23565. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  23566. {
  23567. $data['name'] = $this->packageName ?: $data['name'];
  23568. if (!isset($data['dist'])) {
  23569. $data['dist'] = $driver->getDist($identifier);
  23570. }
  23571. if (!isset($data['source'])) {
  23572. $data['source'] = $driver->getSource($identifier);
  23573. }
  23574. return $data;
  23575. }
  23576. private function validateBranch($branch)
  23577. {
  23578. try {
  23579. return $this->versionParser->normalizeBranch($branch);
  23580. } catch (\Exception $e) {
  23581. }
  23582. return false;
  23583. }
  23584. private function validateTag($version)
  23585. {
  23586. try {
  23587. return $this->versionParser->normalize($version);
  23588. } catch (\Exception $e) {
  23589. }
  23590. return false;
  23591. }
  23592. }
  23593. <?php
  23594. namespace Composer\Repository;
  23595. use Composer\Package\AliasPackage;
  23596. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  23597. {
  23598. public function write()
  23599. {
  23600. }
  23601. public function reload()
  23602. {
  23603. }
  23604. public function getCanonicalPackages()
  23605. {
  23606. $packages = $this->getPackages();
  23607. $packagesByName = array();
  23608. foreach ($packages as $package) {
  23609. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  23610. $packagesByName[$package->getName()] = $package;
  23611. }
  23612. }
  23613. $canonicalPackages = array();
  23614. foreach ($packagesByName as $package) {
  23615. while ($package instanceof AliasPackage) {
  23616. $package = $package->getAliasOf();
  23617. }
  23618. $canonicalPackages[] = $package;
  23619. }
  23620. return $canonicalPackages;
  23621. }
  23622. }
  23623. <?php
  23624. namespace Composer\Repository;
  23625. use Composer\Package\PackageInterface;
  23626. interface WritableRepositoryInterface extends RepositoryInterface
  23627. {
  23628. public function write();
  23629. public function addPackage(PackageInterface $package);
  23630. public function removePackage(PackageInterface $package);
  23631. public function getCanonicalPackages();
  23632. public function reload();
  23633. }
  23634. <?php
  23635. namespace Composer\Script;
  23636. class CommandEvent extends Event
  23637. {
  23638. }
  23639. <?php
  23640. namespace Composer\Script;
  23641. use Composer\Composer;
  23642. use Composer\IO\IOInterface;
  23643. use Composer\EventDispatcher\Event as BaseEvent;
  23644. class Event extends BaseEvent
  23645. {
  23646. private $composer;
  23647. private $io;
  23648. private $devMode;
  23649. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  23650. {
  23651. parent::__construct($name, $args, $flags);
  23652. $this->composer = $composer;
  23653. $this->io = $io;
  23654. $this->devMode = $devMode;
  23655. }
  23656. public function getComposer()
  23657. {
  23658. return $this->composer;
  23659. }
  23660. public function getIO()
  23661. {
  23662. return $this->io;
  23663. }
  23664. public function isDevMode()
  23665. {
  23666. return $this->devMode;
  23667. }
  23668. }
  23669. <?php
  23670. namespace Composer\Script;
  23671. use Composer\Installer\PackageEvent as BasePackageEvent;
  23672. class PackageEvent extends BasePackageEvent
  23673. {
  23674. }
  23675. <?php
  23676. namespace Composer\Script;
  23677. class ScriptEvents
  23678. {
  23679. const PRE_INSTALL_CMD = 'pre-install-cmd';
  23680. const POST_INSTALL_CMD = 'post-install-cmd';
  23681. const PRE_UPDATE_CMD = 'pre-update-cmd';
  23682. const POST_UPDATE_CMD = 'post-update-cmd';
  23683. const PRE_STATUS_CMD = 'pre-status-cmd';
  23684. const POST_STATUS_CMD = 'post-status-cmd';
  23685. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  23686. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  23687. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  23688. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  23689. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  23690. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  23691. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  23692. const POST_PACKAGE_INSTALL = 'post-package-install';
  23693. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  23694. const POST_PACKAGE_UPDATE = 'post-package-update';
  23695. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  23696. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  23697. }
  23698. <?php
  23699. namespace Composer\SelfUpdate;
  23700. class Keys
  23701. {
  23702. public static function fingerprint($path)
  23703. {
  23704. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  23705. return implode(' ', array(
  23706. substr($hash, 0, 8),
  23707. substr($hash, 8, 8),
  23708. substr($hash, 16, 8),
  23709. substr($hash, 24, 8),
  23710. '',
  23711. substr($hash, 32, 8),
  23712. substr($hash, 40, 8),
  23713. substr($hash, 48, 8),
  23714. substr($hash, 56, 8),
  23715. ));
  23716. }
  23717. }
  23718. <?php
  23719. namespace Composer\SelfUpdate;
  23720. use Composer\Util\RemoteFilesystem;
  23721. use Composer\Config;
  23722. use Composer\Json\JsonFile;
  23723. class Versions
  23724. {
  23725. private $rfs;
  23726. private $config;
  23727. private $channel;
  23728. public function __construct(Config $config, RemoteFilesystem $rfs)
  23729. {
  23730. $this->rfs = $rfs;
  23731. $this->config = $config;
  23732. }
  23733. public function getChannel()
  23734. {
  23735. if ($this->channel) {
  23736. return $this->channel;
  23737. }
  23738. $channelFile = $this->config->get('home').'/update-channel';
  23739. if (file_exists($channelFile)) {
  23740. $channel = trim(file_get_contents($channelFile));
  23741. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  23742. return $this->channel = $channel;
  23743. }
  23744. }
  23745. return $this->channel = 'stable';
  23746. }
  23747. public function setChannel($channel)
  23748. {
  23749. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  23750. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  23751. }
  23752. $channelFile = $this->config->get('home').'/update-channel';
  23753. $this->channel = $channel;
  23754. file_put_contents($channelFile, $channel.PHP_EOL);
  23755. }
  23756. public function getLatest()
  23757. {
  23758. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  23759. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  23760. foreach ($versions[$this->getChannel()] as $version) {
  23761. if ($version['min-php'] <= PHP_VERSION_ID) {
  23762. return $version;
  23763. }
  23764. }
  23765. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  23766. }
  23767. }
  23768. <?php
  23769. namespace Composer\Util;
  23770. use Composer\Config;
  23771. use Composer\IO\IOInterface;
  23772. class AuthHelper
  23773. {
  23774. protected $io;
  23775. protected $config;
  23776. public function __construct(IOInterface $io, Config $config)
  23777. {
  23778. $this->io = $io;
  23779. $this->config = $config;
  23780. }
  23781. public function storeAuth($originUrl, $storeAuth)
  23782. {
  23783. $store = false;
  23784. $configSource = $this->config->getAuthConfigSource();
  23785. if ($storeAuth === true) {
  23786. $store = $configSource;
  23787. } elseif ($storeAuth === 'prompt') {
  23788. $answer = $this->io->askAndValidate(
  23789. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  23790. function ($value) {
  23791. $input = strtolower(substr(trim($value), 0, 1));
  23792. if (in_array($input, array('y','n'))) {
  23793. return $input;
  23794. }
  23795. throw new \RuntimeException('Please answer (y)es or (n)o');
  23796. },
  23797. null,
  23798. 'y'
  23799. );
  23800. if ($answer === 'y') {
  23801. $store = $configSource;
  23802. }
  23803. }
  23804. if ($store) {
  23805. $store->addConfigSetting(
  23806. 'http-basic.'.$originUrl,
  23807. $this->io->getAuthentication($originUrl)
  23808. );
  23809. }
  23810. }
  23811. }
  23812. <?php
  23813. namespace Composer\Util;
  23814. use Composer\Factory;
  23815. use Composer\IO\IOInterface;
  23816. use Composer\Config;
  23817. use Composer\Downloader\TransportException;
  23818. class Bitbucket
  23819. {
  23820. private $io;
  23821. private $config;
  23822. private $process;
  23823. private $remoteFilesystem;
  23824. private $token = array();
  23825. private $time;
  23826. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  23827. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  23828. {
  23829. $this->io = $io;
  23830. $this->config = $config;
  23831. $this->process = $process ?: new ProcessExecutor;
  23832. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  23833. $this->time = $time;
  23834. }
  23835. public function getToken()
  23836. {
  23837. if (!isset($this->token['access_token'])) {
  23838. return '';
  23839. }
  23840. return $this->token['access_token'];
  23841. }
  23842. public function authorizeOAuth($originUrl)
  23843. {
  23844. if ($originUrl !== 'bitbucket.org') {
  23845. return false;
  23846. }
  23847. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  23848. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  23849. return true;
  23850. }
  23851. return false;
  23852. }
  23853. private function requestAccessToken($originUrl)
  23854. {
  23855. try {
  23856. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  23857. 'retry-auth-failure' => false,
  23858. 'http' => array(
  23859. 'method' => 'POST',
  23860. 'content' => 'grant_type=client_credentials',
  23861. ),
  23862. ));
  23863. $this->token = json_decode($json, true);
  23864. } catch (TransportException $e) {
  23865. if ($e->getCode() === 400) {
  23866. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  23867. $this->io->writeError('This can have two reasons:');
  23868. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  23869. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  23870. return false;
  23871. } elseif (in_array($e->getCode(), array(403, 401))) {
  23872. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  23873. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  23874. return false;
  23875. }
  23876. throw $e;
  23877. }
  23878. return true;
  23879. }
  23880. public function authorizeOAuthInteractively($originUrl, $message = null)
  23881. {
  23882. if ($message) {
  23883. $this->io->writeError($message);
  23884. }
  23885. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  23886. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  23887. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  23888. $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  23889. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  23890. if (!$consumerKey) {
  23891. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  23892. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  23893. return false;
  23894. }
  23895. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  23896. if (!$consumerSecret) {
  23897. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  23898. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  23899. return false;
  23900. }
  23901. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  23902. if (!$this->requestAccessToken($originUrl)) {
  23903. return false;
  23904. }
  23905. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  23906. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  23907. $this->io->writeError('<info>Consumer stored successfully.</info>');
  23908. return true;
  23909. }
  23910. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  23911. {
  23912. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  23913. return $this->token['access_token'];
  23914. }
  23915. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  23916. if (!$this->requestAccessToken($originUrl)) {
  23917. return '';
  23918. }
  23919. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  23920. return $this->token['access_token'];
  23921. }
  23922. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  23923. {
  23924. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  23925. $time = null === $this->time ? time() : $this->time;
  23926. $consumer = array(
  23927. "consumer-key" => $consumerKey,
  23928. "consumer-secret" => $consumerSecret,
  23929. "access-token" => $this->token['access_token'],
  23930. "access-token-expiration" => $time + $this->token['expires_in'],
  23931. );
  23932. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  23933. }
  23934. private function getTokenFromConfig($originUrl)
  23935. {
  23936. $authConfig = $this->config->get('bitbucket-oauth');
  23937. if (
  23938. !isset($authConfig[$originUrl]['access-token'])
  23939. || !isset($authConfig[$originUrl]['access-token-expiration'])
  23940. || time() > $authConfig[$originUrl]['access-token-expiration']
  23941. ) {
  23942. return false;
  23943. }
  23944. $this->token = array(
  23945. 'access_token' => $authConfig[$originUrl]['access-token'],
  23946. );
  23947. return true;
  23948. }
  23949. }
  23950. <?php
  23951. namespace Composer\Util;
  23952. class ComposerMirror
  23953. {
  23954. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  23955. {
  23956. if ($reference) {
  23957. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  23958. }
  23959. $version = strpos($version, '/') === false ? $version : md5($version);
  23960. return str_replace(
  23961. array('%package%', '%version%', '%reference%', '%type%'),
  23962. array($packageName, $version, $reference, $type),
  23963. $mirrorUrl
  23964. );
  23965. }
  23966. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  23967. {
  23968. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  23969. $url = 'gh-'.$match[1].'/'.$match[2];
  23970. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  23971. $url = 'bb-'.$match[1].'/'.$match[2];
  23972. } else {
  23973. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  23974. }
  23975. return str_replace(
  23976. array('%package%', '%normalizedUrl%', '%type%'),
  23977. array($packageName, $url, $type),
  23978. $mirrorUrl
  23979. );
  23980. }
  23981. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  23982. {
  23983. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  23984. }
  23985. }
  23986. <?php
  23987. namespace Composer\Util;
  23988. use Composer\Package\Loader\ArrayLoader;
  23989. use Composer\Package\Loader\ValidatingArrayLoader;
  23990. use Composer\Package\Loader\InvalidPackageException;
  23991. use Composer\Json\JsonValidationException;
  23992. use Composer\IO\IOInterface;
  23993. use Composer\Json\JsonFile;
  23994. class ConfigValidator
  23995. {
  23996. private $io;
  23997. public function __construct(IOInterface $io)
  23998. {
  23999. $this->io = $io;
  24000. }
  24001. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  24002. {
  24003. $errors = array();
  24004. $publishErrors = array();
  24005. $warnings = array();
  24006. $laxValid = false;
  24007. try {
  24008. $json = new JsonFile($file, null, $this->io);
  24009. $manifest = $json->read();
  24010. $json->validateSchema(JsonFile::LAX_SCHEMA);
  24011. $laxValid = true;
  24012. $json->validateSchema();
  24013. } catch (JsonValidationException $e) {
  24014. foreach ($e->getErrors() as $message) {
  24015. if ($laxValid) {
  24016. $publishErrors[] = $message;
  24017. } else {
  24018. $errors[] = $message;
  24019. }
  24020. }
  24021. } catch (\Exception $e) {
  24022. $errors[] = $e->getMessage();
  24023. return array($errors, $publishErrors, $warnings);
  24024. }
  24025. if (empty($manifest['license'])) {
  24026. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  24027. }
  24028. if (isset($manifest['version'])) {
  24029. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  24030. }
  24031. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  24032. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  24033. $suggestName = strtolower($suggestName);
  24034. $publishErrors[] = sprintf(
  24035. 'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
  24036. $manifest['name'],
  24037. $suggestName
  24038. );
  24039. }
  24040. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  24041. $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See https://getcomposer.org/doc/articles/plugins.md for plugin documentation.";
  24042. }
  24043. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  24044. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  24045. if (!empty($requireOverrides)) {
  24046. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  24047. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  24048. }
  24049. }
  24050. $require = isset($manifest['require']) ? $manifest['require'] : array();
  24051. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  24052. $packages = array_merge($require, $requireDev);
  24053. foreach ($packages as $package => $version) {
  24054. if (preg_match('/#/', $version) === 1) {
  24055. $warnings[] = sprintf(
  24056. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  24057. $package
  24058. );
  24059. }
  24060. }
  24061. if (isset($manifest['autoload']['psr-0'][''])) {
  24062. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  24063. }
  24064. if (isset($manifest['autoload']['psr-4'][''])) {
  24065. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  24066. }
  24067. try {
  24068. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  24069. if (!isset($manifest['version'])) {
  24070. $manifest['version'] = '1.0.0';
  24071. }
  24072. if (!isset($manifest['name'])) {
  24073. $manifest['name'] = 'dummy/dummy';
  24074. }
  24075. $loader->load($manifest);
  24076. } catch (InvalidPackageException $e) {
  24077. $errors = array_merge($errors, $e->getErrors());
  24078. }
  24079. $warnings = array_merge($warnings, $loader->getWarnings());
  24080. return array($errors, $publishErrors, $warnings);
  24081. }
  24082. }
  24083. <?php
  24084. namespace Composer\Util;
  24085. use Composer\IO\IOInterface;
  24086. class ErrorHandler
  24087. {
  24088. private static $io;
  24089. public static function handle($level, $message, $file, $line)
  24090. {
  24091. if (!(error_reporting() & $level)) {
  24092. return;
  24093. }
  24094. if (ini_get('xdebug.scream')) {
  24095. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  24096. "\na legitimately suppressed error that you were not supposed to see.";
  24097. }
  24098. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  24099. throw new \ErrorException($message, 0, $level, $file, $line);
  24100. }
  24101. if (self::$io) {
  24102. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  24103. if (self::$io->isVerbose()) {
  24104. self::$io->writeError('<warning>Stack trace:</warning>');
  24105. self::$io->writeError(array_filter(array_map(function ($a) {
  24106. if (isset($a['line'], $a['file'])) {
  24107. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  24108. }
  24109. return null;
  24110. }, array_slice(debug_backtrace(), 2))));
  24111. }
  24112. }
  24113. }
  24114. public static function register(IOInterface $io = null)
  24115. {
  24116. set_error_handler(array(__CLASS__, 'handle'));
  24117. error_reporting(E_ALL | E_STRICT);
  24118. self::$io = $io;
  24119. }
  24120. }
  24121. <?php
  24122. namespace Composer\Util;
  24123. use RecursiveDirectoryIterator;
  24124. use RecursiveIteratorIterator;
  24125. use Symfony\Component\Filesystem\Exception\IOException;
  24126. use Symfony\Component\Finder\Finder;
  24127. class Filesystem
  24128. {
  24129. private $processExecutor;
  24130. public function __construct(ProcessExecutor $executor = null)
  24131. {
  24132. $this->processExecutor = $executor ?: new ProcessExecutor();
  24133. }
  24134. public function remove($file)
  24135. {
  24136. if (is_dir($file)) {
  24137. return $this->removeDirectory($file);
  24138. }
  24139. if (file_exists($file)) {
  24140. return $this->unlink($file);
  24141. }
  24142. return false;
  24143. }
  24144. public function isDirEmpty($dir)
  24145. {
  24146. $finder = Finder::create()
  24147. ->ignoreVCS(false)
  24148. ->ignoreDotFiles(false)
  24149. ->depth(0)
  24150. ->in($dir);
  24151. return count($finder) === 0;
  24152. }
  24153. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  24154. {
  24155. if (file_exists($dir) && is_link($dir)) {
  24156. $this->unlink($dir);
  24157. }
  24158. if ($ensureDirectoryExists) {
  24159. $this->ensureDirectoryExists($dir);
  24160. }
  24161. if (is_dir($dir)) {
  24162. $finder = Finder::create()
  24163. ->ignoreVCS(false)
  24164. ->ignoreDotFiles(false)
  24165. ->depth(0)
  24166. ->in($dir);
  24167. foreach ($finder as $path) {
  24168. $this->remove((string) $path);
  24169. }
  24170. }
  24171. }
  24172. public function removeDirectory($directory)
  24173. {
  24174. if ($this->isSymlinkedDirectory($directory)) {
  24175. return $this->unlinkSymlinkedDirectory($directory);
  24176. }
  24177. if ($this->isJunction($directory)) {
  24178. return $this->removeJunction($directory);
  24179. }
  24180. if (!file_exists($directory) || !is_dir($directory)) {
  24181. return true;
  24182. }
  24183. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  24184. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  24185. }
  24186. if (!function_exists('proc_open')) {
  24187. return $this->removeDirectoryPhp($directory);
  24188. }
  24189. if (Platform::isWindows()) {
  24190. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  24191. } else {
  24192. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  24193. }
  24194. $result = $this->getProcess()->execute($cmd, $output) === 0;
  24195. clearstatcache();
  24196. if ($result && !file_exists($directory)) {
  24197. return true;
  24198. }
  24199. return $this->removeDirectoryPhp($directory);
  24200. }
  24201. public function removeDirectoryPhp($directory)
  24202. {
  24203. try {
  24204. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24205. } catch (\UnexpectedValueException $e) {
  24206. clearstatcache();
  24207. usleep(100000);
  24208. if (!is_dir($directory)) {
  24209. return true;
  24210. }
  24211. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24212. }
  24213. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  24214. foreach ($ri as $file) {
  24215. if ($file->isDir()) {
  24216. $this->rmdir($file->getPathname());
  24217. } else {
  24218. $this->unlink($file->getPathname());
  24219. }
  24220. }
  24221. return $this->rmdir($directory);
  24222. }
  24223. public function ensureDirectoryExists($directory)
  24224. {
  24225. if (!is_dir($directory)) {
  24226. if (file_exists($directory)) {
  24227. throw new \RuntimeException(
  24228. $directory.' exists and is not a directory.'
  24229. );
  24230. }
  24231. if (!@mkdir($directory, 0777, true)) {
  24232. throw new \RuntimeException(
  24233. $directory.' does not exist and could not be created.'
  24234. );
  24235. }
  24236. }
  24237. }
  24238. public function unlink($path)
  24239. {
  24240. if (!@$this->unlinkImplementation($path)) {
  24241. if (!Platform::isWindows() || (usleep(350000) && !@$this->unlinkImplementation($path))) {
  24242. $error = error_get_last();
  24243. $message = 'Could not delete '.$path.': ' . @$error['message'];
  24244. if (Platform::isWindows()) {
  24245. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  24246. }
  24247. throw new \RuntimeException($message);
  24248. }
  24249. }
  24250. return true;
  24251. }
  24252. public function rmdir($path)
  24253. {
  24254. if (!@rmdir($path)) {
  24255. if (!Platform::isWindows() || (usleep(350000) && !@rmdir($path))) {
  24256. $error = error_get_last();
  24257. $message = 'Could not delete '.$path.': ' . @$error['message'];
  24258. if (Platform::isWindows()) {
  24259. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  24260. }
  24261. throw new \RuntimeException($message);
  24262. }
  24263. }
  24264. return true;
  24265. }
  24266. public function copyThenRemove($source, $target)
  24267. {
  24268. $this->copy($source, $target);
  24269. if (!is_dir($source)) {
  24270. $this->unlink($source);
  24271. return;
  24272. }
  24273. $this->removeDirectoryPhp($source);
  24274. }
  24275. public function copy($source, $target)
  24276. {
  24277. if (!is_dir($source)) {
  24278. return copy($source, $target);
  24279. }
  24280. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  24281. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  24282. $this->ensureDirectoryExists($target);
  24283. $result = true;
  24284. foreach ($ri as $file) {
  24285. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  24286. if ($file->isDir()) {
  24287. $this->ensureDirectoryExists($targetPath);
  24288. } else {
  24289. $result = $result && copy($file->getPathname(), $targetPath);
  24290. }
  24291. }
  24292. return $result;
  24293. }
  24294. public function rename($source, $target)
  24295. {
  24296. if (true === @rename($source, $target)) {
  24297. return;
  24298. }
  24299. if (!function_exists('proc_open')) {
  24300. return $this->copyThenRemove($source, $target);
  24301. }
  24302. if (Platform::isWindows()) {
  24303. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  24304. $result = $this->processExecutor->execute($command, $output);
  24305. clearstatcache();
  24306. if (0 === $result) {
  24307. $this->remove($source);
  24308. return;
  24309. }
  24310. } else {
  24311. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  24312. $result = $this->processExecutor->execute($command, $output);
  24313. clearstatcache();
  24314. if (0 === $result) {
  24315. return;
  24316. }
  24317. }
  24318. return $this->copyThenRemove($source, $target);
  24319. }
  24320. public function findShortestPath($from, $to, $directories = false)
  24321. {
  24322. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  24323. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  24324. }
  24325. $from = lcfirst($this->normalizePath($from));
  24326. $to = lcfirst($this->normalizePath($to));
  24327. if ($directories) {
  24328. $from = rtrim($from, '/') . '/dummy_file';
  24329. }
  24330. if (dirname($from) === dirname($to)) {
  24331. return './'.basename($to);
  24332. }
  24333. $commonPath = $to;
  24334. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  24335. $commonPath = strtr(dirname($commonPath), '\\', '/');
  24336. }
  24337. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  24338. return $to;
  24339. }
  24340. $commonPath = rtrim($commonPath, '/') . '/';
  24341. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  24342. $commonPathCode = str_repeat('../', $sourcePathDepth);
  24343. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  24344. }
  24345. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  24346. {
  24347. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  24348. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  24349. }
  24350. $from = lcfirst($this->normalizePath($from));
  24351. $to = lcfirst($this->normalizePath($to));
  24352. if ($from === $to) {
  24353. return $directories ? '__DIR__' : '__FILE__';
  24354. }
  24355. $commonPath = $to;
  24356. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  24357. $commonPath = strtr(dirname($commonPath), '\\', '/');
  24358. }
  24359. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  24360. return var_export($to, true);
  24361. }
  24362. $commonPath = rtrim($commonPath, '/') . '/';
  24363. if (strpos($to, $from.'/') === 0) {
  24364. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  24365. }
  24366. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  24367. if ($staticCode) {
  24368. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  24369. } else {
  24370. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  24371. }
  24372. $relTarget = substr($to, strlen($commonPath));
  24373. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  24374. }
  24375. public function isAbsolutePath($path)
  24376. {
  24377. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
  24378. }
  24379. public function size($path)
  24380. {
  24381. if (!file_exists($path)) {
  24382. throw new \RuntimeException("$path does not exist.");
  24383. }
  24384. if (is_dir($path)) {
  24385. return $this->directorySize($path);
  24386. }
  24387. return filesize($path);
  24388. }
  24389. public function normalizePath($path)
  24390. {
  24391. $parts = array();
  24392. $path = strtr($path, '\\', '/');
  24393. $prefix = '';
  24394. $absolute = false;
  24395. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  24396. $prefix = $match[1];
  24397. $path = substr($path, strlen($prefix));
  24398. }
  24399. if (substr($path, 0, 1) === '/') {
  24400. $absolute = true;
  24401. $path = substr($path, 1);
  24402. }
  24403. $up = false;
  24404. foreach (explode('/', $path) as $chunk) {
  24405. if ('..' === $chunk && ($absolute || $up)) {
  24406. array_pop($parts);
  24407. $up = !(empty($parts) || '..' === end($parts));
  24408. } elseif ('.' !== $chunk && '' !== $chunk) {
  24409. $parts[] = $chunk;
  24410. $up = '..' !== $chunk;
  24411. }
  24412. }
  24413. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  24414. }
  24415. public static function isLocalPath($path)
  24416. {
  24417. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  24418. }
  24419. public static function getPlatformPath($path)
  24420. {
  24421. if (Platform::isWindows()) {
  24422. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  24423. }
  24424. return preg_replace('{^file://}i', '', $path);
  24425. }
  24426. protected function directorySize($directory)
  24427. {
  24428. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  24429. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  24430. $size = 0;
  24431. foreach ($ri as $file) {
  24432. if ($file->isFile()) {
  24433. $size += $file->getSize();
  24434. }
  24435. }
  24436. return $size;
  24437. }
  24438. protected function getProcess()
  24439. {
  24440. return new ProcessExecutor;
  24441. }
  24442. private function unlinkImplementation($path)
  24443. {
  24444. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  24445. return rmdir($path);
  24446. }
  24447. return unlink($path);
  24448. }
  24449. public function relativeSymlink($target, $link)
  24450. {
  24451. $cwd = getcwd();
  24452. $relativePath = $this->findShortestPath($link, $target);
  24453. chdir(dirname($link));
  24454. $result = @symlink($relativePath, $link);
  24455. chdir($cwd);
  24456. return (bool) $result;
  24457. }
  24458. public function isSymlinkedDirectory($directory)
  24459. {
  24460. if (!is_dir($directory)) {
  24461. return false;
  24462. }
  24463. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  24464. return is_link($resolved);
  24465. }
  24466. private function unlinkSymlinkedDirectory($directory)
  24467. {
  24468. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  24469. return $this->unlink($resolved);
  24470. }
  24471. private function resolveSymlinkedDirectorySymlink($pathname)
  24472. {
  24473. if (!is_dir($pathname)) {
  24474. return $pathname;
  24475. }
  24476. $resolved = rtrim($pathname, '/');
  24477. if (!strlen($resolved)) {
  24478. return $pathname;
  24479. }
  24480. return $resolved;
  24481. }
  24482. public function junction($target, $junction)
  24483. {
  24484. if (!Platform::isWindows()) {
  24485. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  24486. }
  24487. if (!is_dir($target)) {
  24488. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  24489. }
  24490. $cmd = sprintf('mklink /J %s %s',
  24491. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  24492. ProcessExecutor::escape(realpath($target)));
  24493. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  24494. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  24495. }
  24496. clearstatcache(true, $junction);
  24497. }
  24498. public function isJunction($junction)
  24499. {
  24500. if (!Platform::isWindows()) {
  24501. return false;
  24502. }
  24503. if (!is_dir($junction) || is_link($junction)) {
  24504. return false;
  24505. }
  24506. clearstatcache(true, $junction);
  24507. clearstatcache(false);
  24508. $stat = lstat($junction);
  24509. return !($stat['mode'] & 0xC000);
  24510. }
  24511. public function removeJunction($junction)
  24512. {
  24513. if (!Platform::isWindows()) {
  24514. return false;
  24515. }
  24516. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  24517. if (!$this->isJunction($junction)) {
  24518. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  24519. }
  24520. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape($junction));
  24521. clearstatcache(true, $junction);
  24522. return ($this->getProcess()->execute($cmd, $output) === 0);
  24523. }
  24524. }
  24525. <?php
  24526. namespace Composer\Util;
  24527. use Composer\Config;
  24528. use Composer\IO\IOInterface;
  24529. class Git
  24530. {
  24531. private static $version;
  24532. protected $io;
  24533. protected $config;
  24534. protected $process;
  24535. protected $filesystem;
  24536. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  24537. {
  24538. $this->io = $io;
  24539. $this->config = $config;
  24540. $this->process = $process;
  24541. $this->filesystem = $fs;
  24542. }
  24543. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  24544. {
  24545. $this->config->prohibitUrlByConfig($url, $this->io);
  24546. if ($initialClone) {
  24547. $origCwd = $cwd;
  24548. $cwd = null;
  24549. }
  24550. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  24551. throw new \InvalidArgumentException('The source URL ' . $url . ' is invalid, ssh URLs should have a port number after ":".' . "\n" . 'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  24552. }
  24553. if (!$initialClone) {
  24554. $this->process->execute('git remote -v', $output, $cwd);
  24555. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
  24556. $this->io->setAuthentication($match[3], urldecode($match[1]), urldecode($match[2]));
  24557. }
  24558. }
  24559. $protocols = $this->config->get('github-protocols');
  24560. if (!is_array($protocols)) {
  24561. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  24562. }
  24563. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  24564. $messages = array();
  24565. foreach ($protocols as $protocol) {
  24566. if ('ssh' === $protocol) {
  24567. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  24568. } else {
  24569. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  24570. }
  24571. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  24572. return;
  24573. }
  24574. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  24575. if ($initialClone) {
  24576. $this->filesystem->removeDirectory($origCwd);
  24577. }
  24578. }
  24579. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  24580. }
  24581. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  24582. $command = call_user_func($commandCallable, $url);
  24583. $auth = null;
  24584. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  24585. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)) {
  24586. if (!$this->io->hasAuthentication($match[1])) {
  24587. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  24588. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  24589. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  24590. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  24591. }
  24592. }
  24593. if ($this->io->hasAuthentication($match[1])) {
  24594. $auth = $this->io->getAuthentication($match[1]);
  24595. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  24596. $command = call_user_func($commandCallable, $authUrl);
  24597. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24598. return;
  24599. }
  24600. }
  24601. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  24602. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  24603. if (!$this->io->hasAuthentication($match[1])) {
  24604. $message = 'Enter your Bitbucket credentials to access private repos';
  24605. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  24606. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  24607. $accessToken = $bitbucketUtil->getToken();
  24608. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  24609. }
  24610. } else {
  24611. $auth = $this->io->getAuthentication($match[1]);
  24612. if ($auth['username'] !== 'x-token-auth') {
  24613. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  24614. if (! empty($accessToken)) {
  24615. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  24616. }
  24617. }
  24618. }
  24619. if ($this->io->hasAuthentication($match[1])) {
  24620. $auth = $this->io->getAuthentication($match[1]);
  24621. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  24622. $command = call_user_func($commandCallable, $authUrl);
  24623. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24624. return;
  24625. }
  24626. } else {
  24627. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  24628. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  24629. $command = call_user_func($commandCallable, $sshUrl);
  24630. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24631. return;
  24632. }
  24633. }
  24634. } elseif ($this->isAuthenticationFailure($url, $match)) {
  24635. if (strpos($match[2], '@')) {
  24636. list($authParts, $match[2]) = explode('@', $match[2], 2);
  24637. }
  24638. $storeAuth = false;
  24639. if ($this->io->hasAuthentication($match[2])) {
  24640. $auth = $this->io->getAuthentication($match[2]);
  24641. } elseif ($this->io->isInteractive()) {
  24642. $defaultUsername = null;
  24643. if (isset($authParts) && $authParts) {
  24644. if (false !== strpos($authParts, ':')) {
  24645. list($defaultUsername, ) = explode(':', $authParts, 2);
  24646. } else {
  24647. $defaultUsername = $authParts;
  24648. }
  24649. }
  24650. $this->io->writeError(' Authentication required (<info>' . parse_url($url, PHP_URL_HOST) . '</info>):');
  24651. $auth = array(
  24652. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  24653. 'password' => $this->io->askAndHideAnswer(' Password: '),
  24654. );
  24655. $storeAuth = $this->config->get('store-auths');
  24656. }
  24657. if ($auth) {
  24658. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  24659. $command = call_user_func($commandCallable, $authUrl);
  24660. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  24661. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  24662. $authHelper = new AuthHelper($this->io, $this->config);
  24663. $authHelper->storeAuth($match[2], $storeAuth);
  24664. return;
  24665. }
  24666. }
  24667. }
  24668. if ($initialClone) {
  24669. $this->filesystem->removeDirectory($origCwd);
  24670. }
  24671. $this->throwException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput(), $url);
  24672. }
  24673. }
  24674. public function syncMirror($url, $dir)
  24675. {
  24676. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  24677. try {
  24678. $commandCallable = function ($url) {
  24679. return sprintf('git remote set-url origin %s && git remote update --prune origin', ProcessExecutor::escape($url));
  24680. };
  24681. $this->runCommand($commandCallable, $url, $dir);
  24682. } catch (\Exception $e) {
  24683. return false;
  24684. }
  24685. return true;
  24686. }
  24687. $this->filesystem->removeDirectory($dir);
  24688. $commandCallable = function ($url) use ($dir) {
  24689. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  24690. };
  24691. $this->runCommand($commandCallable, $url, $dir, true);
  24692. return true;
  24693. }
  24694. public function fetchRefOrSyncMirror($url, $dir, $ref)
  24695. {
  24696. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  24697. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  24698. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $output, $dir);
  24699. if ($exitCode === 0) {
  24700. return true;
  24701. }
  24702. }
  24703. $this->syncMirror($url, $dir);
  24704. return false;
  24705. }
  24706. private function isAuthenticationFailure($url, &$match)
  24707. {
  24708. if (!preg_match('{(https?://)([^/]+)(.*)$}i', $url, $match)) {
  24709. return false;
  24710. }
  24711. $authFailures = array(
  24712. 'fatal: Authentication failed',
  24713. 'remote error: Invalid username or password.',
  24714. 'error: 401 Unauthorized',
  24715. 'fatal: unable to access',
  24716. );
  24717. foreach ($authFailures as $authFailure) {
  24718. if (strpos($this->process->getErrorOutput(), $authFailure) !== false) {
  24719. return true;
  24720. }
  24721. }
  24722. return false;
  24723. }
  24724. public static function cleanEnv()
  24725. {
  24726. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  24727. throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
  24728. }
  24729. if (getenv('GIT_ASKPASS') !== 'echo') {
  24730. putenv('GIT_ASKPASS=echo');
  24731. unset($_SERVER['GIT_ASKPASS']);
  24732. }
  24733. if (getenv('GIT_DIR')) {
  24734. putenv('GIT_DIR');
  24735. unset($_SERVER['GIT_DIR']);
  24736. }
  24737. if (getenv('GIT_WORK_TREE')) {
  24738. putenv('GIT_WORK_TREE');
  24739. unset($_SERVER['GIT_WORK_TREE']);
  24740. }
  24741. if (getenv('LANGUAGE') !== 'C') {
  24742. putenv('LANGUAGE=C');
  24743. }
  24744. putenv("DYLD_LIBRARY_PATH");
  24745. unset($_SERVER['DYLD_LIBRARY_PATH']);
  24746. }
  24747. public static function getGitHubDomainsRegex(Config $config)
  24748. {
  24749. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  24750. }
  24751. public static function sanitizeUrl($message)
  24752. {
  24753. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  24754. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  24755. return '://***:***@';
  24756. }
  24757. return '://' . $m[1] . ':***@';
  24758. }, $message);
  24759. }
  24760. private function throwException($message, $url)
  24761. {
  24762. clearstatcache();
  24763. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  24764. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  24765. }
  24766. throw new \RuntimeException(self::sanitizeUrl($message));
  24767. }
  24768. public function getVersion()
  24769. {
  24770. if (isset(self::$version)) {
  24771. return self::$version;
  24772. }
  24773. if (0 !== $this->process->execute('git --version', $output)) {
  24774. return;
  24775. }
  24776. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  24777. return self::$version = $matches[1];
  24778. }
  24779. }
  24780. }
  24781. <?php
  24782. namespace Composer\Util;
  24783. use Composer\Factory;
  24784. use Composer\IO\IOInterface;
  24785. use Composer\Config;
  24786. use Composer\Downloader\TransportException;
  24787. class GitHub
  24788. {
  24789. protected $io;
  24790. protected $config;
  24791. protected $process;
  24792. protected $remoteFilesystem;
  24793. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24794. {
  24795. $this->io = $io;
  24796. $this->config = $config;
  24797. $this->process = $process ?: new ProcessExecutor;
  24798. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24799. }
  24800. public function authorizeOAuth($originUrl)
  24801. {
  24802. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  24803. return false;
  24804. }
  24805. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  24806. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  24807. return true;
  24808. }
  24809. return false;
  24810. }
  24811. public function authorizeOAuthInteractively($originUrl, $message = null)
  24812. {
  24813. if ($message) {
  24814. $this->io->writeError($message);
  24815. }
  24816. $note = 'Composer';
  24817. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  24818. $note .= ' on ' . trim($output);
  24819. }
  24820. $note .= ' ' . date('Y-m-d Hi');
  24821. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  24822. $this->io->writeError(sprintf('Head to %s', $url));
  24823. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  24824. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  24825. if (!$token) {
  24826. $this->io->writeError('<warning>No token given, aborting.</warning>');
  24827. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  24828. return false;
  24829. }
  24830. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  24831. try {
  24832. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  24833. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  24834. 'retry-auth-failure' => false,
  24835. ));
  24836. } catch (TransportException $e) {
  24837. if (in_array($e->getCode(), array(403, 401))) {
  24838. $this->io->writeError('<error>Invalid token provided.</error>');
  24839. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  24840. return false;
  24841. }
  24842. throw $e;
  24843. }
  24844. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  24845. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  24846. $this->io->writeError('<info>Token stored successfully.</info>');
  24847. return true;
  24848. }
  24849. }
  24850. <?php
  24851. namespace Composer\Util;
  24852. use Composer\IO\IOInterface;
  24853. use Composer\Config;
  24854. use Composer\Factory;
  24855. use Composer\Downloader\TransportException;
  24856. use Composer\Json\JsonFile;
  24857. class GitLab
  24858. {
  24859. protected $io;
  24860. protected $config;
  24861. protected $process;
  24862. protected $remoteFilesystem;
  24863. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24864. {
  24865. $this->io = $io;
  24866. $this->config = $config;
  24867. $this->process = $process ?: new ProcessExecutor();
  24868. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24869. }
  24870. public function authorizeOAuth($originUrl)
  24871. {
  24872. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  24873. return false;
  24874. }
  24875. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  24876. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  24877. return true;
  24878. }
  24879. $authTokens = $this->config->get('gitlab-token');
  24880. if (isset($authTokens[$originUrl])) {
  24881. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  24882. return true;
  24883. }
  24884. return false;
  24885. }
  24886. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  24887. {
  24888. if ($message) {
  24889. $this->io->writeError($message);
  24890. }
  24891. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  24892. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  24893. $attemptCounter = 0;
  24894. while ($attemptCounter++ < 5) {
  24895. try {
  24896. $response = $this->createToken($scheme, $originUrl);
  24897. } catch (TransportException $e) {
  24898. if (in_array($e->getCode(), array(403, 401))) {
  24899. if (401 === $e->getCode()) {
  24900. $this->io->writeError('Bad credentials.');
  24901. } else {
  24902. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  24903. }
  24904. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  24905. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  24906. continue;
  24907. }
  24908. throw $e;
  24909. }
  24910. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  24911. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  24912. return true;
  24913. }
  24914. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  24915. }
  24916. private function createToken($scheme, $originUrl)
  24917. {
  24918. $username = $this->io->ask('Username: ');
  24919. $password = $this->io->askAndHideAnswer('Password: ');
  24920. $headers = array('Content-Type: application/x-www-form-urlencoded');
  24921. $apiUrl = $originUrl;
  24922. $data = http_build_query(array(
  24923. 'username' => $username,
  24924. 'password' => $password,
  24925. 'grant_type' => 'password',
  24926. ), null, '&');
  24927. $options = array(
  24928. 'retry-auth-failure' => false,
  24929. 'http' => array(
  24930. 'method' => 'POST',
  24931. 'header' => $headers,
  24932. 'content' => $data,
  24933. ),
  24934. );
  24935. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  24936. $this->io->writeError('Token successfully created');
  24937. return JsonFile::parseJson($json);
  24938. }
  24939. }
  24940. <?php
  24941. namespace Composer\Util;
  24942. class IniHelper
  24943. {
  24944. const ENV_ORIGINAL = 'COMPOSER_ORIGINAL_INIS';
  24945. public static function getAll()
  24946. {
  24947. $env = getenv(self::ENV_ORIGINAL);
  24948. if (false !== $env) {
  24949. return explode(PATH_SEPARATOR, $env);
  24950. }
  24951. $paths = array(strval(php_ini_loaded_file()));
  24952. if ($scanned = php_ini_scanned_files()) {
  24953. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  24954. }
  24955. return $paths;
  24956. }
  24957. public static function getMessage()
  24958. {
  24959. $paths = self::getAll();
  24960. if (empty($paths[0])) {
  24961. array_shift($paths);
  24962. }
  24963. $ini = array_shift($paths);
  24964. if (empty($ini)) {
  24965. return 'A php.ini file does not exist. You will have to create one.';
  24966. }
  24967. if (!empty($paths)) {
  24968. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  24969. }
  24970. return 'The php.ini used by your command-line PHP is: '.$ini;
  24971. }
  24972. }
  24973. <?php
  24974. namespace Composer\Util;
  24975. class NoProxyPattern
  24976. {
  24977. protected $rules = array();
  24978. public function __construct($pattern)
  24979. {
  24980. $this->rules = preg_split("/[\s,]+/", $pattern);
  24981. }
  24982. public function test($url)
  24983. {
  24984. $host = parse_url($url, PHP_URL_HOST);
  24985. $port = parse_url($url, PHP_URL_PORT);
  24986. if (empty($port)) {
  24987. switch (parse_url($url, PHP_URL_SCHEME)) {
  24988. case 'http':
  24989. $port = 80;
  24990. break;
  24991. case 'https':
  24992. $port = 443;
  24993. break;
  24994. }
  24995. }
  24996. foreach ($this->rules as $rule) {
  24997. if ($rule == '*') {
  24998. return true;
  24999. }
  25000. $match = false;
  25001. list($ruleHost) = explode(':', $rule);
  25002. list($base) = explode('/', $ruleHost);
  25003. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  25004. if (!isset($ip)) {
  25005. $ip = gethostbyname($host);
  25006. }
  25007. if (strpos($ruleHost, '/') === false) {
  25008. $match = $ip === $ruleHost;
  25009. } else {
  25010. if ($ip === $host) {
  25011. $match = false;
  25012. } else {
  25013. $match = self::inCIDRBlock($ruleHost, $ip);
  25014. }
  25015. }
  25016. } else {
  25017. $haystack = '.' . trim($host, '.') . '.';
  25018. $needle = '.'. trim($ruleHost, '.') .'.';
  25019. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  25020. }
  25021. if ($match && strpos($rule, ':') !== false) {
  25022. list(, $rulePort) = explode(':', $rule);
  25023. if (!empty($rulePort) && $port != $rulePort) {
  25024. $match = false;
  25025. }
  25026. }
  25027. if ($match) {
  25028. return true;
  25029. }
  25030. }
  25031. return false;
  25032. }
  25033. private static function inCIDRBlock($cidr, $ip)
  25034. {
  25035. list($base, $bits) = explode('/', $cidr);
  25036. list($a, $b, $c, $d) = explode('.', $base);
  25037. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  25038. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  25039. $low = $i & $mask;
  25040. $high = $i | (~$mask & 0xFFFFFFFF);
  25041. list($a, $b, $c, $d) = explode('.', $ip);
  25042. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  25043. return $check >= $low && $check <= $high;
  25044. }
  25045. }
  25046. <?php
  25047. namespace Composer\Util;
  25048. use Composer\IO\IOInterface;
  25049. use Symfony\Component\Process\Process;
  25050. class Perforce
  25051. {
  25052. protected $path;
  25053. protected $p4Depot;
  25054. protected $p4Client;
  25055. protected $p4User;
  25056. protected $p4Password;
  25057. protected $p4Port;
  25058. protected $p4Stream;
  25059. protected $p4ClientSpec;
  25060. protected $p4DepotType;
  25061. protected $p4Branch;
  25062. protected $process;
  25063. protected $uniquePerforceClientName;
  25064. protected $windowsFlag;
  25065. protected $commandResult;
  25066. protected $io;
  25067. protected $filesystem;
  25068. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  25069. {
  25070. $this->windowsFlag = $isWindows;
  25071. $this->p4Port = $port;
  25072. $this->initializePath($path);
  25073. $this->process = $process;
  25074. $this->initialize($repoConfig);
  25075. $this->io = $io;
  25076. }
  25077. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  25078. {
  25079. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  25080. }
  25081. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  25082. {
  25083. $output = null;
  25084. return 0 === $processExecutor->execute('p4 -p ' . $url . ' info -s', $output);
  25085. }
  25086. public function initialize($repoConfig)
  25087. {
  25088. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  25089. if (!$repoConfig) {
  25090. return;
  25091. }
  25092. if (isset($repoConfig['unique_perforce_client_name'])) {
  25093. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  25094. }
  25095. if (isset($repoConfig['depot'])) {
  25096. $this->p4Depot = $repoConfig['depot'];
  25097. }
  25098. if (isset($repoConfig['branch'])) {
  25099. $this->p4Branch = $repoConfig['branch'];
  25100. }
  25101. if (isset($repoConfig['p4user'])) {
  25102. $this->p4User = $repoConfig['p4user'];
  25103. } else {
  25104. $this->p4User = $this->getP4variable('P4USER');
  25105. }
  25106. if (isset($repoConfig['p4password'])) {
  25107. $this->p4Password = $repoConfig['p4password'];
  25108. }
  25109. }
  25110. public function initializeDepotAndBranch($depot, $branch)
  25111. {
  25112. if (isset($depot)) {
  25113. $this->p4Depot = $depot;
  25114. }
  25115. if (isset($branch)) {
  25116. $this->p4Branch = $branch;
  25117. }
  25118. }
  25119. public function generateUniquePerforceClientName()
  25120. {
  25121. return gethostname() . "_" . time();
  25122. }
  25123. public function cleanupClientSpec()
  25124. {
  25125. $client = $this->getClient();
  25126. $task = 'client -d ' . $client;
  25127. $useP4Client = false;
  25128. $command = $this->generateP4Command($task, $useP4Client);
  25129. $this->executeCommand($command);
  25130. $clientSpec = $this->getP4ClientSpec();
  25131. $fileSystem = $this->getFilesystem();
  25132. $fileSystem->remove($clientSpec);
  25133. }
  25134. protected function executeCommand($command)
  25135. {
  25136. $this->commandResult = '';
  25137. return $this->process->execute($command, $this->commandResult);
  25138. }
  25139. public function getClient()
  25140. {
  25141. if (!isset($this->p4Client)) {
  25142. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  25143. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  25144. }
  25145. return $this->p4Client;
  25146. }
  25147. protected function getPath()
  25148. {
  25149. return $this->path;
  25150. }
  25151. public function initializePath($path)
  25152. {
  25153. $this->path = $path;
  25154. $fs = $this->getFilesystem();
  25155. $fs->ensureDirectoryExists($path);
  25156. }
  25157. protected function getPort()
  25158. {
  25159. return $this->p4Port;
  25160. }
  25161. public function setStream($stream)
  25162. {
  25163. $this->p4Stream = $stream;
  25164. $index = strrpos($stream, '/');
  25165. if ($index > 2) {
  25166. $this->p4DepotType = 'stream';
  25167. }
  25168. }
  25169. public function isStream()
  25170. {
  25171. return (strcmp($this->p4DepotType, 'stream') === 0);
  25172. }
  25173. public function getStream()
  25174. {
  25175. if (!isset($this->p4Stream)) {
  25176. if ($this->isStream()) {
  25177. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  25178. } else {
  25179. $this->p4Stream = '//' . $this->p4Depot;
  25180. }
  25181. }
  25182. return $this->p4Stream;
  25183. }
  25184. public function getStreamWithoutLabel($stream)
  25185. {
  25186. $index = strpos($stream, '@');
  25187. if ($index === false) {
  25188. return $stream;
  25189. }
  25190. return substr($stream, 0, $index);
  25191. }
  25192. public function getP4ClientSpec()
  25193. {
  25194. return $this->path . '/' . $this->getClient() . '.p4.spec';
  25195. }
  25196. public function getUser()
  25197. {
  25198. return $this->p4User;
  25199. }
  25200. public function setUser($user)
  25201. {
  25202. $this->p4User = $user;
  25203. }
  25204. public function queryP4User()
  25205. {
  25206. $this->getUser();
  25207. if (strlen($this->p4User) > 0) {
  25208. return;
  25209. }
  25210. $this->p4User = $this->getP4variable('P4USER');
  25211. if (strlen($this->p4User) > 0) {
  25212. return;
  25213. }
  25214. $this->p4User = $this->io->ask('Enter P4 User:');
  25215. if ($this->windowsFlag) {
  25216. $command = 'p4 set P4USER=' . $this->p4User;
  25217. } else {
  25218. $command = 'export P4USER=' . $this->p4User;
  25219. }
  25220. $this->executeCommand($command);
  25221. }
  25222. protected function getP4variable($name)
  25223. {
  25224. if ($this->windowsFlag) {
  25225. $command = 'p4 set';
  25226. $this->executeCommand($command);
  25227. $result = trim($this->commandResult);
  25228. $resArray = explode(PHP_EOL, $result);
  25229. foreach ($resArray as $line) {
  25230. $fields = explode('=', $line);
  25231. if (strcmp($name, $fields[0]) == 0) {
  25232. $index = strpos($fields[1], ' ');
  25233. if ($index === false) {
  25234. $value = $fields[1];
  25235. } else {
  25236. $value = substr($fields[1], 0, $index);
  25237. }
  25238. $value = trim($value);
  25239. return $value;
  25240. }
  25241. }
  25242. return null;
  25243. }
  25244. $command = 'echo $' . $name;
  25245. $this->executeCommand($command);
  25246. $result = trim($this->commandResult);
  25247. return $result;
  25248. }
  25249. public function queryP4Password()
  25250. {
  25251. if (isset($this->p4Password)) {
  25252. return $this->p4Password;
  25253. }
  25254. $password = $this->getP4variable('P4PASSWD');
  25255. if (strlen($password) <= 0) {
  25256. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  25257. }
  25258. $this->p4Password = $password;
  25259. return $password;
  25260. }
  25261. public function generateP4Command($command, $useClient = true)
  25262. {
  25263. $p4Command = 'p4 ';
  25264. $p4Command = $p4Command . '-u ' . $this->getUser() . ' ';
  25265. if ($useClient) {
  25266. $p4Command = $p4Command . '-c ' . $this->getClient() . ' ';
  25267. }
  25268. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  25269. return $p4Command;
  25270. }
  25271. public function isLoggedIn()
  25272. {
  25273. $command = $this->generateP4Command('login -s', false);
  25274. $exitCode = $this->executeCommand($command);
  25275. if ($exitCode) {
  25276. $errorOutput = $this->process->getErrorOutput();
  25277. $index = strpos($errorOutput, $this->getUser());
  25278. if ($index === false) {
  25279. $index = strpos($errorOutput, 'p4');
  25280. if ($index === false) {
  25281. return false;
  25282. }
  25283. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  25284. }
  25285. throw new \Exception('Invalid user name: ' . $this->getUser());
  25286. }
  25287. return true;
  25288. }
  25289. public function connectClient()
  25290. {
  25291. $p4CreateClientCommand = $this->generateP4Command(
  25292. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  25293. );
  25294. $this->executeCommand($p4CreateClientCommand);
  25295. }
  25296. public function syncCodeBase($sourceReference)
  25297. {
  25298. $prevDir = getcwd();
  25299. chdir($this->path);
  25300. $p4SyncCommand = $this->generateP4Command('sync -f ');
  25301. if (null !== $sourceReference) {
  25302. $p4SyncCommand = $p4SyncCommand . '@' . $sourceReference;
  25303. }
  25304. $this->executeCommand($p4SyncCommand);
  25305. chdir($prevDir);
  25306. }
  25307. public function writeClientSpecToFile($spec)
  25308. {
  25309. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  25310. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  25311. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  25312. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  25313. fwrite($spec, 'Description:' . PHP_EOL);
  25314. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  25315. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  25316. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  25317. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  25318. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  25319. if ($this->isStream()) {
  25320. fwrite($spec, 'Stream:' . PHP_EOL);
  25321. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  25322. } else {
  25323. fwrite(
  25324. $spec,
  25325. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  25326. );
  25327. }
  25328. }
  25329. public function writeP4ClientSpec()
  25330. {
  25331. $clientSpec = $this->getP4ClientSpec();
  25332. $spec = fopen($clientSpec, 'w');
  25333. try {
  25334. $this->writeClientSpecToFile($spec);
  25335. } catch (\Exception $e) {
  25336. fclose($spec);
  25337. throw $e;
  25338. }
  25339. fclose($spec);
  25340. }
  25341. protected function read($pipe, $name)
  25342. {
  25343. if (feof($pipe)) {
  25344. return;
  25345. }
  25346. $line = fgets($pipe);
  25347. while ($line !== false) {
  25348. $line = fgets($pipe);
  25349. }
  25350. return;
  25351. }
  25352. public function windowsLogin($password)
  25353. {
  25354. $command = $this->generateP4Command(' login -a');
  25355. $process = new Process($command, null, null, $password);
  25356. return $process->run();
  25357. }
  25358. public function p4Login()
  25359. {
  25360. $this->queryP4User();
  25361. if (!$this->isLoggedIn()) {
  25362. $password = $this->queryP4Password();
  25363. if ($this->windowsFlag) {
  25364. $this->windowsLogin($password);
  25365. } else {
  25366. $command = 'echo ' . $password . ' | ' . $this->generateP4Command(' login -a', false);
  25367. $exitCode = $this->executeCommand($command);
  25368. $result = trim($this->commandResult);
  25369. if ($exitCode) {
  25370. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  25371. }
  25372. }
  25373. }
  25374. }
  25375. public function getComposerInformation($identifier)
  25376. {
  25377. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  25378. if (!$composerFileContent) {
  25379. return;
  25380. }
  25381. return json_decode($composerFileContent, true);
  25382. }
  25383. public function getFileContent($file, $identifier)
  25384. {
  25385. $path = $this->getFilePath($file, $identifier);
  25386. $command = $this->generateP4Command(' print ' . $path);
  25387. $this->executeCommand($command);
  25388. $result = $this->commandResult;
  25389. if (!trim($result)) {
  25390. return null;
  25391. }
  25392. return $result;
  25393. }
  25394. public function getFilePath($file, $identifier)
  25395. {
  25396. $index = strpos($identifier, '@');
  25397. if ($index === false) {
  25398. $path = $identifier. '/' . $file;
  25399. return $path;
  25400. }
  25401. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  25402. $command = $this->generateP4Command(' files ' . $path, false);
  25403. $this->executeCommand($command);
  25404. $result = $this->commandResult;
  25405. $index2 = strpos($result, 'no such file(s).');
  25406. if ($index2 === false) {
  25407. $index3 = strpos($result, 'change');
  25408. if ($index3 !== false) {
  25409. $phrase = trim(substr($result, $index3));
  25410. $fields = explode(' ', $phrase);
  25411. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  25412. }
  25413. }
  25414. return null;
  25415. }
  25416. public function getBranches()
  25417. {
  25418. $possibleBranches = array();
  25419. if (!$this->isStream()) {
  25420. $possibleBranches[$this->p4Branch] = $this->getStream();
  25421. } else {
  25422. $command = $this->generateP4Command('streams //' . $this->p4Depot . '/...');
  25423. $this->executeCommand($command);
  25424. $result = $this->commandResult;
  25425. $resArray = explode(PHP_EOL, $result);
  25426. foreach ($resArray as $line) {
  25427. $resBits = explode(' ', $line);
  25428. if (count($resBits) > 4) {
  25429. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  25430. $possibleBranches[$branch] = $resBits[1];
  25431. }
  25432. }
  25433. }
  25434. $command = $this->generateP4Command('changes '. $this->getStream() . '/...', false);
  25435. $this->executeCommand($command);
  25436. $result = $this->commandResult;
  25437. $resArray = explode(PHP_EOL, $result);
  25438. $lastCommit = $resArray[0];
  25439. $lastCommitArr = explode(' ', $lastCommit);
  25440. $lastCommitNum = $lastCommitArr[1];
  25441. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  25442. return $branches;
  25443. }
  25444. public function getTags()
  25445. {
  25446. $command = $this->generateP4Command('labels');
  25447. $this->executeCommand($command);
  25448. $result = $this->commandResult;
  25449. $resArray = explode(PHP_EOL, $result);
  25450. $tags = array();
  25451. foreach ($resArray as $line) {
  25452. $index = strpos($line, 'Label');
  25453. if (!($index === false)) {
  25454. $fields = explode(' ', $line);
  25455. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  25456. }
  25457. }
  25458. return $tags;
  25459. }
  25460. public function checkStream()
  25461. {
  25462. $command = $this->generateP4Command('depots', false);
  25463. $this->executeCommand($command);
  25464. $result = $this->commandResult;
  25465. $resArray = explode(PHP_EOL, $result);
  25466. foreach ($resArray as $line) {
  25467. $index = strpos($line, 'Depot');
  25468. if (!($index === false)) {
  25469. $fields = explode(' ', $line);
  25470. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  25471. $this->p4DepotType = $fields[3];
  25472. return $this->isStream();
  25473. }
  25474. }
  25475. }
  25476. return false;
  25477. }
  25478. protected function getChangeList($reference)
  25479. {
  25480. $index = strpos($reference, '@');
  25481. if ($index === false) {
  25482. return null;
  25483. }
  25484. $label = substr($reference, $index);
  25485. $command = $this->generateP4Command(' changes -m1 ' . $label);
  25486. $this->executeCommand($command);
  25487. $changes = $this->commandResult;
  25488. if (strpos($changes, 'Change') !== 0) {
  25489. return null;
  25490. }
  25491. $fields = explode(' ', $changes);
  25492. return $fields[1];
  25493. }
  25494. public function getCommitLogs($fromReference, $toReference)
  25495. {
  25496. $fromChangeList = $this->getChangeList($fromReference);
  25497. if ($fromChangeList === null) {
  25498. return null;
  25499. }
  25500. $toChangeList = $this->getChangeList($toReference);
  25501. if ($toChangeList === null) {
  25502. return null;
  25503. }
  25504. $index = strpos($fromReference, '@');
  25505. $main = substr($fromReference, 0, $index) . '/...';
  25506. $command = $this->generateP4Command('filelog ' . $main . '@' . $fromChangeList. ',' . $toChangeList);
  25507. $this->executeCommand($command);
  25508. return $this->commandResult;
  25509. }
  25510. public function getFilesystem()
  25511. {
  25512. if (empty($this->filesystem)) {
  25513. $this->filesystem = new Filesystem($this->process);
  25514. }
  25515. return $this->filesystem;
  25516. }
  25517. public function setFilesystem(Filesystem $fs)
  25518. {
  25519. $this->filesystem = $fs;
  25520. }
  25521. }
  25522. <?php
  25523. namespace Composer\Util;
  25524. class Platform
  25525. {
  25526. public static function expandPath($path)
  25527. {
  25528. if (preg_match('#^~[\\/]#', $path)) {
  25529. return self::getUserDirectory() . substr($path, 1);
  25530. }
  25531. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  25532. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  25533. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  25534. }
  25535. return getenv($matches['var']) . $matches['path'];
  25536. }, $path);
  25537. }
  25538. public static function getUserDirectory()
  25539. {
  25540. if (false !== ($home = getenv('HOME'))) {
  25541. return $home;
  25542. }
  25543. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  25544. return $home;
  25545. }
  25546. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  25547. $info = posix_getpwuid(posix_getuid());
  25548. return $info['dir'];
  25549. }
  25550. throw new \RuntimeException('Could not determine user directory');
  25551. }
  25552. public static function isWindows()
  25553. {
  25554. return defined('PHP_WINDOWS_VERSION_BUILD');
  25555. }
  25556. public static function strlen($str)
  25557. {
  25558. static $useMbString = null;
  25559. if (null === $useMbString) {
  25560. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  25561. }
  25562. if ($useMbString) {
  25563. return mb_strlen($str, '8bit');
  25564. }
  25565. return strlen($str);
  25566. }
  25567. }
  25568. <?php
  25569. namespace Composer\Util;
  25570. use Composer\IO\IOInterface;
  25571. use Symfony\Component\Process\Process;
  25572. use Symfony\Component\Process\ProcessUtils;
  25573. class ProcessExecutor
  25574. {
  25575. protected static $timeout = 300;
  25576. protected $captureOutput;
  25577. protected $errorOutput;
  25578. protected $io;
  25579. public function __construct(IOInterface $io = null)
  25580. {
  25581. $this->io = $io;
  25582. }
  25583. public function execute($command, &$output = null, $cwd = null)
  25584. {
  25585. if ($this->io && $this->io->isDebug()) {
  25586. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  25587. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  25588. return '://***:***@';
  25589. }
  25590. return '://'.$m['user'].':***@';
  25591. }, $command);
  25592. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  25593. }
  25594. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  25595. $cwd = realpath(getcwd());
  25596. }
  25597. $this->captureOutput = count(func_get_args()) > 1;
  25598. $this->errorOutput = null;
  25599. $process = new Process($command, $cwd, null, null, static::getTimeout());
  25600. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  25601. $process->run($callback);
  25602. if ($this->captureOutput && !is_callable($output)) {
  25603. $output = $process->getOutput();
  25604. }
  25605. $this->errorOutput = $process->getErrorOutput();
  25606. return $process->getExitCode();
  25607. }
  25608. public function splitLines($output)
  25609. {
  25610. $output = trim($output);
  25611. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  25612. }
  25613. public function getErrorOutput()
  25614. {
  25615. return $this->errorOutput;
  25616. }
  25617. public function outputHandler($type, $buffer)
  25618. {
  25619. if ($this->captureOutput) {
  25620. return;
  25621. }
  25622. if (null === $this->io) {
  25623. echo $buffer;
  25624. return;
  25625. }
  25626. if (Process::ERR === $type) {
  25627. $this->io->writeError($buffer, false);
  25628. } else {
  25629. $this->io->write($buffer, false);
  25630. }
  25631. }
  25632. public static function getTimeout()
  25633. {
  25634. return static::$timeout;
  25635. }
  25636. public static function setTimeout($timeout)
  25637. {
  25638. static::$timeout = $timeout;
  25639. }
  25640. public static function escape($argument)
  25641. {
  25642. if (method_exists('Symfony\Component\Process\ProcessUtils', 'escapeArgument')) {
  25643. return ProcessUtils::escapeArgument($argument);
  25644. }
  25645. return self::escapeArgument($argument);
  25646. }
  25647. private static function escapeArgument($argument)
  25648. {
  25649. if ('\\' === DIRECTORY_SEPARATOR) {
  25650. if ('' === $argument) {
  25651. return escapeshellarg($argument);
  25652. }
  25653. $escapedArgument = '';
  25654. $quote = false;
  25655. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  25656. if ('"' === $part) {
  25657. $escapedArgument .= '\\"';
  25658. } elseif (self::isSurroundedBy($part, '%')) {
  25659. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  25660. } else {
  25661. if ('\\' === substr($part, -1)) {
  25662. $part .= '\\';
  25663. }
  25664. $quote = true;
  25665. $escapedArgument .= $part;
  25666. }
  25667. }
  25668. if ($quote) {
  25669. $escapedArgument = '"'.$escapedArgument.'"';
  25670. }
  25671. return $escapedArgument;
  25672. }
  25673. return "'".str_replace("'", "'\\''", $argument)."'";
  25674. }
  25675. private static function isSurroundedBy($arg, $char)
  25676. {
  25677. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  25678. }
  25679. }
  25680. <?php
  25681. namespace Composer\Util;
  25682. use Composer\Config;
  25683. use Composer\IO\IOInterface;
  25684. use Composer\Downloader\TransportException;
  25685. use Composer\CaBundle\CaBundle;
  25686. use Psr\Log\LoggerInterface;
  25687. class RemoteFilesystem
  25688. {
  25689. private $io;
  25690. private $config;
  25691. private $scheme;
  25692. private $bytesMax;
  25693. private $originUrl;
  25694. private $fileUrl;
  25695. private $fileName;
  25696. private $retry;
  25697. private $progress;
  25698. private $lastProgress;
  25699. private $options = array();
  25700. private $peerCertificateMap = array();
  25701. private $disableTls = false;
  25702. private $retryAuthFailure;
  25703. private $lastHeaders;
  25704. private $storeAuth;
  25705. private $degradedMode = false;
  25706. private $redirects;
  25707. private $maxRedirects = 20;
  25708. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  25709. {
  25710. $this->io = $io;
  25711. if ($disableTls === false) {
  25712. $this->options = $this->getTlsDefaults($options);
  25713. } else {
  25714. $this->disableTls = true;
  25715. }
  25716. $this->options = array_replace_recursive($this->options, $options);
  25717. $this->config = $config;
  25718. }
  25719. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  25720. {
  25721. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  25722. }
  25723. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  25724. {
  25725. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  25726. }
  25727. public function getOptions()
  25728. {
  25729. return $this->options;
  25730. }
  25731. public function setOptions(array $options)
  25732. {
  25733. $this->options = array_replace_recursive($this->options, $options);
  25734. }
  25735. public function isTlsDisabled()
  25736. {
  25737. return $this->disableTls === true;
  25738. }
  25739. public function getLastHeaders()
  25740. {
  25741. return $this->lastHeaders;
  25742. }
  25743. public function findHeaderValue(array $headers, $name)
  25744. {
  25745. $value = null;
  25746. foreach ($headers as $header) {
  25747. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  25748. $value = $match[1];
  25749. } elseif (preg_match('{^HTTP/}i', $header)) {
  25750. $value = null;
  25751. }
  25752. }
  25753. return $value;
  25754. }
  25755. public function findStatusCode(array $headers)
  25756. {
  25757. $value = null;
  25758. foreach ($headers as $header) {
  25759. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  25760. $value = (int) $match[1];
  25761. }
  25762. }
  25763. return $value;
  25764. }
  25765. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  25766. {
  25767. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  25768. $originUrl = 'github.com';
  25769. }
  25770. if (
  25771. $this->config
  25772. && is_array($this->config->get('gitlab-domains'))
  25773. && false === strpos($originUrl, '/')
  25774. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  25775. ) {
  25776. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  25777. if (0 === strpos($gitlabDomain, $originUrl)) {
  25778. $originUrl = $gitlabDomain;
  25779. break;
  25780. }
  25781. }
  25782. unset($gitlabDomain);
  25783. }
  25784. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  25785. $this->bytesMax = 0;
  25786. $this->originUrl = $originUrl;
  25787. $this->fileUrl = $fileUrl;
  25788. $this->fileName = $fileName;
  25789. $this->progress = $progress;
  25790. $this->lastProgress = null;
  25791. $this->retryAuthFailure = true;
  25792. $this->lastHeaders = array();
  25793. $this->redirects = 1;
  25794. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  25795. $this->io->setAuthentication($originUrl, urldecode($match[1]), urldecode($match[2]));
  25796. }
  25797. $tempAdditionalOptions = $additionalOptions;
  25798. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  25799. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  25800. unset($tempAdditionalOptions['retry-auth-failure']);
  25801. }
  25802. $isRedirect = false;
  25803. if (isset($tempAdditionalOptions['redirects'])) {
  25804. $this->redirects = $tempAdditionalOptions['redirects'];
  25805. $isRedirect = true;
  25806. unset($tempAdditionalOptions['redirects']);
  25807. }
  25808. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  25809. unset($tempAdditionalOptions);
  25810. $origFileUrl = $fileUrl;
  25811. if (isset($options['github-token'])) {
  25812. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  25813. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  25814. }
  25815. unset($options['github-token']);
  25816. }
  25817. if (isset($options['gitlab-token'])) {
  25818. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  25819. unset($options['gitlab-token']);
  25820. }
  25821. if (isset($options['http'])) {
  25822. $options['http']['ignore_errors'] = true;
  25823. }
  25824. if ($this->degradedMode && substr($fileUrl, 0, 21) === 'http://packagist.org/') {
  25825. $fileUrl = 'http://' . gethostbyname('packagist.org') . substr($fileUrl, 20);
  25826. $degradedPackagist = true;
  25827. }
  25828. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  25829. $actualContextOptions = stream_context_get_options($ctx);
  25830. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  25831. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $origFileUrl . $usingProxy, true, IOInterface::DEBUG);
  25832. unset($origFileUrl, $actualContextOptions);
  25833. if ((substr($fileUrl, 0, 23) !== 'http://packagist.org/p/' || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  25834. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  25835. }
  25836. if ($this->progress && !$isRedirect) {
  25837. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  25838. }
  25839. $errorMessage = '';
  25840. $errorCode = 0;
  25841. $result = false;
  25842. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  25843. if ($errorMessage) {
  25844. $errorMessage .= "\n";
  25845. }
  25846. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  25847. });
  25848. try {
  25849. $result = file_get_contents($fileUrl, false, $ctx);
  25850. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  25851. if ($contentLength && Platform::strlen($result) < $contentLength) {
  25852. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  25853. $e->setHeaders($http_response_header);
  25854. $e->setStatusCode($this->findStatusCode($http_response_header));
  25855. $e->setResponse($result);
  25856. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  25857. throw $e;
  25858. }
  25859. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  25860. $params = stream_context_get_params($ctx);
  25861. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  25862. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  25863. if ($expectedPeerFingerprint !== $peerFingerprint) {
  25864. throw new TransportException('Peer fingerprint did not match');
  25865. }
  25866. }
  25867. } catch (\Exception $e) {
  25868. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  25869. $e->setHeaders($http_response_header);
  25870. $e->setStatusCode($this->findStatusCode($http_response_header));
  25871. }
  25872. if ($e instanceof TransportException && $result !== false) {
  25873. $e->setResponse($result);
  25874. }
  25875. $result = false;
  25876. }
  25877. if ($errorMessage && !ini_get('allow_url_fopen')) {
  25878. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  25879. }
  25880. restore_error_handler();
  25881. if (isset($e) && !$this->retry) {
  25882. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  25883. $this->degradedMode = true;
  25884. $this->io->writeError('');
  25885. $this->io->writeError(array(
  25886. '<error>'.$e->getMessage().'</error>',
  25887. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  25888. ));
  25889. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  25890. }
  25891. throw $e;
  25892. }
  25893. $statusCode = null;
  25894. $contentType = null;
  25895. if (!empty($http_response_header[0])) {
  25896. $statusCode = $this->findStatusCode($http_response_header);
  25897. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  25898. }
  25899. if ($originUrl === 'bitbucket.org'
  25900. && !$this->isPublicBitBucketDownload($fileUrl)
  25901. && substr($fileUrl, -4) === '.zip'
  25902. && $contentType && preg_match('{^text/html\b}i', $contentType)
  25903. ) {
  25904. $result = false;
  25905. if ($this->retryAuthFailure) {
  25906. $this->promptAuthAndRetry(401);
  25907. }
  25908. }
  25909. if ($statusCode === 404
  25910. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  25911. && false !== strpos($fileUrl, 'archive.zip')
  25912. ) {
  25913. $result = false;
  25914. if ($this->retryAuthFailure) {
  25915. $this->promptAuthAndRetry(401);
  25916. }
  25917. }
  25918. $hasFollowedRedirect = false;
  25919. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  25920. $hasFollowedRedirect = true;
  25921. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  25922. }
  25923. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  25924. if (!$this->retry) {
  25925. if ($this->progress && !$this->retry && !$isRedirect) {
  25926. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  25927. }
  25928. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  25929. $e->setHeaders($http_response_header);
  25930. $e->setResponse($result);
  25931. $e->setStatusCode($statusCode);
  25932. throw $e;
  25933. }
  25934. $result = false;
  25935. }
  25936. if ($this->progress && !$this->retry && !$isRedirect) {
  25937. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  25938. }
  25939. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  25940. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  25941. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  25942. if ($decode) {
  25943. try {
  25944. if (PHP_VERSION_ID >= 50400) {
  25945. $result = zlib_decode($result);
  25946. } else {
  25947. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  25948. }
  25949. if (!$result) {
  25950. throw new TransportException('Failed to decode zlib stream');
  25951. }
  25952. } catch (\Exception $e) {
  25953. if ($this->degradedMode) {
  25954. throw $e;
  25955. }
  25956. $this->degradedMode = true;
  25957. $this->io->writeError(array(
  25958. '',
  25959. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  25960. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  25961. ));
  25962. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  25963. }
  25964. }
  25965. }
  25966. if (false !== $result && null !== $fileName && !$isRedirect) {
  25967. if ('' === $result) {
  25968. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  25969. }
  25970. $errorMessage = '';
  25971. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  25972. if ($errorMessage) {
  25973. $errorMessage .= "\n";
  25974. }
  25975. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  25976. });
  25977. $result = (bool) file_put_contents($fileName, $result);
  25978. restore_error_handler();
  25979. if (false === $result) {
  25980. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  25981. }
  25982. }
  25983. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  25984. if (CaBundle::isOpensslParseSafe()) {
  25985. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  25986. if ($certDetails) {
  25987. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  25988. $this->retry = true;
  25989. }
  25990. } else {
  25991. $this->io->writeError('');
  25992. $this->io->writeError(sprintf(
  25993. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  25994. PHP_VERSION
  25995. ));
  25996. }
  25997. }
  25998. if ($this->retry) {
  25999. $this->retry = false;
  26000. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26001. if ($this->storeAuth && $this->config) {
  26002. $authHelper = new AuthHelper($this->io, $this->config);
  26003. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  26004. $this->storeAuth = false;
  26005. }
  26006. return $result;
  26007. }
  26008. if (false === $result) {
  26009. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  26010. if (!empty($http_response_header[0])) {
  26011. $e->setHeaders($http_response_header);
  26012. }
  26013. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  26014. $this->degradedMode = true;
  26015. $this->io->writeError('');
  26016. $this->io->writeError(array(
  26017. '<error>'.$e->getMessage().'</error>',
  26018. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  26019. ));
  26020. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  26021. }
  26022. throw $e;
  26023. }
  26024. if (!empty($http_response_header[0])) {
  26025. $this->lastHeaders = $http_response_header;
  26026. }
  26027. return $result;
  26028. }
  26029. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  26030. {
  26031. switch ($notificationCode) {
  26032. case STREAM_NOTIFY_FAILURE:
  26033. if (400 === $messageCode) {
  26034. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  26035. }
  26036. case STREAM_NOTIFY_AUTH_REQUIRED:
  26037. if (401 === $messageCode) {
  26038. if (!$this->retryAuthFailure) {
  26039. break;
  26040. }
  26041. $this->promptAuthAndRetry($messageCode);
  26042. }
  26043. break;
  26044. case STREAM_NOTIFY_AUTH_RESULT:
  26045. if (403 === $messageCode) {
  26046. if (!$this->retryAuthFailure) {
  26047. break;
  26048. }
  26049. $this->promptAuthAndRetry($messageCode, $message);
  26050. }
  26051. break;
  26052. case STREAM_NOTIFY_FILE_SIZE_IS:
  26053. $this->bytesMax = $bytesMax;
  26054. break;
  26055. case STREAM_NOTIFY_PROGRESS:
  26056. if ($this->bytesMax > 0 && $this->progress) {
  26057. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  26058. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  26059. $this->lastProgress = $progression;
  26060. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  26061. }
  26062. }
  26063. break;
  26064. default:
  26065. break;
  26066. }
  26067. }
  26068. protected function promptAuthAndRetry($httpStatus, $reason = null)
  26069. {
  26070. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  26071. $message = "\n".'Could not fetch '.$this->fileUrl.', please create a GitHub OAuth token '.($httpStatus === 404 ? 'to access private repos' : 'to go over the API rate limit');
  26072. $gitHubUtil = new GitHub($this->io, $this->config, null);
  26073. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  26074. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  26075. ) {
  26076. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  26077. }
  26078. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  26079. $message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  26080. $gitLabUtil = new GitLab($this->io, $this->config, null);
  26081. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && $auth['password'] === 'private-token') {
  26082. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  26083. }
  26084. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  26085. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  26086. ) {
  26087. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  26088. }
  26089. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  26090. $askForOAuthToken = true;
  26091. if ($this->io->hasAuthentication($this->originUrl)) {
  26092. $auth = $this->io->getAuthentication($this->originUrl);
  26093. if ($auth['username'] !== 'x-token-auth') {
  26094. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  26095. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  26096. if (!empty($accessToken)) {
  26097. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  26098. $askForOAuthToken = false;
  26099. }
  26100. } else {
  26101. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  26102. }
  26103. }
  26104. if ($askForOAuthToken) {
  26105. $message = "\n".'Could not fetch ' . $this->fileUrl . ', please create a bitbucket OAuth token to ' . (($httpStatus === 401 || $httpStatus === 403) ? 'access private repos' : 'go over the API rate limit');
  26106. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  26107. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  26108. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  26109. ) {
  26110. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  26111. }
  26112. }
  26113. } else {
  26114. if ($httpStatus === 404) {
  26115. return;
  26116. }
  26117. if (!$this->io->isInteractive()) {
  26118. if ($httpStatus === 401) {
  26119. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  26120. }
  26121. if ($httpStatus === 403) {
  26122. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  26123. }
  26124. throw new TransportException($message, $httpStatus);
  26125. }
  26126. if ($this->io->hasAuthentication($this->originUrl)) {
  26127. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  26128. }
  26129. $this->io->overwriteError('');
  26130. $this->io->writeError(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
  26131. $username = $this->io->ask(' Username: ');
  26132. $password = $this->io->askAndHideAnswer(' Password: ');
  26133. $this->io->setAuthentication($this->originUrl, $username, $password);
  26134. $this->storeAuth = $this->config->get('store-auths');
  26135. }
  26136. $this->retry = true;
  26137. throw new TransportException('RETRY');
  26138. }
  26139. protected function getOptionsForUrl($originUrl, $additionalOptions)
  26140. {
  26141. $tlsOptions = array();
  26142. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  26143. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  26144. if (PHP_VERSION_ID < 50304) {
  26145. if ($host === 'github.com' || $host === 'api.github.com') {
  26146. $host = '*.github.com';
  26147. }
  26148. }
  26149. $tlsOptions['ssl']['CN_match'] = $host;
  26150. $tlsOptions['ssl']['SNI_server_name'] = $host;
  26151. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  26152. if (isset($this->peerCertificateMap[$urlAuthority])) {
  26153. $certMap = $this->peerCertificateMap[$urlAuthority];
  26154. $this->io->writeError('', true, IOInterface::DEBUG);
  26155. $this->io->writeError(sprintf(
  26156. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  26157. $certMap['cn'],
  26158. $urlAuthority
  26159. ), true, IOInterface::DEBUG);
  26160. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  26161. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  26162. }
  26163. }
  26164. $headers = array();
  26165. if (extension_loaded('zlib')) {
  26166. $headers[] = 'Accept-Encoding: gzip';
  26167. }
  26168. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  26169. if (!$this->degradedMode) {
  26170. $options['http']['protocol_version'] = 1.1;
  26171. $headers[] = 'Connection: close';
  26172. }
  26173. if ($this->io->hasAuthentication($originUrl)) {
  26174. $auth = $this->io->getAuthentication($originUrl);
  26175. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  26176. $options['github-token'] = $auth['username'];
  26177. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  26178. if ($auth['password'] === 'oauth2') {
  26179. $headers[] = 'Authorization: Bearer '.$auth['username'];
  26180. } elseif ($auth['password'] === 'private-token') {
  26181. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  26182. }
  26183. } elseif ('bitbucket.org' === $originUrl
  26184. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  26185. ) {
  26186. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  26187. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  26188. }
  26189. } else {
  26190. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  26191. $headers[] = 'Authorization: Basic '.$authStr;
  26192. }
  26193. }
  26194. $options['http']['follow_location'] = 0;
  26195. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  26196. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  26197. }
  26198. foreach ($headers as $header) {
  26199. $options['http']['header'][] = $header;
  26200. }
  26201. return $options;
  26202. }
  26203. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  26204. {
  26205. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  26206. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  26207. $targetUrl = $locationHeader;
  26208. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  26209. $targetUrl = $this->scheme.':'.$locationHeader;
  26210. } elseif ('/' === $locationHeader[0]) {
  26211. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  26212. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  26213. } else {
  26214. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  26215. }
  26216. }
  26217. if (!empty($targetUrl)) {
  26218. $this->redirects++;
  26219. $this->io->writeError('', true, IOInterface::DEBUG);
  26220. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $targetUrl), true, IOInterface::DEBUG);
  26221. $additionalOptions['redirects'] = $this->redirects;
  26222. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  26223. }
  26224. if (!$this->retry) {
  26225. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  26226. $e->setHeaders($http_response_header);
  26227. $e->setResponse($result);
  26228. throw $e;
  26229. }
  26230. return false;
  26231. }
  26232. private function getTlsDefaults(array $options)
  26233. {
  26234. $ciphers = implode(':', array(
  26235. 'ECDHE-RSA-AES128-GCM-SHA256',
  26236. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  26237. 'ECDHE-RSA-AES256-GCM-SHA384',
  26238. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  26239. 'DHE-RSA-AES128-GCM-SHA256',
  26240. 'DHE-DSS-AES128-GCM-SHA256',
  26241. 'kEDH+AESGCM',
  26242. 'ECDHE-RSA-AES128-SHA256',
  26243. 'ECDHE-ECDSA-AES128-SHA256',
  26244. 'ECDHE-RSA-AES128-SHA',
  26245. 'ECDHE-ECDSA-AES128-SHA',
  26246. 'ECDHE-RSA-AES256-SHA384',
  26247. 'ECDHE-ECDSA-AES256-SHA384',
  26248. 'ECDHE-RSA-AES256-SHA',
  26249. 'ECDHE-ECDSA-AES256-SHA',
  26250. 'DHE-RSA-AES128-SHA256',
  26251. 'DHE-RSA-AES128-SHA',
  26252. 'DHE-DSS-AES128-SHA256',
  26253. 'DHE-RSA-AES256-SHA256',
  26254. 'DHE-DSS-AES256-SHA',
  26255. 'DHE-RSA-AES256-SHA',
  26256. 'AES128-GCM-SHA256',
  26257. 'AES256-GCM-SHA384',
  26258. 'AES128-SHA256',
  26259. 'AES256-SHA256',
  26260. 'AES128-SHA',
  26261. 'AES256-SHA',
  26262. 'AES',
  26263. 'CAMELLIA',
  26264. 'DES-CBC3-SHA',
  26265. '!aNULL',
  26266. '!eNULL',
  26267. '!EXPORT',
  26268. '!DES',
  26269. '!RC4',
  26270. '!MD5',
  26271. '!PSK',
  26272. '!aECDH',
  26273. '!EDH-DSS-DES-CBC3-SHA',
  26274. '!EDH-RSA-DES-CBC3-SHA',
  26275. '!KRB5-DES-CBC3-SHA',
  26276. ));
  26277. $defaults = array(
  26278. 'ssl' => array(
  26279. 'ciphers' => $ciphers,
  26280. 'verify_peer' => true,
  26281. 'verify_depth' => 7,
  26282. 'SNI_enabled' => true,
  26283. 'capture_peer_cert' => true,
  26284. ),
  26285. );
  26286. if (isset($options['ssl'])) {
  26287. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  26288. }
  26289. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  26290. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  26291. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  26292. if (is_dir($result)) {
  26293. $defaults['ssl']['capath'] = $result;
  26294. } else {
  26295. $defaults['ssl']['cafile'] = $result;
  26296. }
  26297. }
  26298. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  26299. throw new TransportException('The configured cafile was not valid or could not be read.');
  26300. }
  26301. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  26302. throw new TransportException('The configured capath was not valid or could not be read.');
  26303. }
  26304. if (PHP_VERSION_ID >= 50413) {
  26305. $defaults['ssl']['disable_compression'] = true;
  26306. }
  26307. return $defaults;
  26308. }
  26309. private function getCertificateCnAndFp($url, $options)
  26310. {
  26311. if (PHP_VERSION_ID >= 50600) {
  26312. throw new \BadMethodCallException(sprintf(
  26313. '%s must not be used on PHP >= 5.6',
  26314. __METHOD__
  26315. ));
  26316. }
  26317. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  26318. 'ssl' => array(
  26319. 'capture_peer_cert' => true,
  26320. 'verify_peer' => false,
  26321. ), ),
  26322. ));
  26323. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  26324. return;
  26325. }
  26326. fclose($handle);
  26327. $handle = null;
  26328. $params = stream_context_get_params($context);
  26329. if (!empty($params['options']['ssl']['peer_certificate'])) {
  26330. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  26331. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  26332. return array(
  26333. 'cn' => $commonName,
  26334. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  26335. );
  26336. }
  26337. }
  26338. }
  26339. private function getUrlAuthority($url)
  26340. {
  26341. $defaultPorts = array(
  26342. 'ftp' => 21,
  26343. 'http' => 80,
  26344. 'https' => 443,
  26345. 'ssh2.sftp' => 22,
  26346. 'ssh2.scp' => 22,
  26347. );
  26348. $scheme = parse_url($url, PHP_URL_SCHEME);
  26349. if (!isset($defaultPorts[$scheme])) {
  26350. throw new \InvalidArgumentException(sprintf(
  26351. 'Could not get default port for unknown scheme: %s',
  26352. $scheme
  26353. ));
  26354. }
  26355. $defaultPort = $defaultPorts[$scheme];
  26356. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  26357. return parse_url($url, PHP_URL_HOST).':'.$port;
  26358. }
  26359. private function isPublicBitBucketDownload($urlToBitBucketFile)
  26360. {
  26361. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  26362. if (strpos($domain, 'bitbucket.org') === false) {
  26363. return true;
  26364. }
  26365. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  26366. $pathParts = explode('/', $path);
  26367. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  26368. }
  26369. }
  26370. <?php
  26371. namespace Composer\Util;
  26372. class Silencer
  26373. {
  26374. private static $stack = array();
  26375. public static function suppress($mask = null)
  26376. {
  26377. if (!isset($mask)) {
  26378. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  26379. }
  26380. $old = error_reporting();
  26381. self::$stack[] = $old;
  26382. error_reporting($old & ~$mask);
  26383. return $old;
  26384. }
  26385. public static function restore()
  26386. {
  26387. if (!empty(self::$stack)) {
  26388. error_reporting(array_pop(self::$stack));
  26389. }
  26390. }
  26391. public static function call($callable )
  26392. {
  26393. try {
  26394. self::suppress();
  26395. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  26396. self::restore();
  26397. return $result;
  26398. } catch (\Exception $e) {
  26399. self::restore();
  26400. throw $e;
  26401. }
  26402. }
  26403. }
  26404. <?php
  26405. namespace Composer\Util;
  26406. use Composer\Spdx\SpdxLicenses;
  26407. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  26408. class SpdxLicense extends SpdxLicenses
  26409. {
  26410. }
  26411. <?php
  26412. namespace Composer\Util;
  26413. use Composer\Composer;
  26414. final class StreamContextFactory
  26415. {
  26416. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  26417. {
  26418. $options = array('http' => array(
  26419. 'follow_location' => 1,
  26420. 'max_redirects' => 20,
  26421. ));
  26422. if (PHP_SAPI === 'cli' && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  26423. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  26424. }
  26425. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  26426. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  26427. }
  26428. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  26429. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  26430. }
  26431. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  26432. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  26433. if ($pattern->test($url)) {
  26434. unset($proxy);
  26435. }
  26436. }
  26437. if (!empty($proxy)) {
  26438. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  26439. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  26440. if (isset($proxy['port'])) {
  26441. $proxyURL .= ":" . $proxy['port'];
  26442. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  26443. $proxyURL .= ":80";
  26444. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  26445. $proxyURL .= ":443";
  26446. }
  26447. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  26448. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  26449. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  26450. }
  26451. $options['http']['proxy'] = $proxyURL;
  26452. switch (parse_url($url, PHP_URL_SCHEME)) {
  26453. case 'http':
  26454. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  26455. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  26456. $options['http']['request_fulluri'] = true;
  26457. }
  26458. break;
  26459. case 'https':
  26460. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  26461. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  26462. $options['http']['request_fulluri'] = true;
  26463. }
  26464. break;
  26465. }
  26466. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  26467. $options['ssl']['SNI_enabled'] = true;
  26468. if (PHP_VERSION_ID < 50600) {
  26469. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  26470. }
  26471. }
  26472. if (isset($proxy['user'])) {
  26473. $auth = urldecode($proxy['user']);
  26474. if (isset($proxy['pass'])) {
  26475. $auth .= ':' . urldecode($proxy['pass']);
  26476. }
  26477. $auth = base64_encode($auth);
  26478. if (isset($defaultOptions['http']['header'])) {
  26479. if (is_string($defaultOptions['http']['header'])) {
  26480. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  26481. }
  26482. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  26483. } else {
  26484. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  26485. }
  26486. }
  26487. }
  26488. $options = array_replace_recursive($options, $defaultOptions);
  26489. if (isset($options['http']['header'])) {
  26490. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  26491. }
  26492. if (defined('HHVM_VERSION')) {
  26493. $phpVersion = 'HHVM ' . HHVM_VERSION;
  26494. } else {
  26495. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  26496. }
  26497. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  26498. $options['http']['header'][] = sprintf(
  26499. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  26500. Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION,
  26501. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  26502. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  26503. $phpVersion,
  26504. getenv('CI') ? '; CI' : ''
  26505. );
  26506. }
  26507. return stream_context_create($options, $defaultParams);
  26508. }
  26509. private static function fixHttpHeaderField($header)
  26510. {
  26511. if (!is_array($header)) {
  26512. $header = explode("\r\n", $header);
  26513. }
  26514. uasort($header, function ($el) {
  26515. return preg_match('{^content-type}i', $el) ? 1 : -1;
  26516. });
  26517. return $header;
  26518. }
  26519. }
  26520. <?php
  26521. namespace Composer\Util;
  26522. use Composer\Config;
  26523. use Composer\IO\IOInterface;
  26524. class Svn
  26525. {
  26526. const MAX_QTY_AUTH_TRIES = 5;
  26527. protected $credentials;
  26528. protected $hasAuth;
  26529. protected $io;
  26530. protected $url;
  26531. protected $cacheCredentials = true;
  26532. protected $process;
  26533. protected $qtyAuthTries = 0;
  26534. protected $config;
  26535. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  26536. {
  26537. $this->url = $url;
  26538. $this->io = $io;
  26539. $this->config = $config;
  26540. $this->process = $process ?: new ProcessExecutor;
  26541. }
  26542. public static function cleanEnv()
  26543. {
  26544. putenv("DYLD_LIBRARY_PATH");
  26545. unset($_SERVER['DYLD_LIBRARY_PATH']);
  26546. }
  26547. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  26548. {
  26549. $this->config->prohibitUrlByConfig($url, $this->io);
  26550. $svnCommand = $this->getCommand($command, $url, $path);
  26551. return $this->executeWithAuthRetry($svnCommand, $cwd, $path, $verbose);
  26552. }
  26553. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  26554. {
  26555. $svnCommand = sprintf('%s %s%s %s',
  26556. $command,
  26557. '--non-interactive ',
  26558. $this->getCredentialString(),
  26559. ProcessExecutor::escape($path)
  26560. );
  26561. return $this->executeWithAuthRetry($svnCommand, $cwd, $path, $verbose);
  26562. }
  26563. private function executeWithAuthRetry($command, $cwd, $path, $verbose)
  26564. {
  26565. $output = null;
  26566. $io = $this->io;
  26567. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  26568. if ($type !== 'out') {
  26569. return;
  26570. }
  26571. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  26572. return;
  26573. }
  26574. $output .= $buffer;
  26575. if ($verbose) {
  26576. $io->writeError($buffer, false);
  26577. }
  26578. };
  26579. $status = $this->process->execute($command, $handler, $cwd);
  26580. if (0 === $status) {
  26581. return $output;
  26582. }
  26583. $errorOutput = $this->process->getErrorOutput();
  26584. $fullOutput = implode("\n", array($output, $errorOutput));
  26585. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  26586. && false === stripos($fullOutput, 'authorization failed')
  26587. && false === stripos($fullOutput, 'svn: E170001:')
  26588. && false === stripos($fullOutput, 'svn: E215004:')) {
  26589. throw new \RuntimeException($fullOutput);
  26590. }
  26591. if (!$this->hasAuth()) {
  26592. $this->doAuthDance();
  26593. }
  26594. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  26595. return $this->executeWithAuthRetry($command, $cwd, $path, $verbose);
  26596. }
  26597. throw new \RuntimeException(
  26598. 'wrong credentials provided ('.$fullOutput.')'
  26599. );
  26600. }
  26601. public function setCacheCredentials($cacheCredentials)
  26602. {
  26603. $this->cacheCredentials = $cacheCredentials;
  26604. }
  26605. protected function doAuthDance()
  26606. {
  26607. if (!$this->io->isInteractive()) {
  26608. throw new \RuntimeException(
  26609. 'can not ask for authentication in non interactive mode'
  26610. );
  26611. }
  26612. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  26613. $this->hasAuth = true;
  26614. $this->credentials['username'] = $this->io->ask("Username: ");
  26615. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  26616. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  26617. return $this;
  26618. }
  26619. protected function getCommand($cmd, $url, $path = null)
  26620. {
  26621. $cmd = sprintf('%s %s%s %s',
  26622. $cmd,
  26623. '--non-interactive ',
  26624. $this->getCredentialString(),
  26625. ProcessExecutor::escape($url)
  26626. );
  26627. if ($path) {
  26628. $cmd .= ' ' . ProcessExecutor::escape($path);
  26629. }
  26630. return $cmd;
  26631. }
  26632. protected function getCredentialString()
  26633. {
  26634. if (!$this->hasAuth()) {
  26635. return '';
  26636. }
  26637. return sprintf(
  26638. ' %s--username %s --password %s ',
  26639. $this->getAuthCache(),
  26640. ProcessExecutor::escape($this->getUsername()),
  26641. ProcessExecutor::escape($this->getPassword())
  26642. );
  26643. }
  26644. protected function getPassword()
  26645. {
  26646. if ($this->credentials === null) {
  26647. throw new \LogicException("No svn auth detected.");
  26648. }
  26649. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  26650. }
  26651. protected function getUsername()
  26652. {
  26653. if ($this->credentials === null) {
  26654. throw new \LogicException("No svn auth detected.");
  26655. }
  26656. return $this->credentials['username'];
  26657. }
  26658. protected function hasAuth()
  26659. {
  26660. if (null !== $this->hasAuth) {
  26661. return $this->hasAuth;
  26662. }
  26663. if (false === $this->createAuthFromConfig()) {
  26664. $this->createAuthFromUrl();
  26665. }
  26666. return $this->hasAuth;
  26667. }
  26668. protected function getAuthCache()
  26669. {
  26670. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  26671. }
  26672. private function createAuthFromConfig()
  26673. {
  26674. if (!$this->config->has('http-basic')) {
  26675. return $this->hasAuth = false;
  26676. }
  26677. $authConfig = $this->config->get('http-basic');
  26678. $host = parse_url($this->url, PHP_URL_HOST);
  26679. if (isset($authConfig[$host])) {
  26680. $this->credentials['username'] = $authConfig[$host]['username'];
  26681. $this->credentials['password'] = $authConfig[$host]['password'];
  26682. return $this->hasAuth = true;
  26683. }
  26684. return $this->hasAuth = false;
  26685. }
  26686. private function createAuthFromUrl()
  26687. {
  26688. $uri = parse_url($this->url);
  26689. if (empty($uri['user'])) {
  26690. return $this->hasAuth = false;
  26691. }
  26692. $this->credentials['username'] = $uri['user'];
  26693. if (!empty($uri['pass'])) {
  26694. $this->credentials['password'] = $uri['pass'];
  26695. }
  26696. return $this->hasAuth = true;
  26697. }
  26698. }
  26699. <?php
  26700. namespace Composer\Util;
  26701. use Composer\CaBundle\CaBundle;
  26702. final class TlsHelper
  26703. {
  26704. private static $useOpensslParse;
  26705. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  26706. {
  26707. $names = self::getCertificateNames($certificate);
  26708. if (empty($names)) {
  26709. return false;
  26710. }
  26711. $combinedNames = array_merge($names['san'], array($names['cn']));
  26712. $hostname = strtolower($hostname);
  26713. foreach ($combinedNames as $certName) {
  26714. $matcher = self::certNameMatcher($certName);
  26715. if ($matcher && $matcher($hostname)) {
  26716. $cn = $names['cn'];
  26717. return true;
  26718. }
  26719. }
  26720. return false;
  26721. }
  26722. public static function getCertificateNames($certificate)
  26723. {
  26724. if (is_array($certificate)) {
  26725. $info = $certificate;
  26726. } elseif (CaBundle::isOpensslParseSafe()) {
  26727. $info = openssl_x509_parse($certificate, false);
  26728. }
  26729. if (!isset($info['subject']['commonName'])) {
  26730. return null;
  26731. }
  26732. $commonName = strtolower($info['subject']['commonName']);
  26733. $subjectAltNames = array();
  26734. if (isset($info['extensions']['subjectAltName'])) {
  26735. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  26736. $subjectAltNames = array_filter(array_map(function ($name) {
  26737. if (0 === strpos($name, 'DNS:')) {
  26738. return strtolower(ltrim(substr($name, 4)));
  26739. }
  26740. return null;
  26741. }, $subjectAltNames));
  26742. $subjectAltNames = array_values($subjectAltNames);
  26743. }
  26744. return array(
  26745. 'cn' => $commonName,
  26746. 'san' => $subjectAltNames,
  26747. );
  26748. }
  26749. public static function getCertificateFingerprint($certificate)
  26750. {
  26751. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  26752. $pubkeypem = $pubkeydetails['key'];
  26753. $start = '-----BEGIN PUBLIC KEY-----';
  26754. $end = '-----END PUBLIC KEY-----';
  26755. $pemtrim = substr($pubkeypem, (strpos($pubkeypem, $start) + strlen($start)), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  26756. $der = base64_decode($pemtrim);
  26757. return sha1($der);
  26758. }
  26759. public static function isOpensslParseSafe()
  26760. {
  26761. return CaBundle::isOpensslParseSafe();
  26762. }
  26763. private static function certNameMatcher($certName)
  26764. {
  26765. $wildcards = substr_count($certName, '*');
  26766. if (0 === $wildcards) {
  26767. return function ($hostname) use ($certName) {
  26768. return $hostname === $certName;
  26769. };
  26770. }
  26771. if (1 === $wildcards) {
  26772. $components = explode('.', $certName);
  26773. if (3 > count($components)) {
  26774. return;
  26775. }
  26776. $firstComponent = $components[0];
  26777. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  26778. return;
  26779. }
  26780. $wildcardRegex = preg_quote($certName);
  26781. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  26782. $wildcardRegex = "{^{$wildcardRegex}$}";
  26783. return function ($hostname) use ($wildcardRegex) {
  26784. return 1 === preg_match($wildcardRegex, $hostname);
  26785. };
  26786. }
  26787. }
  26788. }
  26789. <?php
  26790. namespace Composer\Util;
  26791. use Composer\Config;
  26792. use Composer\IO\IOInterface;
  26793. class Url
  26794. {
  26795. public static function updateDistReference(Config $config, $url, $ref)
  26796. {
  26797. $host = parse_url($url, PHP_URL_HOST);
  26798. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  26799. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  26800. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  26801. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  26802. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  26803. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  26804. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  26805. }
  26806. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  26807. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  26808. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  26809. }
  26810. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  26811. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  26812. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  26813. }
  26814. } elseif (in_array($host, $config->get('github-domains'), true)) {
  26815. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  26816. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  26817. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  26818. }
  26819. return $url;
  26820. }
  26821. }
  26822. <?php
  26823. namespace Composer;
  26824. use Composer\Util\IniHelper;
  26825. use Symfony\Component\Console\Output\OutputInterface;
  26826. class XdebugHandler
  26827. {
  26828. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  26829. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  26830. const RESTART_ID = 'internal';
  26831. private $output;
  26832. private $loaded;
  26833. private $envScanDir;
  26834. private $version;
  26835. private $tmpIni;
  26836. public function __construct(OutputInterface $output)
  26837. {
  26838. $this->output = $output;
  26839. $this->loaded = extension_loaded('xdebug');
  26840. $this->envScanDir = getenv('PHP_INI_SCAN_DIR');
  26841. if ($this->loaded) {
  26842. $ext = new \ReflectionExtension('xdebug');
  26843. $this->version = strval($ext->getVersion());
  26844. }
  26845. }
  26846. public function check()
  26847. {
  26848. $args = explode('|', strval(getenv(self::ENV_ALLOW)), 2);
  26849. if ($this->needsRestart($args[0])) {
  26850. if ($this->prepareRestart()) {
  26851. $command = $this->getCommand();
  26852. $this->restart($command);
  26853. }
  26854. return;
  26855. }
  26856. if (self::RESTART_ID === $args[0]) {
  26857. putenv(self::ENV_ALLOW);
  26858. if (false !== $this->envScanDir) {
  26859. if (isset($args[1])) {
  26860. putenv('PHP_INI_SCAN_DIR='.$args[1]);
  26861. } else {
  26862. putenv('PHP_INI_SCAN_DIR');
  26863. }
  26864. }
  26865. if ($this->loaded) {
  26866. putenv(self::ENV_VERSION);
  26867. }
  26868. }
  26869. }
  26870. protected function restart($command)
  26871. {
  26872. passthru($command, $exitCode);
  26873. if (!empty($this->tmpIni)) {
  26874. @unlink($this->tmpIni);
  26875. }
  26876. exit($exitCode);
  26877. }
  26878. private function needsRestart($allow)
  26879. {
  26880. if (PHP_SAPI !== 'cli' || !defined('PHP_BINARY')) {
  26881. return false;
  26882. }
  26883. return empty($allow) && $this->loaded;
  26884. }
  26885. private function prepareRestart()
  26886. {
  26887. $this->tmpIni = '';
  26888. $iniPaths = IniHelper::getAll();
  26889. $additional = count($iniPaths) > 1;
  26890. if ($this->writeTmpIni($iniPaths)) {
  26891. return $this->setEnvironment($additional, $iniPaths);
  26892. }
  26893. return false;
  26894. }
  26895. private function writeTmpIni(array $iniPaths)
  26896. {
  26897. if (!$this->tmpIni = tempnam(sys_get_temp_dir(), '')) {
  26898. return false;
  26899. }
  26900. if (empty($iniPaths[0])) {
  26901. array_shift($iniPaths);
  26902. }
  26903. $content = '';
  26904. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  26905. foreach ($iniPaths as $file) {
  26906. $data = preg_replace($regex, ';$1', file_get_contents($file));
  26907. $content .= $data.PHP_EOL;
  26908. }
  26909. $content .= 'allow_url_fopen='.ini_get('allow_url_fopen').PHP_EOL;
  26910. $content .= 'disable_functions="'.ini_get('disable_functions').'"'.PHP_EOL;
  26911. $content .= 'memory_limit='.ini_get('memory_limit').PHP_EOL;
  26912. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  26913. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  26914. }
  26915. return @file_put_contents($this->tmpIni, $content);
  26916. }
  26917. private function getCommand()
  26918. {
  26919. $phpArgs = array(PHP_BINARY, '-c', $this->tmpIni);
  26920. $params = array_merge($phpArgs, $this->getScriptArgs($_SERVER['argv']));
  26921. return implode(' ', array_map(array($this, 'escape'), $params));
  26922. }
  26923. private function setEnvironment($additional, array $iniPaths)
  26924. {
  26925. if ($additional && !putenv('PHP_INI_SCAN_DIR=')) {
  26926. return false;
  26927. }
  26928. if (!putenv(IniHelper::ENV_ORIGINAL.'='.implode(PATH_SEPARATOR, $iniPaths))) {
  26929. return false;
  26930. }
  26931. if (!putenv(self::ENV_VERSION.'='.$this->version)) {
  26932. return false;
  26933. }
  26934. $args = array(self::RESTART_ID);
  26935. if (false !== $this->envScanDir) {
  26936. $args[] = $this->envScanDir;
  26937. }
  26938. return putenv(self::ENV_ALLOW.'='.implode('|', $args));
  26939. }
  26940. private function getScriptArgs(array $args)
  26941. {
  26942. if (in_array('--no-ansi', $args) || in_array('--ansi', $args)) {
  26943. return $args;
  26944. }
  26945. if ($this->output->isDecorated()) {
  26946. $offset = count($args) > 1 ? 2 : 1;
  26947. array_splice($args, $offset, 0, '--ansi');
  26948. }
  26949. return $args;
  26950. }
  26951. private function escape($arg, $meta = true)
  26952. {
  26953. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  26954. return escapeshellarg($arg);
  26955. }
  26956. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  26957. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  26958. if ($meta) {
  26959. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  26960. if (!$meta && !$quote) {
  26961. $quote = strpbrk($arg, '^&|<>()') !== false;
  26962. }
  26963. }
  26964. if ($quote) {
  26965. $arg = preg_replace('/(\\\\*)$/', '$1$1', $arg);
  26966. $arg = '"'.$arg.'"';
  26967. }
  26968. if ($meta) {
  26969. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  26970. }
  26971. return $arg;
  26972. }
  26973. }
  26974. <?php
  26975. function includeIfExists($file)
  26976. {
  26977. return file_exists($file) ? include $file : false;
  26978. }
  26979. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  26980. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  26981. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  26982. exit(1);
  26983. }
  26984. return $loader;
  26985. <?php
  26986. /*
  26987. * This file is part of Composer.
  26988. *
  26989. * (c) Nils Adermann <naderman@naderman.de>
  26990. * Jordi Boggiano <j.boggiano@seld.be>
  26991. *
  26992. * For the full copyright and license information, please view the LICENSE
  26993. * file that was distributed with this source code.
  26994. */
  26995. namespace Composer\Autoload;
  26996. /**
  26997. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  26998. *
  26999. * $loader = new \Composer\Autoload\ClassLoader();
  27000. *
  27001. * // register classes with namespaces
  27002. * $loader->add('Symfony\Component', __DIR__.'/component');
  27003. * $loader->add('Symfony', __DIR__.'/framework');
  27004. *
  27005. * // activate the autoloader
  27006. * $loader->register();
  27007. *
  27008. * // to enable searching the include path (eg. for PEAR packages)
  27009. * $loader->setUseIncludePath(true);
  27010. *
  27011. * In this example, if you try to use a class in the Symfony\Component
  27012. * namespace or one of its children (Symfony\Component\Console for instance),
  27013. * the autoloader will first look for the class under the component/
  27014. * directory, and it will then fallback to the framework/ directory if not
  27015. * found before giving up.
  27016. *
  27017. * This class is loosely based on the Symfony UniversalClassLoader.
  27018. *
  27019. * @author Fabien Potencier <fabien@symfony.com>
  27020. * @author Jordi Boggiano <j.boggiano@seld.be>
  27021. * @see http://www.php-fig.org/psr/psr-0/
  27022. * @see http://www.php-fig.org/psr/psr-4/
  27023. */
  27024. class ClassLoader
  27025. {
  27026. // PSR-4
  27027. private $prefixLengthsPsr4 = array();
  27028. private $prefixDirsPsr4 = array();
  27029. private $fallbackDirsPsr4 = array();
  27030. // PSR-0
  27031. private $prefixesPsr0 = array();
  27032. private $fallbackDirsPsr0 = array();
  27033. private $useIncludePath = false;
  27034. private $classMap = array();
  27035. private $classMapAuthoritative = false;
  27036. private $missingClasses = array();
  27037. private $apcuPrefix;
  27038. public function getPrefixes()
  27039. {
  27040. if (!empty($this->prefixesPsr0)) {
  27041. return call_user_func_array('array_merge', $this->prefixesPsr0);
  27042. }
  27043. return array();
  27044. }
  27045. public function getPrefixesPsr4()
  27046. {
  27047. return $this->prefixDirsPsr4;
  27048. }
  27049. public function getFallbackDirs()
  27050. {
  27051. return $this->fallbackDirsPsr0;
  27052. }
  27053. public function getFallbackDirsPsr4()
  27054. {
  27055. return $this->fallbackDirsPsr4;
  27056. }
  27057. public function getClassMap()
  27058. {
  27059. return $this->classMap;
  27060. }
  27061. /**
  27062. * @param array $classMap Class to filename map
  27063. */
  27064. public function addClassMap(array $classMap)
  27065. {
  27066. if ($this->classMap) {
  27067. $this->classMap = array_merge($this->classMap, $classMap);
  27068. } else {
  27069. $this->classMap = $classMap;
  27070. }
  27071. }
  27072. /**
  27073. * Registers a set of PSR-0 directories for a given prefix, either
  27074. * appending or prepending to the ones previously set for this prefix.
  27075. *
  27076. * @param string $prefix The prefix
  27077. * @param array|string $paths The PSR-0 root directories
  27078. * @param bool $prepend Whether to prepend the directories
  27079. */
  27080. public function add($prefix, $paths, $prepend = false)
  27081. {
  27082. if (!$prefix) {
  27083. if ($prepend) {
  27084. $this->fallbackDirsPsr0 = array_merge(
  27085. (array) $paths,
  27086. $this->fallbackDirsPsr0
  27087. );
  27088. } else {
  27089. $this->fallbackDirsPsr0 = array_merge(
  27090. $this->fallbackDirsPsr0,
  27091. (array) $paths
  27092. );
  27093. }
  27094. return;
  27095. }
  27096. $first = $prefix[0];
  27097. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  27098. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  27099. return;
  27100. }
  27101. if ($prepend) {
  27102. $this->prefixesPsr0[$first][$prefix] = array_merge(
  27103. (array) $paths,
  27104. $this->prefixesPsr0[$first][$prefix]
  27105. );
  27106. } else {
  27107. $this->prefixesPsr0[$first][$prefix] = array_merge(
  27108. $this->prefixesPsr0[$first][$prefix],
  27109. (array) $paths
  27110. );
  27111. }
  27112. }
  27113. /**
  27114. * Registers a set of PSR-4 directories for a given namespace, either
  27115. * appending or prepending to the ones previously set for this namespace.
  27116. *
  27117. * @param string $prefix The prefix/namespace, with trailing '\\'
  27118. * @param array|string $paths The PSR-4 base directories
  27119. * @param bool $prepend Whether to prepend the directories
  27120. *
  27121. * @throws \InvalidArgumentException
  27122. */
  27123. public function addPsr4($prefix, $paths, $prepend = false)
  27124. {
  27125. if (!$prefix) {
  27126. // Register directories for the root namespace.
  27127. if ($prepend) {
  27128. $this->fallbackDirsPsr4 = array_merge(
  27129. (array) $paths,
  27130. $this->fallbackDirsPsr4
  27131. );
  27132. } else {
  27133. $this->fallbackDirsPsr4 = array_merge(
  27134. $this->fallbackDirsPsr4,
  27135. (array) $paths
  27136. );
  27137. }
  27138. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  27139. // Register directories for a new namespace.
  27140. $length = strlen($prefix);
  27141. if ('\\' !== $prefix[$length - 1]) {
  27142. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  27143. }
  27144. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  27145. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  27146. } elseif ($prepend) {
  27147. // Prepend directories for an already registered namespace.
  27148. $this->prefixDirsPsr4[$prefix] = array_merge(
  27149. (array) $paths,
  27150. $this->prefixDirsPsr4[$prefix]
  27151. );
  27152. } else {
  27153. // Append directories for an already registered namespace.
  27154. $this->prefixDirsPsr4[$prefix] = array_merge(
  27155. $this->prefixDirsPsr4[$prefix],
  27156. (array) $paths
  27157. );
  27158. }
  27159. }
  27160. /**
  27161. * Registers a set of PSR-0 directories for a given prefix,
  27162. * replacing any others previously set for this prefix.
  27163. *
  27164. * @param string $prefix The prefix
  27165. * @param array|string $paths The PSR-0 base directories
  27166. */
  27167. public function set($prefix, $paths)
  27168. {
  27169. if (!$prefix) {
  27170. $this->fallbackDirsPsr0 = (array) $paths;
  27171. } else {
  27172. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  27173. }
  27174. }
  27175. /**
  27176. * Registers a set of PSR-4 directories for a given namespace,
  27177. * replacing any others previously set for this namespace.
  27178. *
  27179. * @param string $prefix The prefix/namespace, with trailing '\\'
  27180. * @param array|string $paths The PSR-4 base directories
  27181. *
  27182. * @throws \InvalidArgumentException
  27183. */
  27184. public function setPsr4($prefix, $paths)
  27185. {
  27186. if (!$prefix) {
  27187. $this->fallbackDirsPsr4 = (array) $paths;
  27188. } else {
  27189. $length = strlen($prefix);
  27190. if ('\\' !== $prefix[$length - 1]) {
  27191. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  27192. }
  27193. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  27194. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  27195. }
  27196. }
  27197. /**
  27198. * Turns on searching the include path for class files.
  27199. *
  27200. * @param bool $useIncludePath
  27201. */
  27202. public function setUseIncludePath($useIncludePath)
  27203. {
  27204. $this->useIncludePath = $useIncludePath;
  27205. }
  27206. /**
  27207. * Can be used to check if the autoloader uses the include path to check
  27208. * for classes.
  27209. *
  27210. * @return bool
  27211. */
  27212. public function getUseIncludePath()
  27213. {
  27214. return $this->useIncludePath;
  27215. }
  27216. /**
  27217. * Turns off searching the prefix and fallback directories for classes
  27218. * that have not been registered with the class map.
  27219. *
  27220. * @param bool $classMapAuthoritative
  27221. */
  27222. public function setClassMapAuthoritative($classMapAuthoritative)
  27223. {
  27224. $this->classMapAuthoritative = $classMapAuthoritative;
  27225. }
  27226. /**
  27227. * Should class lookup fail if not found in the current class map?
  27228. *
  27229. * @return bool
  27230. */
  27231. public function isClassMapAuthoritative()
  27232. {
  27233. return $this->classMapAuthoritative;
  27234. }
  27235. /**
  27236. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  27237. *
  27238. * @param string|null $apcuPrefix
  27239. */
  27240. public function setApcuPrefix($apcuPrefix)
  27241. {
  27242. $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
  27243. }
  27244. /**
  27245. * The APCu prefix in use, or null if APCu caching is not enabled.
  27246. *
  27247. * @return string|null
  27248. */
  27249. public function getApcuPrefix()
  27250. {
  27251. return $this->apcuPrefix;
  27252. }
  27253. /**
  27254. * Registers this instance as an autoloader.
  27255. *
  27256. * @param bool $prepend Whether to prepend the autoloader or not
  27257. */
  27258. public function register($prepend = false)
  27259. {
  27260. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  27261. }
  27262. /**
  27263. * Unregisters this instance as an autoloader.
  27264. */
  27265. public function unregister()
  27266. {
  27267. spl_autoload_unregister(array($this, 'loadClass'));
  27268. }
  27269. /**
  27270. * Loads the given class or interface.
  27271. *
  27272. * @param string $class The name of the class
  27273. * @return bool|null True if loaded, null otherwise
  27274. */
  27275. public function loadClass($class)
  27276. {
  27277. if ($file = $this->findFile($class)) {
  27278. includeFile($file);
  27279. return true;
  27280. }
  27281. }
  27282. /**
  27283. * Finds the path to the file where the class is defined.
  27284. *
  27285. * @param string $class The name of the class
  27286. *
  27287. * @return string|false The path if found, false otherwise
  27288. */
  27289. public function findFile($class)
  27290. {
  27291. // class map lookup
  27292. if (isset($this->classMap[$class])) {
  27293. return $this->classMap[$class];
  27294. }
  27295. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  27296. return false;
  27297. }
  27298. if (null !== $this->apcuPrefix) {
  27299. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  27300. if ($hit) {
  27301. return $file;
  27302. }
  27303. }
  27304. $file = $this->findFileWithExtension($class, '.php');
  27305. // Search for Hack files if we are running on HHVM
  27306. if (false === $file && defined('HHVM_VERSION')) {
  27307. $file = $this->findFileWithExtension($class, '.hh');
  27308. }
  27309. if (null !== $this->apcuPrefix) {
  27310. apcu_add($this->apcuPrefix.$class, $file);
  27311. }
  27312. if (false === $file) {
  27313. // Remember that this class does not exist.
  27314. $this->missingClasses[$class] = true;
  27315. }
  27316. return $file;
  27317. }
  27318. private function findFileWithExtension($class, $ext)
  27319. {
  27320. // PSR-4 lookup
  27321. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  27322. $first = $class[0];
  27323. if (isset($this->prefixLengthsPsr4[$first])) {
  27324. $subPath = $class;
  27325. while (false !== $lastPos = strrpos($subPath, '\\')) {
  27326. $subPath = substr($subPath, 0, $lastPos);
  27327. $search = $subPath.'\\';
  27328. if (isset($this->prefixDirsPsr4[$search])) {
  27329. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  27330. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  27331. if (file_exists($file = $dir . $pathEnd)) {
  27332. return $file;
  27333. }
  27334. }
  27335. }
  27336. }
  27337. }
  27338. // PSR-4 fallback dirs
  27339. foreach ($this->fallbackDirsPsr4 as $dir) {
  27340. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  27341. return $file;
  27342. }
  27343. }
  27344. // PSR-0 lookup
  27345. if (false !== $pos = strrpos($class, '\\')) {
  27346. // namespaced class name
  27347. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  27348. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  27349. } else {
  27350. // PEAR-like class name
  27351. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  27352. }
  27353. if (isset($this->prefixesPsr0[$first])) {
  27354. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  27355. if (0 === strpos($class, $prefix)) {
  27356. foreach ($dirs as $dir) {
  27357. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  27358. return $file;
  27359. }
  27360. }
  27361. }
  27362. }
  27363. }
  27364. // PSR-0 fallback dirs
  27365. foreach ($this->fallbackDirsPsr0 as $dir) {
  27366. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  27367. return $file;
  27368. }
  27369. }
  27370. // PSR-0 include paths.
  27371. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  27372. return $file;
  27373. }
  27374. return false;
  27375. }
  27376. }
  27377. /**
  27378. * Scope isolated include.
  27379. *
  27380. * Prevents access to $this/self from included files.
  27381. */
  27382. function includeFile($file)
  27383. {
  27384. include $file;
  27385. }
  27386. {
  27387. "$schema": "http://json-schema.org/draft-04/schema#",
  27388. "description": "A representation of packages metadata.",
  27389. "type": "object",
  27390. "oneOf": [
  27391. { "required": [ "packages" ] },
  27392. { "required": [ "providers" ] },
  27393. { "required": [ "provider-includes", "providers-url" ] }
  27394. ],
  27395. "properties": {
  27396. "packages": {
  27397. "type": ["object", "array"],
  27398. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  27399. "additionalProperties": { "$ref": "#/definitions/versions" }
  27400. },
  27401. "providers-url": {
  27402. "type": "string",
  27403. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  27404. },
  27405. "provider-includes": {
  27406. "type": "object",
  27407. "description": "A hashmap of provider listings.",
  27408. "additionalProperties": { "$ref": "#/definitions/provider" }
  27409. },
  27410. "providers": {
  27411. "type": "object",
  27412. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  27413. "additionalProperties": { "$ref": "#/definitions/provider" }
  27414. },
  27415. "notify-batch": {
  27416. "type": "string",
  27417. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  27418. },
  27419. "search": {
  27420. "type": "string",
  27421. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  27422. },
  27423. "warning": {
  27424. "type": "string",
  27425. "description": "A message that will be output by Composer as a warning when this source is consulted."
  27426. }
  27427. },
  27428. "definitions": {
  27429. "versions": {
  27430. "type": "object",
  27431. "description": "A hashmap of versions and their metadata.",
  27432. "additionalProperties": { "$ref": "#/definitions/version" }
  27433. },
  27434. "version": {
  27435. "type": "object",
  27436. "oneOf": [
  27437. { "$ref": "#/definitions/package" },
  27438. { "$ref": "#/definitions/metapackage" }
  27439. ]
  27440. },
  27441. "package-base": {
  27442. "properties": {
  27443. "name": { "type": "string" },
  27444. "type": { "type": "string" },
  27445. "version": { "type": "string" },
  27446. "version_normalized": {
  27447. "type": "string",
  27448. "description": "Normalized version, optional but can save computational time on client side."
  27449. },
  27450. "autoload": { "type": "object" },
  27451. "require": { "type": "object" },
  27452. "replace": { "type": "object" },
  27453. "conflict": { "type": "object" },
  27454. "provide": { "type": "object" },
  27455. "time": { "type": "string" }
  27456. },
  27457. "additionalProperties": true
  27458. },
  27459. "package": {
  27460. "allOf": [
  27461. { "$ref": "#/definitions/package-base" },
  27462. {
  27463. "properties": {
  27464. "dist": { "type": "object" },
  27465. "source": { "type": "object" }
  27466. }
  27467. },
  27468. { "oneOf": [
  27469. { "required": [ "name", "version", "source" ] },
  27470. { "required": [ "name", "version", "dist" ] }
  27471. ] }
  27472. ]
  27473. },
  27474. "metapackage": {
  27475. "allOf": [
  27476. { "$ref": "#/definitions/package-base" },
  27477. {
  27478. "properties": {
  27479. "type": { "type": "string", "enum": [ "metapackage" ] }
  27480. },
  27481. "required": [ "name", "version", "type" ]
  27482. }
  27483. ]
  27484. },
  27485. "provider": {
  27486. "type": "object",
  27487. "properties": {
  27488. "sha256": {
  27489. "type": "string",
  27490. "description": "Hash value that can be used to validate the resource."
  27491. }
  27492. }
  27493. }
  27494. }
  27495. }
  27496. {
  27497. "$schema": "http://json-schema.org/draft-04/schema#",
  27498. "name": "Package",
  27499. "type": "object",
  27500. "additionalProperties": false,
  27501. "required": [ "name", "description" ],
  27502. "properties": {
  27503. "name": {
  27504. "type": "string",
  27505. "description": "Package name, including 'vendor-name/' prefix."
  27506. },
  27507. "type": {
  27508. "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
  27509. "type": "string"
  27510. },
  27511. "target-dir": {
  27512. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  27513. "type": "string"
  27514. },
  27515. "description": {
  27516. "type": "string",
  27517. "description": "Short package description."
  27518. },
  27519. "keywords": {
  27520. "type": "array",
  27521. "items": {
  27522. "type": "string",
  27523. "description": "A tag/keyword that this package relates to."
  27524. }
  27525. },
  27526. "homepage": {
  27527. "type": "string",
  27528. "description": "Homepage URL for the project.",
  27529. "format": "uri"
  27530. },
  27531. "version": {
  27532. "type": "string",
  27533. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
  27534. },
  27535. "time": {
  27536. "type": "string",
  27537. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  27538. },
  27539. "license": {
  27540. "type": ["string", "array"],
  27541. "description": "License name. Or an array of license names."
  27542. },
  27543. "authors": {
  27544. "$ref": "#/definitions/authors"
  27545. },
  27546. "require": {
  27547. "type": "object",
  27548. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  27549. "additionalProperties": {
  27550. "type": "string"
  27551. }
  27552. },
  27553. "replace": {
  27554. "type": "object",
  27555. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  27556. "additionalProperties": {
  27557. "type": "string"
  27558. }
  27559. },
  27560. "conflict": {
  27561. "type": "object",
  27562. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  27563. "additionalProperties": {
  27564. "type": "string"
  27565. }
  27566. },
  27567. "provide": {
  27568. "type": "object",
  27569. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  27570. "additionalProperties": {
  27571. "type": "string"
  27572. }
  27573. },
  27574. "require-dev": {
  27575. "type": "object",
  27576. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  27577. "additionalProperties": {
  27578. "type": "string"
  27579. }
  27580. },
  27581. "suggest": {
  27582. "type": "object",
  27583. "description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  27584. "additionalProperties": {
  27585. "type": "string"
  27586. }
  27587. },
  27588. "config": {
  27589. "type": "object",
  27590. "description": "Composer options.",
  27591. "properties": {
  27592. "process-timeout": {
  27593. "type": "integer",
  27594. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  27595. },
  27596. "use-include-path": {
  27597. "type": "boolean",
  27598. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  27599. },
  27600. "preferred-install": {
  27601. "type": ["string", "object"],
  27602. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or a hash of {\"pattern\": \"preference\"}."
  27603. },
  27604. "notify-on-install": {
  27605. "type": "boolean",
  27606. "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
  27607. },
  27608. "github-protocols": {
  27609. "type": "array",
  27610. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  27611. "items": {
  27612. "type": "string"
  27613. }
  27614. },
  27615. "github-oauth": {
  27616. "type": "object",
  27617. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  27618. "additionalProperties": {
  27619. "type": "string"
  27620. }
  27621. },
  27622. "gitlab-oauth": {
  27623. "type": "object",
  27624. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  27625. "additionalProperties": {
  27626. "type": "string"
  27627. }
  27628. },
  27629. "gitlab-token": {
  27630. "type": "object",
  27631. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  27632. "additionalProperties": true
  27633. },
  27634. "disable-tls": {
  27635. "type": "boolean",
  27636. "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini."
  27637. },
  27638. "secure-http": {
  27639. "type": "boolean",
  27640. "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative."
  27641. },
  27642. "cafile": {
  27643. "type": "string",
  27644. "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically."
  27645. },
  27646. "capath": {
  27647. "type": "string",
  27648. "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory."
  27649. },
  27650. "http-basic": {
  27651. "type": "object",
  27652. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  27653. "additionalProperties": {
  27654. "type": "object",
  27655. "required": ["username", "password"],
  27656. "properties": {
  27657. "username": {
  27658. "type": "string",
  27659. "description": "The username used for HTTP Basic authentication"
  27660. },
  27661. "password": {
  27662. "type": "string",
  27663. "description": "The password used for HTTP Basic authentication"
  27664. }
  27665. }
  27666. }
  27667. },
  27668. "store-auths": {
  27669. "type": ["string", "boolean"],
  27670. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  27671. },
  27672. "platform": {
  27673. "type": "object",
  27674. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  27675. "additionalProperties": {
  27676. "type": "string"
  27677. }
  27678. },
  27679. "vendor-dir": {
  27680. "type": "string",
  27681. "description": "The location where all packages are installed, defaults to \"vendor\"."
  27682. },
  27683. "bin-dir": {
  27684. "type": "string",
  27685. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  27686. },
  27687. "data-dir": {
  27688. "type": "string",
  27689. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  27690. },
  27691. "cache-dir": {
  27692. "type": "string",
  27693. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  27694. },
  27695. "cache-files-dir": {
  27696. "type": "string",
  27697. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  27698. },
  27699. "cache-repo-dir": {
  27700. "type": "string",
  27701. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  27702. },
  27703. "cache-vcs-dir": {
  27704. "type": "string",
  27705. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  27706. },
  27707. "cache-ttl": {
  27708. "type": "integer",
  27709. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  27710. },
  27711. "cache-files-ttl": {
  27712. "type": "integer",
  27713. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  27714. },
  27715. "cache-files-maxsize": {
  27716. "type": ["string", "integer"],
  27717. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  27718. },
  27719. "bin-compat": {
  27720. "enum": ["auto", "full"],
  27721. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  27722. },
  27723. "discard-changes": {
  27724. "type": ["string", "boolean"],
  27725. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  27726. },
  27727. "autoloader-suffix": {
  27728. "type": "string",
  27729. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  27730. },
  27731. "optimize-autoloader": {
  27732. "type": "boolean",
  27733. "description": "Always optimize when dumping the autoloader."
  27734. },
  27735. "prepend-autoloader": {
  27736. "type": "boolean",
  27737. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  27738. },
  27739. "classmap-authoritative": {
  27740. "type": "boolean",
  27741. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  27742. },
  27743. "apcu-autoloader": {
  27744. "type": "boolean",
  27745. "description": "If true, the Composer autoloader will check for APCu and use it to cache found/not-found classes when the extension is enabled, defaults to false."
  27746. },
  27747. "github-domains": {
  27748. "type": "array",
  27749. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  27750. "items": {
  27751. "type": "string"
  27752. }
  27753. },
  27754. "github-expose-hostname": {
  27755. "type": "boolean",
  27756. "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname."
  27757. },
  27758. "gitlab-domains": {
  27759. "type": "array",
  27760. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  27761. "items": {
  27762. "type": "string"
  27763. }
  27764. },
  27765. "archive-format": {
  27766. "type": "string",
  27767. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  27768. },
  27769. "archive-dir": {
  27770. "type": "string",
  27771. "description": "The default archive path when not provided on cli, defaults to \".\"."
  27772. },
  27773. "htaccess-protect": {
  27774. "type": "boolean",
  27775. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  27776. },
  27777. "sort-packages": {
  27778. "type": "boolean",
  27779. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  27780. }
  27781. }
  27782. },
  27783. "extra": {
  27784. "type": ["object", "array"],
  27785. "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.",
  27786. "additionalProperties": true
  27787. },
  27788. "autoload": {
  27789. "$ref": "#/definitions/autoload"
  27790. },
  27791. "autoload-dev": {
  27792. "type": "object",
  27793. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  27794. "properties": {
  27795. "psr-0": {
  27796. "type": "object",
  27797. "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  27798. "additionalProperties": {
  27799. "type": ["string", "array"],
  27800. "items": {
  27801. "type": "string"
  27802. }
  27803. }
  27804. },
  27805. "psr-4": {
  27806. "type": "object",
  27807. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  27808. "additionalProperties": {
  27809. "type": ["string", "array"],
  27810. "items": {
  27811. "type": "string"
  27812. }
  27813. }
  27814. },
  27815. "classmap": {
  27816. "type": "array",
  27817. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  27818. },
  27819. "files": {
  27820. "type": "array",
  27821. "description": "This is an array of files that are always required on every request."
  27822. }
  27823. }
  27824. },
  27825. "archive": {
  27826. "type": ["object"],
  27827. "description": "Options for creating package archives for distribution.",
  27828. "properties": {
  27829. "exclude": {
  27830. "type": "array",
  27831. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  27832. }
  27833. }
  27834. },
  27835. "repositories": {
  27836. "type": ["object", "array"],
  27837. "description": "A set of additional repositories where packages can be found.",
  27838. "additionalProperties": {
  27839. "oneOf": [
  27840. { "$ref": "#/definitions/repository" },
  27841. { "type": "boolean", "enum": [false] }
  27842. ]
  27843. },
  27844. "items": {
  27845. "oneOf": [
  27846. { "$ref": "#/definitions/repository" },
  27847. {
  27848. "type": "object",
  27849. "additionalProperties": { "type": "boolean", "enum": [false] },
  27850. "minProperties": 1,
  27851. "maxProperties": 1
  27852. }
  27853. ]
  27854. }
  27855. },
  27856. "minimum-stability": {
  27857. "type": ["string"],
  27858. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  27859. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  27860. },
  27861. "prefer-stable": {
  27862. "type": ["boolean"],
  27863. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  27864. },
  27865. "bin": {
  27866. "type": ["string", "array"],
  27867. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  27868. "items": {
  27869. "type": "string"
  27870. }
  27871. },
  27872. "include-path": {
  27873. "type": ["array"],
  27874. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  27875. "items": {
  27876. "type": "string"
  27877. }
  27878. },
  27879. "scripts": {
  27880. "type": ["object"],
  27881. "description": "Script listeners that will be executed before/after some events.",
  27882. "properties": {
  27883. "pre-install-cmd": {
  27884. "type": ["array", "string"],
  27885. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  27886. },
  27887. "post-install-cmd": {
  27888. "type": ["array", "string"],
  27889. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  27890. },
  27891. "pre-update-cmd": {
  27892. "type": ["array", "string"],
  27893. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  27894. },
  27895. "post-update-cmd": {
  27896. "type": ["array", "string"],
  27897. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  27898. },
  27899. "pre-status-cmd": {
  27900. "type": ["array", "string"],
  27901. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  27902. },
  27903. "post-status-cmd": {
  27904. "type": ["array", "string"],
  27905. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  27906. },
  27907. "pre-package-install": {
  27908. "type": ["array", "string"],
  27909. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  27910. },
  27911. "post-package-install": {
  27912. "type": ["array", "string"],
  27913. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  27914. },
  27915. "pre-package-update": {
  27916. "type": ["array", "string"],
  27917. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  27918. },
  27919. "post-package-update": {
  27920. "type": ["array", "string"],
  27921. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  27922. },
  27923. "pre-package-uninstall": {
  27924. "type": ["array", "string"],
  27925. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  27926. },
  27927. "post-package-uninstall": {
  27928. "type": ["array", "string"],
  27929. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  27930. },
  27931. "pre-autoload-dump": {
  27932. "type": ["array", "string"],
  27933. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  27934. },
  27935. "post-autoload-dump": {
  27936. "type": ["array", "string"],
  27937. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  27938. },
  27939. "post-root-package-install": {
  27940. "type": ["array", "string"],
  27941. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  27942. },
  27943. "post-create-project-cmd": {
  27944. "type": ["array", "string"],
  27945. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  27946. }
  27947. }
  27948. },
  27949. "scripts-descriptions": {
  27950. "type": ["object"],
  27951. "description": "Descriptions for custom commands, shown in console help.",
  27952. "additionalProperties": {
  27953. "type": "string"
  27954. }
  27955. },
  27956. "support": {
  27957. "type": "object",
  27958. "properties": {
  27959. "email": {
  27960. "type": "string",
  27961. "description": "Email address for support.",
  27962. "format": "email"
  27963. },
  27964. "issues": {
  27965. "type": "string",
  27966. "description": "URL to the issue tracker.",
  27967. "format": "uri"
  27968. },
  27969. "forum": {
  27970. "type": "string",
  27971. "description": "URL to the forum.",
  27972. "format": "uri"
  27973. },
  27974. "wiki": {
  27975. "type": "string",
  27976. "description": "URL to the wiki.",
  27977. "format": "uri"
  27978. },
  27979. "irc": {
  27980. "type": "string",
  27981. "description": "IRC channel for support, as irc://server/channel.",
  27982. "format": "uri"
  27983. },
  27984. "source": {
  27985. "type": "string",
  27986. "description": "URL to browse or download the sources.",
  27987. "format": "uri"
  27988. },
  27989. "docs": {
  27990. "type": "string",
  27991. "description": "URL to the documentation.",
  27992. "format": "uri"
  27993. },
  27994. "rss": {
  27995. "type": "string",
  27996. "description": "URL to the RSS feed.",
  27997. "format": "uri"
  27998. }
  27999. }
  28000. },
  28001. "non-feature-branches": {
  28002. "type": ["array"],
  28003. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  28004. "items": {
  28005. "type": "string"
  28006. }
  28007. },
  28008. "abandoned": {
  28009. "type": ["boolean", "string"],
  28010. "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
  28011. },
  28012. "_comment": {
  28013. "type": ["array", "string"],
  28014. "description": "A key to store comments in"
  28015. }
  28016. },
  28017. "definitions": {
  28018. "authors": {
  28019. "type": "array",
  28020. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  28021. "items": {
  28022. "type": "object",
  28023. "additionalProperties": false,
  28024. "required": [ "name"],
  28025. "properties": {
  28026. "name": {
  28027. "type": "string",
  28028. "description": "Full name of the author."
  28029. },
  28030. "email": {
  28031. "type": "string",
  28032. "description": "Email address of the author.",
  28033. "format": "email"
  28034. },
  28035. "homepage": {
  28036. "type": "string",
  28037. "description": "Homepage URL for the author.",
  28038. "format": "uri"
  28039. },
  28040. "role": {
  28041. "type": "string",
  28042. "description": "Author's role in the project."
  28043. }
  28044. }
  28045. }
  28046. },
  28047. "autoload": {
  28048. "type": "object",
  28049. "description": "Description of how the package can be autoloaded.",
  28050. "properties": {
  28051. "psr-0": {
  28052. "type": "object",
  28053. "description": "This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  28054. "additionalProperties": {
  28055. "type": ["string", "array"],
  28056. "items": {
  28057. "type": "string"
  28058. }
  28059. }
  28060. },
  28061. "psr-4": {
  28062. "type": "object",
  28063. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  28064. "additionalProperties": {
  28065. "type": ["string", "array"],
  28066. "items": {
  28067. "type": "string"
  28068. }
  28069. }
  28070. },
  28071. "classmap": {
  28072. "type": "array",
  28073. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  28074. },
  28075. "files": {
  28076. "type": "array",
  28077. "description": "This is an array of files that are always required on every request."
  28078. },
  28079. "exclude-from-classmap": {
  28080. "type": "array",
  28081. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  28082. }
  28083. }
  28084. },
  28085. "repository": {
  28086. "type": "object",
  28087. "oneOf": [
  28088. { "$ref": "#/definitions/composer-repository" },
  28089. { "$ref": "#/definitions/vcs-repository" },
  28090. { "$ref": "#/definitions/path-repository" },
  28091. { "$ref": "#/definitions/artifact-repository" },
  28092. { "$ref": "#/definitions/pear-repository" },
  28093. { "$ref": "#/definitions/package-repository" }
  28094. ]
  28095. },
  28096. "composer-repository": {
  28097. "type": "object",
  28098. "required": ["type", "url"],
  28099. "properties": {
  28100. "type": { "type": "string", "enum": ["composer"] },
  28101. "url": { "type": "string" },
  28102. "options": {
  28103. "type": "object",
  28104. "additionalProperties": true
  28105. },
  28106. "allow_ssl_downgrade": { "type": "boolean" },
  28107. "force-lazy-providers": { "type": "boolean" }
  28108. }
  28109. },
  28110. "vcs-repository": {
  28111. "type": "object",
  28112. "required": ["type", "url"],
  28113. "properties": {
  28114. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  28115. "url": { "type": "string" },
  28116. "no-api": { "type": "boolean" },
  28117. "secure-http": { "type": "boolean" },
  28118. "svn-cache-credentials": { "type": "boolean" },
  28119. "trunk-path": { "type": ["string", "boolean"] },
  28120. "branches-path": { "type": ["string", "boolean"] },
  28121. "tags-path": { "type": ["string", "boolean"] },
  28122. "package-path": { "type": "string" },
  28123. "depot": { "type": "string" },
  28124. "branch": { "type": "string" },
  28125. "unique_perforce_client_name": { "type": "string" },
  28126. "p4user": { "type": "string" },
  28127. "p4password": { "type": "string" }
  28128. }
  28129. },
  28130. "path-repository": {
  28131. "type": "object",
  28132. "required": ["type", "url"],
  28133. "properties": {
  28134. "type": { "type": "string", "enum": ["path"] },
  28135. "url": { "type": "string" },
  28136. "options": {
  28137. "type": "object",
  28138. "properties": {
  28139. "symlink": { "type": ["boolean", "null"] }
  28140. },
  28141. "additionalProperties": true
  28142. }
  28143. }
  28144. },
  28145. "artifact-repository": {
  28146. "type": "object",
  28147. "required": ["type", "url"],
  28148. "properties": {
  28149. "type": { "type": "string", "enum": ["artifact"] },
  28150. "url": { "type": "string" }
  28151. }
  28152. },
  28153. "pear-repository": {
  28154. "type": "object",
  28155. "required": ["type", "url"],
  28156. "properties": {
  28157. "type": { "type": "string", "enum": ["pear"] },
  28158. "url": { "type": "string" },
  28159. "vendor-alias": { "type": "string" }
  28160. }
  28161. },
  28162. "package-repository": {
  28163. "type": "object",
  28164. "required": ["type", "package"],
  28165. "properties": {
  28166. "type": { "type": "string", "enum": ["package"] },
  28167. "package": {
  28168. "oneOf": [
  28169. { "$ref": "#/definitions/inline-package" },
  28170. {
  28171. "type": "array",
  28172. "items": {
  28173. "type": { "$ref": "#/definitions/inline-package" }
  28174. }
  28175. }
  28176. ]
  28177. }
  28178. }
  28179. },
  28180. "inline-package": {
  28181. "required": ["name", "version"],
  28182. "properties": {
  28183. "name": {
  28184. "type": "string",
  28185. "description": "Package name, including 'vendor-name/' prefix."
  28186. },
  28187. "type": {
  28188. "type": "string"
  28189. },
  28190. "target-dir": {
  28191. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  28192. "type": "string"
  28193. },
  28194. "description": {
  28195. "type": "string"
  28196. },
  28197. "keywords": {
  28198. "type": "array",
  28199. "items": {
  28200. "type": "string"
  28201. }
  28202. },
  28203. "homepage": {
  28204. "type": "string",
  28205. "format": "uri"
  28206. },
  28207. "version": {
  28208. "type": "string"
  28209. },
  28210. "time": {
  28211. "type": "string"
  28212. },
  28213. "license": {
  28214. "type": [
  28215. "string",
  28216. "array"
  28217. ]
  28218. },
  28219. "authors": {
  28220. "$ref": "#/definitions/authors"
  28221. },
  28222. "require": {
  28223. "type": "object",
  28224. "additionalProperties": {
  28225. "type": "string"
  28226. }
  28227. },
  28228. "replace": {
  28229. "type": "object",
  28230. "additionalProperties": {
  28231. "type": "string"
  28232. }
  28233. },
  28234. "conflict": {
  28235. "type": "object",
  28236. "additionalProperties": {
  28237. "type": "string"
  28238. }
  28239. },
  28240. "provide": {
  28241. "type": "object",
  28242. "additionalProperties": {
  28243. "type": "string"
  28244. }
  28245. },
  28246. "require-dev": {
  28247. "type": "object",
  28248. "additionalProperties": {
  28249. "type": "string"
  28250. }
  28251. },
  28252. "suggest": {
  28253. "type": "object",
  28254. "additionalProperties": {
  28255. "type": "string"
  28256. }
  28257. },
  28258. "extra": {
  28259. "type": ["object", "array"],
  28260. "additionalProperties": true
  28261. },
  28262. "autoload": {
  28263. "$ref": "#/definitions/autoload"
  28264. },
  28265. "archive": {
  28266. "type": ["object"],
  28267. "properties": {
  28268. "exclude": {
  28269. "type": "array"
  28270. }
  28271. }
  28272. },
  28273. "bin": {
  28274. "type": ["string", "array"],
  28275. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  28276. "items": {
  28277. "type": "string"
  28278. }
  28279. },
  28280. "include-path": {
  28281. "type": ["array"],
  28282. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  28283. "items": {
  28284. "type": "string"
  28285. }
  28286. },
  28287. "source": {
  28288. "type": "object",
  28289. "required": ["type", "url", "reference"],
  28290. "properties": {
  28291. "type": {
  28292. "type": "string"
  28293. },
  28294. "url": {
  28295. "type": "string"
  28296. },
  28297. "reference": {
  28298. "type": "string"
  28299. },
  28300. "mirrors": {
  28301. "type": "array"
  28302. }
  28303. }
  28304. },
  28305. "dist": {
  28306. "type": "object",
  28307. "required": ["type", "url"],
  28308. "properties": {
  28309. "type": {
  28310. "type": "string"
  28311. },
  28312. "url": {
  28313. "type": "string"
  28314. },
  28315. "reference": {
  28316. "type": "string"
  28317. },
  28318. "shasum": {
  28319. "type": "string"
  28320. },
  28321. "mirrors": {
  28322. "type": "array"
  28323. }
  28324. }
  28325. }
  28326. },
  28327. "additionalProperties": true
  28328. }
  28329. }
  28330. }
  28331. {
  28332. "389-exception": [
  28333. "389 Directory Server Exception"
  28334. ],
  28335. "Autoconf-exception-2.0": [
  28336. "Autoconf exception 2.0"
  28337. ],
  28338. "Autoconf-exception-3.0": [
  28339. "Autoconf exception 3.0"
  28340. ],
  28341. "Bison-exception-2.2": [
  28342. "Bison exception 2.2"
  28343. ],
  28344. "Bootloader-exception": [
  28345. "Bootloader Distribution Exception"
  28346. ],
  28347. "Classpath-exception-2.0": [
  28348. "Classpath exception 2.0"
  28349. ],
  28350. "CLISP-exception-2.0": [
  28351. "CLISP exception 2.0"
  28352. ],
  28353. "DigiRule-FOSS-exception": [
  28354. "DigiRule FOSS License Exception"
  28355. ],
  28356. "eCos-exception-2.0": [
  28357. "eCos exception 2.0"
  28358. ],
  28359. "Fawkes-Runtime-exception": [
  28360. "Fawkes Runtime Exception"
  28361. ],
  28362. "FLTK-exception": [
  28363. "FLTK exception"
  28364. ],
  28365. "Font-exception-2.0": [
  28366. "Font exception 2.0"
  28367. ],
  28368. "freertos-exception-2.0": [
  28369. "FreeRTOS Exception 2.0"
  28370. ],
  28371. "GCC-exception-2.0": [
  28372. "GCC Runtime Library exception 2.0"
  28373. ],
  28374. "GCC-exception-3.1": [
  28375. "GCC Runtime Library exception 3.1"
  28376. ],
  28377. "gnu-javamail-exception": [
  28378. "GNU JavaMail exception"
  28379. ],
  28380. "i2p-gpl-java-exception": [
  28381. "i2p GPL+Java Exception"
  28382. ],
  28383. "Libtool-exception": [
  28384. "Libtool Exception"
  28385. ],
  28386. "Linux-syscall-note": [
  28387. "Linux Syscall Note"
  28388. ],
  28389. "LZMA-exception": [
  28390. "LZMA exception"
  28391. ],
  28392. "mif-exception": [
  28393. "Macros and Inline Functions Exception"
  28394. ],
  28395. "Nokia-Qt-exception-1.1": [
  28396. "Nokia Qt LGPL exception 1.1"
  28397. ],
  28398. "OCCT-exception-1.0": [
  28399. "Open CASCADE Exception 1.0"
  28400. ],
  28401. "openvpn-openssl-exception": [
  28402. "OpenVPN OpenSSL Exception"
  28403. ],
  28404. "Qwt-exception-1.0": [
  28405. "Qwt exception 1.0"
  28406. ],
  28407. "u-boot-exception-2.0": [
  28408. "U-Boot exception 2.0"
  28409. ],
  28410. "WxWindows-exception-3.1": [
  28411. "WxWindows Library Exception 3.1"
  28412. ]
  28413. }{
  28414. "0BSD": [
  28415. "BSD Zero Clause License",
  28416. false,
  28417. false
  28418. ],
  28419. "AAL": [
  28420. "Attribution Assurance License",
  28421. true,
  28422. false
  28423. ],
  28424. "Abstyles": [
  28425. "Abstyles License",
  28426. false,
  28427. false
  28428. ],
  28429. "Adobe-2006": [
  28430. "Adobe Systems Incorporated Source Code License Agreement",
  28431. false,
  28432. false
  28433. ],
  28434. "Adobe-Glyph": [
  28435. "Adobe Glyph List License",
  28436. false,
  28437. false
  28438. ],
  28439. "ADSL": [
  28440. "Amazon Digital Services License",
  28441. false,
  28442. false
  28443. ],
  28444. "AFL-1.1": [
  28445. "Academic Free License v1.1",
  28446. true,
  28447. false
  28448. ],
  28449. "AFL-1.2": [
  28450. "Academic Free License v1.2",
  28451. true,
  28452. false
  28453. ],
  28454. "AFL-2.0": [
  28455. "Academic Free License v2.0",
  28456. true,
  28457. false
  28458. ],
  28459. "AFL-2.1": [
  28460. "Academic Free License v2.1",
  28461. true,
  28462. false
  28463. ],
  28464. "AFL-3.0": [
  28465. "Academic Free License v3.0",
  28466. true,
  28467. false
  28468. ],
  28469. "Afmparse": [
  28470. "Afmparse License",
  28471. false,
  28472. false
  28473. ],
  28474. "AGPL-1.0": [
  28475. "Affero General Public License v1.0",
  28476. false,
  28477. false
  28478. ],
  28479. "AGPL-3.0": [
  28480. "GNU Affero General Public License v3.0",
  28481. true,
  28482. true
  28483. ],
  28484. "AGPL-3.0-only": [
  28485. "GNU Affero General Public License v3.0 only",
  28486. true,
  28487. false
  28488. ],
  28489. "AGPL-3.0-or-later": [
  28490. "GNU Affero General Public License v3.0 or later",
  28491. true,
  28492. false
  28493. ],
  28494. "Aladdin": [
  28495. "Aladdin Free Public License",
  28496. false,
  28497. false
  28498. ],
  28499. "AMDPLPA": [
  28500. "AMD's plpa_map.c License",
  28501. false,
  28502. false
  28503. ],
  28504. "AML": [
  28505. "Apple MIT License",
  28506. false,
  28507. false
  28508. ],
  28509. "AMPAS": [
  28510. "Academy of Motion Picture Arts and Sciences BSD",
  28511. false,
  28512. false
  28513. ],
  28514. "ANTLR-PD": [
  28515. "ANTLR Software Rights Notice",
  28516. false,
  28517. false
  28518. ],
  28519. "Apache-1.0": [
  28520. "Apache License 1.0",
  28521. false,
  28522. false
  28523. ],
  28524. "Apache-1.1": [
  28525. "Apache License 1.1",
  28526. true,
  28527. false
  28528. ],
  28529. "Apache-2.0": [
  28530. "Apache License 2.0",
  28531. true,
  28532. false
  28533. ],
  28534. "APAFML": [
  28535. "Adobe Postscript AFM License",
  28536. false,
  28537. false
  28538. ],
  28539. "APL-1.0": [
  28540. "Adaptive Public License 1.0",
  28541. true,
  28542. false
  28543. ],
  28544. "APSL-1.0": [
  28545. "Apple Public Source License 1.0",
  28546. true,
  28547. false
  28548. ],
  28549. "APSL-1.1": [
  28550. "Apple Public Source License 1.1",
  28551. true,
  28552. false
  28553. ],
  28554. "APSL-1.2": [
  28555. "Apple Public Source License 1.2",
  28556. true,
  28557. false
  28558. ],
  28559. "APSL-2.0": [
  28560. "Apple Public Source License 2.0",
  28561. true,
  28562. false
  28563. ],
  28564. "Artistic-1.0": [
  28565. "Artistic License 1.0",
  28566. true,
  28567. false
  28568. ],
  28569. "Artistic-1.0-cl8": [
  28570. "Artistic License 1.0 w/clause 8",
  28571. true,
  28572. false
  28573. ],
  28574. "Artistic-1.0-Perl": [
  28575. "Artistic License 1.0 (Perl)",
  28576. true,
  28577. false
  28578. ],
  28579. "Artistic-2.0": [
  28580. "Artistic License 2.0",
  28581. true,
  28582. false
  28583. ],
  28584. "Bahyph": [
  28585. "Bahyph License",
  28586. false,
  28587. false
  28588. ],
  28589. "Barr": [
  28590. "Barr License",
  28591. false,
  28592. false
  28593. ],
  28594. "Beerware": [
  28595. "Beerware License",
  28596. false,
  28597. false
  28598. ],
  28599. "BitTorrent-1.0": [
  28600. "BitTorrent Open Source License v1.0",
  28601. false,
  28602. false
  28603. ],
  28604. "BitTorrent-1.1": [
  28605. "BitTorrent Open Source License v1.1",
  28606. false,
  28607. false
  28608. ],
  28609. "Borceux": [
  28610. "Borceux license",
  28611. false,
  28612. false
  28613. ],
  28614. "BSD-1-Clause": [
  28615. "BSD 1-Clause License",
  28616. false,
  28617. false
  28618. ],
  28619. "BSD-2-Clause": [
  28620. "BSD 2-Clause \"Simplified\" License",
  28621. true,
  28622. false
  28623. ],
  28624. "BSD-2-Clause-FreeBSD": [
  28625. "BSD 2-Clause FreeBSD License",
  28626. false,
  28627. false
  28628. ],
  28629. "BSD-2-Clause-NetBSD": [
  28630. "BSD 2-Clause NetBSD License",
  28631. false,
  28632. false
  28633. ],
  28634. "BSD-2-Clause-Patent": [
  28635. "BSD-2-Clause Plus Patent License",
  28636. true,
  28637. false
  28638. ],
  28639. "BSD-3-Clause": [
  28640. "BSD 3-Clause \"New\" or \"Revised\" License",
  28641. true,
  28642. false
  28643. ],
  28644. "BSD-3-Clause-Attribution": [
  28645. "BSD with attribution",
  28646. false,
  28647. false
  28648. ],
  28649. "BSD-3-Clause-Clear": [
  28650. "BSD 3-Clause Clear License",
  28651. false,
  28652. false
  28653. ],
  28654. "BSD-3-Clause-LBNL": [
  28655. "Lawrence Berkeley National Labs BSD variant license",
  28656. false,
  28657. false
  28658. ],
  28659. "BSD-3-Clause-No-Nuclear-License": [
  28660. "BSD 3-Clause No Nuclear License",
  28661. false,
  28662. false
  28663. ],
  28664. "BSD-3-Clause-No-Nuclear-License-2014": [
  28665. "BSD 3-Clause No Nuclear License 2014",
  28666. false,
  28667. false
  28668. ],
  28669. "BSD-3-Clause-No-Nuclear-Warranty": [
  28670. "BSD 3-Clause No Nuclear Warranty",
  28671. false,
  28672. false
  28673. ],
  28674. "BSD-4-Clause": [
  28675. "BSD 4-Clause \"Original\" or \"Old\" License",
  28676. false,
  28677. false
  28678. ],
  28679. "BSD-4-Clause-UC": [
  28680. "BSD-4-Clause (University of California-Specific)",
  28681. false,
  28682. false
  28683. ],
  28684. "BSD-Protection": [
  28685. "BSD Protection License",
  28686. false,
  28687. false
  28688. ],
  28689. "BSD-Source-Code": [
  28690. "BSD Source Code Attribution",
  28691. false,
  28692. false
  28693. ],
  28694. "BSL-1.0": [
  28695. "Boost Software License 1.0",
  28696. true,
  28697. false
  28698. ],
  28699. "bzip2-1.0.5": [
  28700. "bzip2 and libbzip2 License v1.0.5",
  28701. false,
  28702. false
  28703. ],
  28704. "bzip2-1.0.6": [
  28705. "bzip2 and libbzip2 License v1.0.6",
  28706. false,
  28707. false
  28708. ],
  28709. "Caldera": [
  28710. "Caldera License",
  28711. false,
  28712. false
  28713. ],
  28714. "CATOSL-1.1": [
  28715. "Computer Associates Trusted Open Source License 1.1",
  28716. true,
  28717. false
  28718. ],
  28719. "CC-BY-1.0": [
  28720. "Creative Commons Attribution 1.0",
  28721. false,
  28722. false
  28723. ],
  28724. "CC-BY-2.0": [
  28725. "Creative Commons Attribution 2.0",
  28726. false,
  28727. false
  28728. ],
  28729. "CC-BY-2.5": [
  28730. "Creative Commons Attribution 2.5",
  28731. false,
  28732. false
  28733. ],
  28734. "CC-BY-3.0": [
  28735. "Creative Commons Attribution 3.0",
  28736. false,
  28737. false
  28738. ],
  28739. "CC-BY-4.0": [
  28740. "Creative Commons Attribution 4.0",
  28741. false,
  28742. false
  28743. ],
  28744. "CC-BY-NC-1.0": [
  28745. "Creative Commons Attribution Non Commercial 1.0",
  28746. false,
  28747. false
  28748. ],
  28749. "CC-BY-NC-2.0": [
  28750. "Creative Commons Attribution Non Commercial 2.0",
  28751. false,
  28752. false
  28753. ],
  28754. "CC-BY-NC-2.5": [
  28755. "Creative Commons Attribution Non Commercial 2.5",
  28756. false,
  28757. false
  28758. ],
  28759. "CC-BY-NC-3.0": [
  28760. "Creative Commons Attribution Non Commercial 3.0",
  28761. false,
  28762. false
  28763. ],
  28764. "CC-BY-NC-4.0": [
  28765. "Creative Commons Attribution Non Commercial 4.0",
  28766. false,
  28767. false
  28768. ],
  28769. "CC-BY-NC-ND-1.0": [
  28770. "Creative Commons Attribution Non Commercial No Derivatives 1.0",
  28771. false,
  28772. false
  28773. ],
  28774. "CC-BY-NC-ND-2.0": [
  28775. "Creative Commons Attribution Non Commercial No Derivatives 2.0",
  28776. false,
  28777. false
  28778. ],
  28779. "CC-BY-NC-ND-2.5": [
  28780. "Creative Commons Attribution Non Commercial No Derivatives 2.5",
  28781. false,
  28782. false
  28783. ],
  28784. "CC-BY-NC-ND-3.0": [
  28785. "Creative Commons Attribution Non Commercial No Derivatives 3.0",
  28786. false,
  28787. false
  28788. ],
  28789. "CC-BY-NC-ND-4.0": [
  28790. "Creative Commons Attribution Non Commercial No Derivatives 4.0",
  28791. false,
  28792. false
  28793. ],
  28794. "CC-BY-NC-SA-1.0": [
  28795. "Creative Commons Attribution Non Commercial Share Alike 1.0",
  28796. false,
  28797. false
  28798. ],
  28799. "CC-BY-NC-SA-2.0": [
  28800. "Creative Commons Attribution Non Commercial Share Alike 2.0",
  28801. false,
  28802. false
  28803. ],
  28804. "CC-BY-NC-SA-2.5": [
  28805. "Creative Commons Attribution Non Commercial Share Alike 2.5",
  28806. false,
  28807. false
  28808. ],
  28809. "CC-BY-NC-SA-3.0": [
  28810. "Creative Commons Attribution Non Commercial Share Alike 3.0",
  28811. false,
  28812. false
  28813. ],
  28814. "CC-BY-NC-SA-4.0": [
  28815. "Creative Commons Attribution Non Commercial Share Alike 4.0",
  28816. false,
  28817. false
  28818. ],
  28819. "CC-BY-ND-1.0": [
  28820. "Creative Commons Attribution No Derivatives 1.0",
  28821. false,
  28822. false
  28823. ],
  28824. "CC-BY-ND-2.0": [
  28825. "Creative Commons Attribution No Derivatives 2.0",
  28826. false,
  28827. false
  28828. ],
  28829. "CC-BY-ND-2.5": [
  28830. "Creative Commons Attribution No Derivatives 2.5",
  28831. false,
  28832. false
  28833. ],
  28834. "CC-BY-ND-3.0": [
  28835. "Creative Commons Attribution No Derivatives 3.0",
  28836. false,
  28837. false
  28838. ],
  28839. "CC-BY-ND-4.0": [
  28840. "Creative Commons Attribution No Derivatives 4.0",
  28841. false,
  28842. false
  28843. ],
  28844. "CC-BY-SA-1.0": [
  28845. "Creative Commons Attribution Share Alike 1.0",
  28846. false,
  28847. false
  28848. ],
  28849. "CC-BY-SA-2.0": [
  28850. "Creative Commons Attribution Share Alike 2.0",
  28851. false,
  28852. false
  28853. ],
  28854. "CC-BY-SA-2.5": [
  28855. "Creative Commons Attribution Share Alike 2.5",
  28856. false,
  28857. false
  28858. ],
  28859. "CC-BY-SA-3.0": [
  28860. "Creative Commons Attribution Share Alike 3.0",
  28861. false,
  28862. false
  28863. ],
  28864. "CC-BY-SA-4.0": [
  28865. "Creative Commons Attribution Share Alike 4.0",
  28866. false,
  28867. false
  28868. ],
  28869. "CC0-1.0": [
  28870. "Creative Commons Zero v1.0 Universal",
  28871. false,
  28872. false
  28873. ],
  28874. "CDDL-1.0": [
  28875. "Common Development and Distribution License 1.0",
  28876. true,
  28877. false
  28878. ],
  28879. "CDDL-1.1": [
  28880. "Common Development and Distribution License 1.1",
  28881. false,
  28882. false
  28883. ],
  28884. "CDLA-Permissive-1.0": [
  28885. "Community Data License Agreement Permissive 1.0",
  28886. false,
  28887. false
  28888. ],
  28889. "CDLA-Sharing-1.0": [
  28890. "Community Data License Agreement Sharing 1.0",
  28891. false,
  28892. false
  28893. ],
  28894. "CECILL-1.0": [
  28895. "CeCILL Free Software License Agreement v1.0",
  28896. false,
  28897. false
  28898. ],
  28899. "CECILL-1.1": [
  28900. "CeCILL Free Software License Agreement v1.1",
  28901. false,
  28902. false
  28903. ],
  28904. "CECILL-2.0": [
  28905. "CeCILL Free Software License Agreement v2.0",
  28906. false,
  28907. false
  28908. ],
  28909. "CECILL-2.1": [
  28910. "CeCILL Free Software License Agreement v2.1",
  28911. true,
  28912. false
  28913. ],
  28914. "CECILL-B": [
  28915. "CeCILL-B Free Software License Agreement",
  28916. false,
  28917. false
  28918. ],
  28919. "CECILL-C": [
  28920. "CeCILL-C Free Software License Agreement",
  28921. false,
  28922. false
  28923. ],
  28924. "ClArtistic": [
  28925. "Clarified Artistic License",
  28926. false,
  28927. false
  28928. ],
  28929. "CNRI-Jython": [
  28930. "CNRI Jython License",
  28931. false,
  28932. false
  28933. ],
  28934. "CNRI-Python": [
  28935. "CNRI Python License",
  28936. true,
  28937. false
  28938. ],
  28939. "CNRI-Python-GPL-Compatible": [
  28940. "CNRI Python Open Source GPL Compatible License Agreement",
  28941. false,
  28942. false
  28943. ],
  28944. "Condor-1.1": [
  28945. "Condor Public License v1.1",
  28946. false,
  28947. false
  28948. ],
  28949. "CPAL-1.0": [
  28950. "Common Public Attribution License 1.0",
  28951. true,
  28952. false
  28953. ],
  28954. "CPL-1.0": [
  28955. "Common Public License 1.0",
  28956. true,
  28957. false
  28958. ],
  28959. "CPOL-1.02": [
  28960. "Code Project Open License 1.02",
  28961. false,
  28962. false
  28963. ],
  28964. "Crossword": [
  28965. "Crossword License",
  28966. false,
  28967. false
  28968. ],
  28969. "CrystalStacker": [
  28970. "CrystalStacker License",
  28971. false,
  28972. false
  28973. ],
  28974. "CUA-OPL-1.0": [
  28975. "CUA Office Public License v1.0",
  28976. true,
  28977. false
  28978. ],
  28979. "Cube": [
  28980. "Cube License",
  28981. false,
  28982. false
  28983. ],
  28984. "curl": [
  28985. "curl License",
  28986. false,
  28987. false
  28988. ],
  28989. "D-FSL-1.0": [
  28990. "Deutsche Freie Software Lizenz",
  28991. false,
  28992. false
  28993. ],
  28994. "diffmark": [
  28995. "diffmark license",
  28996. false,
  28997. false
  28998. ],
  28999. "DOC": [
  29000. "DOC License",
  29001. false,
  29002. false
  29003. ],
  29004. "Dotseqn": [
  29005. "Dotseqn License",
  29006. false,
  29007. false
  29008. ],
  29009. "DSDP": [
  29010. "DSDP License",
  29011. false,
  29012. false
  29013. ],
  29014. "dvipdfm": [
  29015. "dvipdfm License",
  29016. false,
  29017. false
  29018. ],
  29019. "ECL-1.0": [
  29020. "Educational Community License v1.0",
  29021. true,
  29022. false
  29023. ],
  29024. "ECL-2.0": [
  29025. "Educational Community License v2.0",
  29026. true,
  29027. false
  29028. ],
  29029. "eCos-2.0": [
  29030. "eCos license version 2.0",
  29031. false,
  29032. true
  29033. ],
  29034. "EFL-1.0": [
  29035. "Eiffel Forum License v1.0",
  29036. true,
  29037. false
  29038. ],
  29039. "EFL-2.0": [
  29040. "Eiffel Forum License v2.0",
  29041. true,
  29042. false
  29043. ],
  29044. "eGenix": [
  29045. "eGenix.com Public License 1.1.0",
  29046. false,
  29047. false
  29048. ],
  29049. "Entessa": [
  29050. "Entessa Public License v1.0",
  29051. true,
  29052. false
  29053. ],
  29054. "EPL-1.0": [
  29055. "Eclipse Public License 1.0",
  29056. true,
  29057. false
  29058. ],
  29059. "EPL-2.0": [
  29060. "Eclipse Public License 2.0",
  29061. true,
  29062. false
  29063. ],
  29064. "ErlPL-1.1": [
  29065. "Erlang Public License v1.1",
  29066. false,
  29067. false
  29068. ],
  29069. "EUDatagrid": [
  29070. "EU DataGrid Software License",
  29071. true,
  29072. false
  29073. ],
  29074. "EUPL-1.0": [
  29075. "European Union Public License 1.0",
  29076. false,
  29077. false
  29078. ],
  29079. "EUPL-1.1": [
  29080. "European Union Public License 1.1",
  29081. true,
  29082. false
  29083. ],
  29084. "EUPL-1.2": [
  29085. "European Union Public License 1.2",
  29086. true,
  29087. false
  29088. ],
  29089. "Eurosym": [
  29090. "Eurosym License",
  29091. false,
  29092. false
  29093. ],
  29094. "Fair": [
  29095. "Fair License",
  29096. true,
  29097. false
  29098. ],
  29099. "Frameworx-1.0": [
  29100. "Frameworx Open License 1.0",
  29101. true,
  29102. false
  29103. ],
  29104. "FreeImage": [
  29105. "FreeImage Public License v1.0",
  29106. false,
  29107. false
  29108. ],
  29109. "FSFAP": [
  29110. "FSF All Permissive License",
  29111. false,
  29112. false
  29113. ],
  29114. "FSFUL": [
  29115. "FSF Unlimited License",
  29116. false,
  29117. false
  29118. ],
  29119. "FSFULLR": [
  29120. "FSF Unlimited License (with License Retention)",
  29121. false,
  29122. false
  29123. ],
  29124. "FTL": [
  29125. "Freetype Project License",
  29126. false,
  29127. false
  29128. ],
  29129. "GFDL-1.1": [
  29130. "GNU Free Documentation License v1.1",
  29131. false,
  29132. true
  29133. ],
  29134. "GFDL-1.1-only": [
  29135. "GNU Free Documentation License v1.1 only",
  29136. false,
  29137. false
  29138. ],
  29139. "GFDL-1.1-or-later": [
  29140. "GNU Free Documentation License v1.1 or later",
  29141. false,
  29142. false
  29143. ],
  29144. "GFDL-1.2": [
  29145. "GNU Free Documentation License v1.2",
  29146. false,
  29147. true
  29148. ],
  29149. "GFDL-1.2-only": [
  29150. "GNU Free Documentation License v1.2 only",
  29151. false,
  29152. false
  29153. ],
  29154. "GFDL-1.2-or-later": [
  29155. "GNU Free Documentation License v1.2 or later",
  29156. false,
  29157. false
  29158. ],
  29159. "GFDL-1.3": [
  29160. "GNU Free Documentation License v1.3",
  29161. false,
  29162. true
  29163. ],
  29164. "GFDL-1.3-only": [
  29165. "GNU Free Documentation License v1.3 only",
  29166. false,
  29167. false
  29168. ],
  29169. "GFDL-1.3-or-later": [
  29170. "GNU Free Documentation License v1.3 or later",
  29171. false,
  29172. false
  29173. ],
  29174. "Giftware": [
  29175. "Giftware License",
  29176. false,
  29177. false
  29178. ],
  29179. "GL2PS": [
  29180. "GL2PS License",
  29181. false,
  29182. false
  29183. ],
  29184. "Glide": [
  29185. "3dfx Glide License",
  29186. false,
  29187. false
  29188. ],
  29189. "Glulxe": [
  29190. "Glulxe License",
  29191. false,
  29192. false
  29193. ],
  29194. "gnuplot": [
  29195. "gnuplot License",
  29196. false,
  29197. false
  29198. ],
  29199. "GPL-1.0": [
  29200. "GNU General Public License v1.0 only",
  29201. false,
  29202. true
  29203. ],
  29204. "GPL-1.0+": [
  29205. "GNU General Public License v1.0 or later",
  29206. false,
  29207. true
  29208. ],
  29209. "GPL-1.0-only": [
  29210. "GNU General Public License v1.0 only",
  29211. false,
  29212. false
  29213. ],
  29214. "GPL-1.0-or-later": [
  29215. "GNU General Public License v1.0 or later",
  29216. false,
  29217. false
  29218. ],
  29219. "GPL-2.0": [
  29220. "GNU General Public License v2.0 only",
  29221. true,
  29222. true
  29223. ],
  29224. "GPL-2.0+": [
  29225. "GNU General Public License v2.0 or later",
  29226. true,
  29227. true
  29228. ],
  29229. "GPL-2.0-only": [
  29230. "GNU General Public License v2.0 only",
  29231. true,
  29232. false
  29233. ],
  29234. "GPL-2.0-or-later": [
  29235. "GNU General Public License v2.0 or later",
  29236. true,
  29237. false
  29238. ],
  29239. "GPL-2.0-with-autoconf-exception": [
  29240. "GNU General Public License v2.0 w/Autoconf exception",
  29241. false,
  29242. true
  29243. ],
  29244. "GPL-2.0-with-bison-exception": [
  29245. "GNU General Public License v2.0 w/Bison exception",
  29246. false,
  29247. true
  29248. ],
  29249. "GPL-2.0-with-classpath-exception": [
  29250. "GNU General Public License v2.0 w/Classpath exception",
  29251. false,
  29252. true
  29253. ],
  29254. "GPL-2.0-with-font-exception": [
  29255. "GNU General Public License v2.0 w/Font exception",
  29256. false,
  29257. true
  29258. ],
  29259. "GPL-2.0-with-GCC-exception": [
  29260. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  29261. false,
  29262. true
  29263. ],
  29264. "GPL-3.0": [
  29265. "GNU General Public License v3.0 only",
  29266. true,
  29267. true
  29268. ],
  29269. "GPL-3.0+": [
  29270. "GNU General Public License v3.0 or later",
  29271. true,
  29272. true
  29273. ],
  29274. "GPL-3.0-only": [
  29275. "GNU General Public License v3.0 only",
  29276. true,
  29277. false
  29278. ],
  29279. "GPL-3.0-or-later": [
  29280. "GNU General Public License v3.0 or later",
  29281. true,
  29282. false
  29283. ],
  29284. "GPL-3.0-with-autoconf-exception": [
  29285. "GNU General Public License v3.0 w/Autoconf exception",
  29286. false,
  29287. true
  29288. ],
  29289. "GPL-3.0-with-GCC-exception": [
  29290. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  29291. true,
  29292. true
  29293. ],
  29294. "gSOAP-1.3b": [
  29295. "gSOAP Public License v1.3b",
  29296. false,
  29297. false
  29298. ],
  29299. "HaskellReport": [
  29300. "Haskell Language Report License",
  29301. false,
  29302. false
  29303. ],
  29304. "HPND": [
  29305. "Historical Permission Notice and Disclaimer",
  29306. true,
  29307. false
  29308. ],
  29309. "IBM-pibs": [
  29310. "IBM PowerPC Initialization and Boot Software",
  29311. false,
  29312. false
  29313. ],
  29314. "ICU": [
  29315. "ICU License",
  29316. false,
  29317. false
  29318. ],
  29319. "IJG": [
  29320. "Independent JPEG Group License",
  29321. false,
  29322. false
  29323. ],
  29324. "ImageMagick": [
  29325. "ImageMagick License",
  29326. false,
  29327. false
  29328. ],
  29329. "iMatix": [
  29330. "iMatix Standard Function Library Agreement",
  29331. false,
  29332. false
  29333. ],
  29334. "Imlib2": [
  29335. "Imlib2 License",
  29336. false,
  29337. false
  29338. ],
  29339. "Info-ZIP": [
  29340. "Info-ZIP License",
  29341. false,
  29342. false
  29343. ],
  29344. "Intel": [
  29345. "Intel Open Source License",
  29346. true,
  29347. false
  29348. ],
  29349. "Intel-ACPI": [
  29350. "Intel ACPI Software License Agreement",
  29351. false,
  29352. false
  29353. ],
  29354. "Interbase-1.0": [
  29355. "Interbase Public License v1.0",
  29356. false,
  29357. false
  29358. ],
  29359. "IPA": [
  29360. "IPA Font License",
  29361. true,
  29362. false
  29363. ],
  29364. "IPL-1.0": [
  29365. "IBM Public License v1.0",
  29366. true,
  29367. false
  29368. ],
  29369. "ISC": [
  29370. "ISC License",
  29371. true,
  29372. false
  29373. ],
  29374. "JasPer-2.0": [
  29375. "JasPer License",
  29376. false,
  29377. false
  29378. ],
  29379. "JSON": [
  29380. "JSON License",
  29381. false,
  29382. false
  29383. ],
  29384. "LAL-1.2": [
  29385. "Licence Art Libre 1.2",
  29386. false,
  29387. false
  29388. ],
  29389. "LAL-1.3": [
  29390. "Licence Art Libre 1.3",
  29391. false,
  29392. false
  29393. ],
  29394. "Latex2e": [
  29395. "Latex2e License",
  29396. false,
  29397. false
  29398. ],
  29399. "Leptonica": [
  29400. "Leptonica License",
  29401. false,
  29402. false
  29403. ],
  29404. "LGPL-2.0": [
  29405. "GNU Library General Public License v2 only",
  29406. true,
  29407. true
  29408. ],
  29409. "LGPL-2.0+": [
  29410. "GNU Library General Public License v2 or later",
  29411. true,
  29412. true
  29413. ],
  29414. "LGPL-2.0-only": [
  29415. "GNU Library General Public License v2 only",
  29416. true,
  29417. false
  29418. ],
  29419. "LGPL-2.0-or-later": [
  29420. "GNU Library General Public License v2 or later",
  29421. true,
  29422. false
  29423. ],
  29424. "LGPL-2.1": [
  29425. "GNU Lesser General Public License v2.1 only",
  29426. true,
  29427. true
  29428. ],
  29429. "LGPL-2.1+": [
  29430. "GNU Library General Public License v2 or later",
  29431. true,
  29432. true
  29433. ],
  29434. "LGPL-2.1-only": [
  29435. "GNU Lesser General Public License v2.1 only",
  29436. true,
  29437. false
  29438. ],
  29439. "LGPL-2.1-or-later": [
  29440. "GNU Lesser General Public License v2.1 or later",
  29441. true,
  29442. false
  29443. ],
  29444. "LGPL-3.0": [
  29445. "GNU Lesser General Public License v3.0 only",
  29446. true,
  29447. true
  29448. ],
  29449. "LGPL-3.0+": [
  29450. "GNU Lesser General Public License v3.0 or later",
  29451. true,
  29452. true
  29453. ],
  29454. "LGPL-3.0-only": [
  29455. "GNU Lesser General Public License v3.0 only",
  29456. true,
  29457. false
  29458. ],
  29459. "LGPL-3.0-or-later": [
  29460. "GNU Lesser General Public License v3.0 or later",
  29461. true,
  29462. false
  29463. ],
  29464. "LGPLLR": [
  29465. "Lesser General Public License For Linguistic Resources",
  29466. false,
  29467. false
  29468. ],
  29469. "Libpng": [
  29470. "libpng License",
  29471. false,
  29472. false
  29473. ],
  29474. "libtiff": [
  29475. "libtiff License",
  29476. false,
  29477. false
  29478. ],
  29479. "LiLiQ-P-1.1": [
  29480. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  29481. true,
  29482. false
  29483. ],
  29484. "LiLiQ-R-1.1": [
  29485. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  29486. true,
  29487. false
  29488. ],
  29489. "LiLiQ-Rplus-1.1": [
  29490. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  29491. true,
  29492. false
  29493. ],
  29494. "LPL-1.0": [
  29495. "Lucent Public License Version 1.0",
  29496. true,
  29497. false
  29498. ],
  29499. "LPL-1.02": [
  29500. "Lucent Public License v1.02",
  29501. true,
  29502. false
  29503. ],
  29504. "LPPL-1.0": [
  29505. "LaTeX Project Public License v1.0",
  29506. false,
  29507. false
  29508. ],
  29509. "LPPL-1.1": [
  29510. "LaTeX Project Public License v1.1",
  29511. false,
  29512. false
  29513. ],
  29514. "LPPL-1.2": [
  29515. "LaTeX Project Public License v1.2",
  29516. false,
  29517. false
  29518. ],
  29519. "LPPL-1.3a": [
  29520. "LaTeX Project Public License v1.3a",
  29521. false,
  29522. false
  29523. ],
  29524. "LPPL-1.3c": [
  29525. "LaTeX Project Public License v1.3c",
  29526. true,
  29527. false
  29528. ],
  29529. "MakeIndex": [
  29530. "MakeIndex License",
  29531. false,
  29532. false
  29533. ],
  29534. "MirOS": [
  29535. "MirOS License",
  29536. true,
  29537. false
  29538. ],
  29539. "MIT": [
  29540. "MIT License",
  29541. true,
  29542. false
  29543. ],
  29544. "MIT-advertising": [
  29545. "Enlightenment License (e16)",
  29546. false,
  29547. false
  29548. ],
  29549. "MIT-CMU": [
  29550. "CMU License",
  29551. false,
  29552. false
  29553. ],
  29554. "MIT-enna": [
  29555. "enna License",
  29556. false,
  29557. false
  29558. ],
  29559. "MIT-feh": [
  29560. "feh License",
  29561. false,
  29562. false
  29563. ],
  29564. "MITNFA": [
  29565. "MIT +no-false-attribs license",
  29566. false,
  29567. false
  29568. ],
  29569. "Motosoto": [
  29570. "Motosoto License",
  29571. true,
  29572. false
  29573. ],
  29574. "mpich2": [
  29575. "mpich2 License",
  29576. false,
  29577. false
  29578. ],
  29579. "MPL-1.0": [
  29580. "Mozilla Public License 1.0",
  29581. true,
  29582. false
  29583. ],
  29584. "MPL-1.1": [
  29585. "Mozilla Public License 1.1",
  29586. true,
  29587. false
  29588. ],
  29589. "MPL-2.0": [
  29590. "Mozilla Public License 2.0",
  29591. true,
  29592. false
  29593. ],
  29594. "MPL-2.0-no-copyleft-exception": [
  29595. "Mozilla Public License 2.0 (no copyleft exception)",
  29596. true,
  29597. false
  29598. ],
  29599. "MS-PL": [
  29600. "Microsoft Public License",
  29601. true,
  29602. false
  29603. ],
  29604. "MS-RL": [
  29605. "Microsoft Reciprocal License",
  29606. true,
  29607. false
  29608. ],
  29609. "MTLL": [
  29610. "Matrix Template Library License",
  29611. false,
  29612. false
  29613. ],
  29614. "Multics": [
  29615. "Multics License",
  29616. true,
  29617. false
  29618. ],
  29619. "Mup": [
  29620. "Mup License",
  29621. false,
  29622. false
  29623. ],
  29624. "NASA-1.3": [
  29625. "NASA Open Source Agreement 1.3",
  29626. true,
  29627. false
  29628. ],
  29629. "Naumen": [
  29630. "Naumen Public License",
  29631. true,
  29632. false
  29633. ],
  29634. "NBPL-1.0": [
  29635. "Net Boolean Public License v1",
  29636. false,
  29637. false
  29638. ],
  29639. "NCSA": [
  29640. "University of Illinois/NCSA Open Source License",
  29641. true,
  29642. false
  29643. ],
  29644. "Net-SNMP": [
  29645. "Net-SNMP License",
  29646. false,
  29647. false
  29648. ],
  29649. "NetCDF": [
  29650. "NetCDF license",
  29651. false,
  29652. false
  29653. ],
  29654. "Newsletr": [
  29655. "Newsletr License",
  29656. false,
  29657. false
  29658. ],
  29659. "NGPL": [
  29660. "Nethack General Public License",
  29661. true,
  29662. false
  29663. ],
  29664. "NLOD-1.0": [
  29665. "Norwegian Licence for Open Government Data",
  29666. false,
  29667. false
  29668. ],
  29669. "NLPL": [
  29670. "No Limit Public License",
  29671. false,
  29672. false
  29673. ],
  29674. "Nokia": [
  29675. "Nokia Open Source License",
  29676. true,
  29677. false
  29678. ],
  29679. "NOSL": [
  29680. "Netizen Open Source License",
  29681. false,
  29682. false
  29683. ],
  29684. "Noweb": [
  29685. "Noweb License",
  29686. false,
  29687. false
  29688. ],
  29689. "NPL-1.0": [
  29690. "Netscape Public License v1.0",
  29691. false,
  29692. false
  29693. ],
  29694. "NPL-1.1": [
  29695. "Netscape Public License v1.1",
  29696. false,
  29697. false
  29698. ],
  29699. "NPOSL-3.0": [
  29700. "Non-Profit Open Software License 3.0",
  29701. true,
  29702. false
  29703. ],
  29704. "NRL": [
  29705. "NRL License",
  29706. false,
  29707. false
  29708. ],
  29709. "NTP": [
  29710. "NTP License",
  29711. true,
  29712. false
  29713. ],
  29714. "Nunit": [
  29715. "Nunit License",
  29716. false,
  29717. true
  29718. ],
  29719. "OCCT-PL": [
  29720. "Open CASCADE Technology Public License",
  29721. false,
  29722. false
  29723. ],
  29724. "OCLC-2.0": [
  29725. "OCLC Research Public License 2.0",
  29726. true,
  29727. false
  29728. ],
  29729. "ODbL-1.0": [
  29730. "ODC Open Database License v1.0",
  29731. false,
  29732. false
  29733. ],
  29734. "OFL-1.0": [
  29735. "SIL Open Font License 1.0",
  29736. false,
  29737. false
  29738. ],
  29739. "OFL-1.1": [
  29740. "SIL Open Font License 1.1",
  29741. true,
  29742. false
  29743. ],
  29744. "OGTSL": [
  29745. "Open Group Test Suite License",
  29746. true,
  29747. false
  29748. ],
  29749. "OLDAP-1.1": [
  29750. "Open LDAP Public License v1.1",
  29751. false,
  29752. false
  29753. ],
  29754. "OLDAP-1.2": [
  29755. "Open LDAP Public License v1.2",
  29756. false,
  29757. false
  29758. ],
  29759. "OLDAP-1.3": [
  29760. "Open LDAP Public License v1.3",
  29761. false,
  29762. false
  29763. ],
  29764. "OLDAP-1.4": [
  29765. "Open LDAP Public License v1.4",
  29766. false,
  29767. false
  29768. ],
  29769. "OLDAP-2.0": [
  29770. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  29771. false,
  29772. false
  29773. ],
  29774. "OLDAP-2.0.1": [
  29775. "Open LDAP Public License v2.0.1",
  29776. false,
  29777. false
  29778. ],
  29779. "OLDAP-2.1": [
  29780. "Open LDAP Public License v2.1",
  29781. false,
  29782. false
  29783. ],
  29784. "OLDAP-2.2": [
  29785. "Open LDAP Public License v2.2",
  29786. false,
  29787. false
  29788. ],
  29789. "OLDAP-2.2.1": [
  29790. "Open LDAP Public License v2.2.1",
  29791. false,
  29792. false
  29793. ],
  29794. "OLDAP-2.2.2": [
  29795. "Open LDAP Public License 2.2.2",
  29796. false,
  29797. false
  29798. ],
  29799. "OLDAP-2.3": [
  29800. "Open LDAP Public License v2.3",
  29801. false,
  29802. false
  29803. ],
  29804. "OLDAP-2.4": [
  29805. "Open LDAP Public License v2.4",
  29806. false,
  29807. false
  29808. ],
  29809. "OLDAP-2.5": [
  29810. "Open LDAP Public License v2.5",
  29811. false,
  29812. false
  29813. ],
  29814. "OLDAP-2.6": [
  29815. "Open LDAP Public License v2.6",
  29816. false,
  29817. false
  29818. ],
  29819. "OLDAP-2.7": [
  29820. "Open LDAP Public License v2.7",
  29821. false,
  29822. false
  29823. ],
  29824. "OLDAP-2.8": [
  29825. "Open LDAP Public License v2.8",
  29826. false,
  29827. false
  29828. ],
  29829. "OML": [
  29830. "Open Market License",
  29831. false,
  29832. false
  29833. ],
  29834. "OpenSSL": [
  29835. "OpenSSL License",
  29836. false,
  29837. false
  29838. ],
  29839. "OPL-1.0": [
  29840. "Open Public License v1.0",
  29841. false,
  29842. false
  29843. ],
  29844. "OSET-PL-2.1": [
  29845. "OSET Public License version 2.1",
  29846. true,
  29847. false
  29848. ],
  29849. "OSL-1.0": [
  29850. "Open Software License 1.0",
  29851. true,
  29852. false
  29853. ],
  29854. "OSL-1.1": [
  29855. "Open Software License 1.1",
  29856. false,
  29857. false
  29858. ],
  29859. "OSL-2.0": [
  29860. "Open Software License 2.0",
  29861. true,
  29862. false
  29863. ],
  29864. "OSL-2.1": [
  29865. "Open Software License 2.1",
  29866. true,
  29867. false
  29868. ],
  29869. "OSL-3.0": [
  29870. "Open Software License 3.0",
  29871. true,
  29872. false
  29873. ],
  29874. "PDDL-1.0": [
  29875. "ODC Public Domain Dedication & License 1.0",
  29876. false,
  29877. false
  29878. ],
  29879. "PHP-3.0": [
  29880. "PHP License v3.0",
  29881. true,
  29882. false
  29883. ],
  29884. "PHP-3.01": [
  29885. "PHP License v3.01",
  29886. false,
  29887. false
  29888. ],
  29889. "Plexus": [
  29890. "Plexus Classworlds License",
  29891. false,
  29892. false
  29893. ],
  29894. "PostgreSQL": [
  29895. "PostgreSQL License",
  29896. true,
  29897. false
  29898. ],
  29899. "psfrag": [
  29900. "psfrag License",
  29901. false,
  29902. false
  29903. ],
  29904. "psutils": [
  29905. "psutils License",
  29906. false,
  29907. false
  29908. ],
  29909. "Python-2.0": [
  29910. "Python License 2.0",
  29911. true,
  29912. false
  29913. ],
  29914. "Qhull": [
  29915. "Qhull License",
  29916. false,
  29917. false
  29918. ],
  29919. "QPL-1.0": [
  29920. "Q Public License 1.0",
  29921. true,
  29922. false
  29923. ],
  29924. "Rdisc": [
  29925. "Rdisc License",
  29926. false,
  29927. false
  29928. ],
  29929. "RHeCos-1.1": [
  29930. "Red Hat eCos Public License v1.1",
  29931. false,
  29932. false
  29933. ],
  29934. "RPL-1.1": [
  29935. "Reciprocal Public License 1.1",
  29936. true,
  29937. false
  29938. ],
  29939. "RPL-1.5": [
  29940. "Reciprocal Public License 1.5",
  29941. true,
  29942. false
  29943. ],
  29944. "RPSL-1.0": [
  29945. "RealNetworks Public Source License v1.0",
  29946. true,
  29947. false
  29948. ],
  29949. "RSA-MD": [
  29950. "RSA Message-Digest License",
  29951. false,
  29952. false
  29953. ],
  29954. "RSCPL": [
  29955. "Ricoh Source Code Public License",
  29956. true,
  29957. false
  29958. ],
  29959. "Ruby": [
  29960. "Ruby License",
  29961. false,
  29962. false
  29963. ],
  29964. "SAX-PD": [
  29965. "Sax Public Domain Notice",
  29966. false,
  29967. false
  29968. ],
  29969. "Saxpath": [
  29970. "Saxpath License",
  29971. false,
  29972. false
  29973. ],
  29974. "SCEA": [
  29975. "SCEA Shared Source License",
  29976. false,
  29977. false
  29978. ],
  29979. "Sendmail": [
  29980. "Sendmail License",
  29981. false,
  29982. false
  29983. ],
  29984. "SGI-B-1.0": [
  29985. "SGI Free Software License B v1.0",
  29986. false,
  29987. false
  29988. ],
  29989. "SGI-B-1.1": [
  29990. "SGI Free Software License B v1.1",
  29991. false,
  29992. false
  29993. ],
  29994. "SGI-B-2.0": [
  29995. "SGI Free Software License B v2.0",
  29996. false,
  29997. false
  29998. ],
  29999. "SimPL-2.0": [
  30000. "Simple Public License 2.0",
  30001. true,
  30002. false
  30003. ],
  30004. "SISSL": [
  30005. "Sun Industry Standards Source License v1.1",
  30006. true,
  30007. false
  30008. ],
  30009. "SISSL-1.2": [
  30010. "Sun Industry Standards Source License v1.2",
  30011. false,
  30012. false
  30013. ],
  30014. "Sleepycat": [
  30015. "Sleepycat License",
  30016. true,
  30017. false
  30018. ],
  30019. "SMLNJ": [
  30020. "Standard ML of New Jersey License",
  30021. false,
  30022. false
  30023. ],
  30024. "SMPPL": [
  30025. "Secure Messaging Protocol Public License",
  30026. false,
  30027. false
  30028. ],
  30029. "SNIA": [
  30030. "SNIA Public License 1.1",
  30031. false,
  30032. false
  30033. ],
  30034. "Spencer-86": [
  30035. "Spencer License 86",
  30036. false,
  30037. false
  30038. ],
  30039. "Spencer-94": [
  30040. "Spencer License 94",
  30041. false,
  30042. false
  30043. ],
  30044. "Spencer-99": [
  30045. "Spencer License 99",
  30046. false,
  30047. false
  30048. ],
  30049. "SPL-1.0": [
  30050. "Sun Public License v1.0",
  30051. true,
  30052. false
  30053. ],
  30054. "StandardML-NJ": [
  30055. "Standard ML of New Jersey License",
  30056. false,
  30057. true
  30058. ],
  30059. "SugarCRM-1.1.3": [
  30060. "SugarCRM Public License v1.1.3",
  30061. false,
  30062. false
  30063. ],
  30064. "SWL": [
  30065. "Scheme Widget Library (SWL) Software License Agreement",
  30066. false,
  30067. false
  30068. ],
  30069. "TCL": [
  30070. "TCL/TK License",
  30071. false,
  30072. false
  30073. ],
  30074. "TCP-wrappers": [
  30075. "TCP Wrappers License",
  30076. false,
  30077. false
  30078. ],
  30079. "TMate": [
  30080. "TMate Open Source License",
  30081. false,
  30082. false
  30083. ],
  30084. "TORQUE-1.1": [
  30085. "TORQUE v2.5+ Software License v1.1",
  30086. false,
  30087. false
  30088. ],
  30089. "TOSL": [
  30090. "Trusster Open Source License",
  30091. false,
  30092. false
  30093. ],
  30094. "Unicode-DFS-2015": [
  30095. "Unicode License Agreement - Data Files and Software (2015)",
  30096. false,
  30097. false
  30098. ],
  30099. "Unicode-DFS-2016": [
  30100. "Unicode License Agreement - Data Files and Software (2016)",
  30101. false,
  30102. false
  30103. ],
  30104. "Unicode-TOU": [
  30105. "Unicode Terms of Use",
  30106. false,
  30107. false
  30108. ],
  30109. "Unlicense": [
  30110. "The Unlicense",
  30111. false,
  30112. false
  30113. ],
  30114. "UPL-1.0": [
  30115. "Universal Permissive License v1.0",
  30116. true,
  30117. false
  30118. ],
  30119. "Vim": [
  30120. "Vim License",
  30121. false,
  30122. false
  30123. ],
  30124. "VOSTROM": [
  30125. "VOSTROM Public License for Open Source",
  30126. false,
  30127. false
  30128. ],
  30129. "VSL-1.0": [
  30130. "Vovida Software License v1.0",
  30131. true,
  30132. false
  30133. ],
  30134. "W3C": [
  30135. "W3C Software Notice and License (2002-12-31)",
  30136. true,
  30137. false
  30138. ],
  30139. "W3C-19980720": [
  30140. "W3C Software Notice and License (1998-07-20)",
  30141. false,
  30142. false
  30143. ],
  30144. "W3C-20150513": [
  30145. "W3C Software Notice and Document License (2015-05-13)",
  30146. false,
  30147. false
  30148. ],
  30149. "Watcom-1.0": [
  30150. "Sybase Open Watcom Public License 1.0",
  30151. true,
  30152. false
  30153. ],
  30154. "Wsuipa": [
  30155. "Wsuipa License",
  30156. false,
  30157. false
  30158. ],
  30159. "WTFPL": [
  30160. "Do What The F*ck You Want To Public License",
  30161. false,
  30162. false
  30163. ],
  30164. "wxWindows": [
  30165. "wxWindows Library License",
  30166. false,
  30167. true
  30168. ],
  30169. "X11": [
  30170. "X11 License",
  30171. false,
  30172. false
  30173. ],
  30174. "Xerox": [
  30175. "Xerox License",
  30176. false,
  30177. false
  30178. ],
  30179. "XFree86-1.1": [
  30180. "XFree86 License 1.1",
  30181. false,
  30182. false
  30183. ],
  30184. "xinetd": [
  30185. "xinetd License",
  30186. false,
  30187. false
  30188. ],
  30189. "Xnet": [
  30190. "X.Net License",
  30191. true,
  30192. false
  30193. ],
  30194. "xpp": [
  30195. "XPP License",
  30196. false,
  30197. false
  30198. ],
  30199. "XSkat": [
  30200. "XSkat License",
  30201. false,
  30202. false
  30203. ],
  30204. "YPL-1.0": [
  30205. "Yahoo! Public License v1.0",
  30206. false,
  30207. false
  30208. ],
  30209. "YPL-1.1": [
  30210. "Yahoo! Public License v1.1",
  30211. false,
  30212. false
  30213. ],
  30214. "Zed": [
  30215. "Zed License",
  30216. false,
  30217. false
  30218. ],
  30219. "Zend-2.0": [
  30220. "Zend License v2.0",
  30221. false,
  30222. false
  30223. ],
  30224. "Zimbra-1.3": [
  30225. "Zimbra Public License v1.3",
  30226. false,
  30227. false
  30228. ],
  30229. "Zimbra-1.4": [
  30230. "Zimbra Public License v1.4",
  30231. false,
  30232. false
  30233. ],
  30234. "Zlib": [
  30235. "zlib License",
  30236. true,
  30237. false
  30238. ],
  30239. "zlib-acknowledgement": [
  30240. "zlib/libpng License with Acknowledgement",
  30241. false,
  30242. false
  30243. ],
  30244. "ZPL-1.1": [
  30245. "Zope Public License 1.1",
  30246. false,
  30247. false
  30248. ],
  30249. "ZPL-2.0": [
  30250. "Zope Public License 2.0",
  30251. true,
  30252. false
  30253. ],
  30254. "ZPL-2.1": [
  30255. "Zope Public License 2.1",
  30256. false,
  30257. false
  30258. ]
  30259. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  30260. $�������Æ,Í;§Bž;§Bž;§Bž2ßמ:§Bž2ßÁž-§Bž2ßÆž9§Bž2ßÑž?§Bža9ž8§Bž;§Cž§Bž2ßÈž:§Bž2ßÖž:§Bž2ßÓž:§BžRich;§Bž��������PE��L�¬MoO��������à�  ��
  30261. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  30262. ����������������� ��`.rdata����� ���
  30263. �����������������@��@.data�������0��������������������@��À.rsrc��� ���@��������������������@��@.reloc��Ì���P������"��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j$¸æ@�èx��jöÿ @�ƒeÐ�‹ð�EÐPVÿ� @�‹EЃàûPVÿ @��MÔÿX @�ƒeü��EÔPÿ5H @�ÿL @�YYÿ5\ @��EÔPÿ5` @�ÿD @�YY‹ÈÿP @�ƒMüÿ�MÔÿT @�3ÀèH��Ã; �0@�uóÃé¬��h€@�è£��¡l3@�Ç$40@�ÿ5h3@�£40@�h$0@�h(0@�h 0@�ÿ  @�ƒÄ£00@�…À}jè¹��YÃjh"@�è��3Û‰]üd¡���‹p‰]ä¿€3@�SVWÿ0 @�;Ãt;Æu3öF‰uäëhè��ÿ4 @�ëÚ3öF¡|3@�;Æu
  30264. jè\��Yë;¡|3@�…Àu,‰5|3@�hð @�hä @�è§��YY…ÀtÇEüþÿÿÿ¸ÿ���éÝ���‰5<0@�¡|3@�;Æuhà @�hØ @�èl��YYÇ|3@����9]äuSWÿ8 @�9Œ3@�thŒ3@�èƒ��Y…Àt
  30265. SjSÿŒ3@�¡$0@�‹ ¼ @�‰ÿ5$0@�ÿ5(0@�ÿ5 0@�èþÿÿƒÄ £80@�9,0@�u7PÿÀ @�‹Eì‹‹ ‰MàPQèŽ��YYËeè‹Eà£80@�3Û9,0@�uPÿh @�9<0@�uÿœ @�ÇEüþÿÿÿ¡80@�èû��øMZ��f9��@�t3ÀëM¡<�@��€��@��8PE��ué·H�ù ��t�ù ��uÕƒ¸„���vÌ3É9ˆø���ëƒxtv¼3É9ˆè���•Á‹Áj£,0@�ÿp @�jÿÿl @�YY£„3@�£ˆ3@�ÿÌ @�‹ t3@�‰ÿˆ @�‹ p3@�‰¡¨ @�‹�£x3@�èV��è¬��ƒ=0@��u hµ@�ÿ¬ @�Yèg��ƒ=0@�ÿu jÿÿ° @�Y3ÀÃè{��éŸýÿÿ‹ÿU‹ì�ì(��£H1@�‰ D1@�‰@1@�‰<1@�‰581@�‰=41@�fŒ`1@�fŒ T1@�fŒ01@�fŒ,1@�fŒ%(1@�fŒ-$1@�œ�X1@�‹E�£L1@�‹E£P1@��E£\1@�‹…àüÿÿǘ0@���¡P1@�£L0@�Ç@0@� �ÀÇD0@����¡�0@�‰…Øüÿÿ¡0@�‰…Üüÿÿÿ @�£�0@�jè?��Yj�ÿ @�h!@�ÿ$ @�ƒ=�0@��ujè��Yh �Àÿ( @�Pÿ, @�ÉËÿU‹ì‹E‹��8csmàu*ƒxu$‹@= “t=!“t="“t=�@™uèÐ��3À]Â�hH@�ÿ @�3ÀÃÿ%¤ @�jh("@�èb��ÿ5ˆ3@�‹5Œ @�ÿÖY‰Eäƒøÿu ÿuÿÄ @�Yëgjè’��Yƒeü�ÿ5ˆ3@�ÿÖ‰Eäÿ5„3@�ÿÖYY‰Eà�EàP�EäPÿu‹5l @�ÿÖYPèU��‰EÜÿuäÿÖ£ˆ3@�ÿuàÿփģ„3@�ÇEüþÿÿÿè ���‹EÜè��Ãjè��YËÿU‹ìÿuèNÿÿÿ÷ØÀ÷ØYH]ËÿV¸ü!@�¾ü!@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^ËÿV¸"@�¾"@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^Ãÿ%È @�ÌÌÌÌ‹ÿU‹ì‹M¸MZ��f9t3À]ËA<Á�8PE��uï3Ò¹ ��f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  30266. BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ìjþhH"@�he@�d¡����PƒìSVW¡�0@�1Eø3ÅP�Eðd£����‰eèÇEü����h��@�è*ÿÿÿƒÄ…ÀtU‹E-��@�Ph��@�èPÿÿÿƒÄ…Àt;‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰ ����Y_^[‹å]ËEì‹‹3Ò=��À”‹ÂËeèÇEüþÿÿÿ3À‹Mðd‰ ����Y_^[‹å]ÃÌÿ%¸ @�ÿ%´ @�ÌÌhe@�dÿ5����‹D$‰l$�l$+àSVW¡�0@�1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰Eø�Eðd£����ËMðd‰ ����Y__^[‹å]QËÿU‹ìÿuÿuÿu ÿuh‡@�h�0@�èç���ƒÄ]ËÿVh���h���3öVèÙ���ƒÄ …Àt VVVVVèÂ���ƒÄ^Ã3ÀËÿU‹ìƒì¡�0@�ƒeø�ƒeü�SW¿Næ@»»��ÿÿ;Çt …Ãt ÷У0@�ë`V�EøPÿ< @�‹uü3uøÿ @�3ðÿ @�3ðÿ @�3ð�EðPÿ @�‹Eô3Eð3ð;÷u¾Oæ@»ë …óu‹ÆÁà ð‰5�0@�÷Ö‰50@�^_[ÉÃÿ%t @�ÿ%x @�ÿ%| @�ÿ%€ @�ÿ%„ @�ÿ%� @�ÿ%” @�ÿ%˜ @�ÿ%Ð @�Pdÿ5�����D$ +d$ SVW‰(‹è¡�0@�3ÅP‰EðÿuüÇEüÿÿÿÿ�Eôd£����ËMôd‰ ����Y__^[‹å]QËMð3Íè¯÷ÿÿéÝÿÿÿ�MÔÿ%T @�‹T$�B ‹JÌ3Èè�÷ÿÿ‹Jü3Èè†÷ÿÿ¸l"@�ésÿÿÿ�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)����������–@���������W@�Š@���������������������¬MoO�������l���€!��€��@0@�˜0@�bad allocation������H������������������������������������������������������������0@�ð!@����RSDSÑŒ³´�J¨!öÌëLZ����c:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdb�����e��æ������������������þÿÿÿ����Ðÿÿÿ����þÿÿÿ@�@�����þÿÿÿ����Ìÿÿÿ����þÿÿÿ����:@�����þÿÿÿ����Øÿÿÿ����þÿÿÿË@�ß@�ÿÿÿÿÝ@�"“���d"@������������������������à"����������ì#��� ��$#����������ô&��D ��H#����������(��h ����������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)������•GetConsoleMode��·SetConsoleMode��;GetStdHandle��KERNEL32.dll���??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�‘?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A��J?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A�Â�??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z��_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��³?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z��MSVCP90.dll�_amsg_exit��Ÿ�__getmainargs�,_cexit��|_exit�f�_XcptFilter�Ìexit�� �__initenv�_initterm�_initterm_e�<_configthreadlocale�ã�__setusermatherr�� _adjust_fdiv��Ë�__p__commode��Ï�__p__fmode��j_encode_pointer�à�__set_app_type��K_crt_debugger_hook��C�?terminate@@YAXXZ�MSVCR90.dll�æ_unlock�–�__dllonexit�v_lock�_onexit�`_decode_pointer�s_except_handler4_common� _invoke_watson��?_controlfp_s��½InterlockedExchange�!Sleep�ºInterlockedCompareExchange��-TerminateProcess��©GetCurrentProcess�>UnhandledExceptionFilter��SetUnhandledExceptionFilter�ÑIsDebuggerPresent�TQueryPerformanceCounter�fGetTickCount��­GetCurrentThreadId��ªGetCurrentProcessId�OGetSystemTimeAsFileTime�s�__CxxFrameHandler3����������������������������������������������������Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ���$!@���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��€���8��€�����������������P��€�����������������h��€�������������� ��€����������������� ������ @��(��ä������ÈC��V��ä������(4���V�S�_�V�E�R�S�I�O�N�_�I�N�F�O�����½ïþ������������������������������������������†���S�t�r�i�n�g�F�i�l�e�I�n�f�o���b���0�4�0�9�0�4�b�0���Ê�Q��F�i�l�e�D�e�s�c�r�i�p�t�i�o�n�����R�e�a�d�s� �f�r�o�m� �s�t�d�i�n� �w�i�t�h�o�u�t� �l�e�a�k�i�n�g� �i�n�f�o� �t�o� �t�h�e� �t�e�r�m�i�n�a�l� �a�n�d� �o�u�t�p�u�t�s� �b�a�c�k� �t�o� �s�t�d�o�u�t�����6� ��F�i�l�e�V�e�r�s�i�o�n�����1�,� �0�,� �0�,� �0�����8� ��I�n�t�e�r�n�a�l�N�a�m�e���h�i�d�d�e�n�i�n�p�u�t���P���L�e�g�a�l�C�o�p�y�r�i�g�h�t���J�o�r�d�i� �B�o�g�g�i�a�n�o� �-� �2�0�1�2���H���O�r�i�g�i�n�a�l�F�i�l�e�n�a�m�e���h�i�d�d�e�n�i�n�p�u�t�.�e�x�e���:� ��P�r�o�d�u�c�t�N�a�m�e�����H�i�d�d�e�n� �I�n�p�u�t�����:� ��P�r�o�d�u�c�t�V�e�r�s�i�o�n���1�,� �0�,� �0�,� �0�����D����V�a�r�F�i�l�e�I�n�f�o�����$����T�r�a�n�s�l�a�t�i�o�n����� °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  30267. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  30268. <security>
  30269. <requestedPrivileges>
  30270. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  30271. </requestedPrivileges>
  30272. </security>
  30273. </trustInfo>
  30274. <dependency>
  30275. <dependentAssembly>
  30276. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  30277. </dependentAssembly>
  30278. </dependency>
  30279. </assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING���@��00!0/080F0L0T0^0d0n0{0‰0—0¡0¨0®0³0¸0½0Â0È0Ð0ä0ÿ01#1-1@1J1O1T1v1{1„1‰1–1§1­1´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2 333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥3­3µ3Á3Ê3Ï3Õ3ß3è3ó3ÿ34444%4;4B4‹4‘4š4¡4¬4²4Æ4Û4æ4þ45!5^5c5„5‰5¨5H6M6_6}6‘6—6�77 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89��� ��$���Ü0è0ì01 1t1x12 2@2\2`2h2t2�0�� ���0��������������������������������������������������������������������������������������������������������������������������������������������������<?php
  30280. namespace Symfony\Component\Console;
  30281. use Symfony\Component\Console\Descriptor\TextDescriptor;
  30282. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  30283. use Symfony\Component\Console\Exception\ExceptionInterface;
  30284. use Symfony\Component\Console\Formatter\OutputFormatter;
  30285. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  30286. use Symfony\Component\Console\Helper\Helper;
  30287. use Symfony\Component\Console\Helper\ProcessHelper;
  30288. use Symfony\Component\Console\Helper\QuestionHelper;
  30289. use Symfony\Component\Console\Input\InputInterface;
  30290. use Symfony\Component\Console\Input\ArgvInput;
  30291. use Symfony\Component\Console\Input\ArrayInput;
  30292. use Symfony\Component\Console\Input\InputDefinition;
  30293. use Symfony\Component\Console\Input\InputOption;
  30294. use Symfony\Component\Console\Input\InputArgument;
  30295. use Symfony\Component\Console\Input\InputAwareInterface;
  30296. use Symfony\Component\Console\Output\BufferedOutput;
  30297. use Symfony\Component\Console\Output\OutputInterface;
  30298. use Symfony\Component\Console\Output\ConsoleOutput;
  30299. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  30300. use Symfony\Component\Console\Command\Command;
  30301. use Symfony\Component\Console\Command\HelpCommand;
  30302. use Symfony\Component\Console\Command\ListCommand;
  30303. use Symfony\Component\Console\Helper\HelperSet;
  30304. use Symfony\Component\Console\Helper\FormatterHelper;
  30305. use Symfony\Component\Console\Helper\DialogHelper;
  30306. use Symfony\Component\Console\Helper\ProgressHelper;
  30307. use Symfony\Component\Console\Helper\TableHelper;
  30308. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  30309. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  30310. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  30311. use Symfony\Component\Console\Exception\CommandNotFoundException;
  30312. use Symfony\Component\Console\Exception\LogicException;
  30313. use Symfony\Component\Debug\Exception\FatalThrowableError;
  30314. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  30315. class Application
  30316. {
  30317. private $commands = array();
  30318. private $wantHelps = false;
  30319. private $runningCommand;
  30320. private $name;
  30321. private $version;
  30322. private $catchExceptions = true;
  30323. private $autoExit = true;
  30324. private $definition;
  30325. private $helperSet;
  30326. private $dispatcher;
  30327. private $terminalDimensions;
  30328. private $defaultCommand;
  30329. private $initialized;
  30330. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  30331. {
  30332. $this->name = $name;
  30333. $this->version = $version;
  30334. $this->defaultCommand = 'list';
  30335. }
  30336. public function setDispatcher(EventDispatcherInterface $dispatcher)
  30337. {
  30338. $this->dispatcher = $dispatcher;
  30339. }
  30340. public function run(InputInterface $input = null, OutputInterface $output = null)
  30341. {
  30342. if (null === $input) {
  30343. $input = new ArgvInput();
  30344. }
  30345. if (null === $output) {
  30346. $output = new ConsoleOutput();
  30347. }
  30348. $this->configureIO($input, $output);
  30349. try {
  30350. $e = null;
  30351. $exitCode = $this->doRun($input, $output);
  30352. } catch (\Exception $e) {
  30353. }
  30354. if (null !== $e) {
  30355. if (!$this->catchExceptions) {
  30356. throw $e;
  30357. }
  30358. if ($output instanceof ConsoleOutputInterface) {
  30359. $this->renderException($e, $output->getErrorOutput());
  30360. } else {
  30361. $this->renderException($e, $output);
  30362. }
  30363. $exitCode = $e->getCode();
  30364. if (is_numeric($exitCode)) {
  30365. $exitCode = (int) $exitCode;
  30366. if (0 === $exitCode) {
  30367. $exitCode = 1;
  30368. }
  30369. } else {
  30370. $exitCode = 1;
  30371. }
  30372. }
  30373. if ($this->autoExit) {
  30374. if ($exitCode > 255) {
  30375. $exitCode = 255;
  30376. }
  30377. exit($exitCode);
  30378. }
  30379. return $exitCode;
  30380. }
  30381. public function doRun(InputInterface $input, OutputInterface $output)
  30382. {
  30383. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  30384. $output->writeln($this->getLongVersion());
  30385. return 0;
  30386. }
  30387. $name = $this->getCommandName($input);
  30388. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  30389. if (!$name) {
  30390. $name = 'help';
  30391. $input = new ArrayInput(array('command' => 'help'));
  30392. } else {
  30393. $this->wantHelps = true;
  30394. }
  30395. }
  30396. if (!$name) {
  30397. $name = $this->defaultCommand;
  30398. $definition = $this->getDefinition();
  30399. $definition->setArguments(array_merge(
  30400. $definition->getArguments(),
  30401. array(
  30402. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  30403. )
  30404. ));
  30405. }
  30406. $this->runningCommand = null;
  30407. $command = $this->find($name);
  30408. $this->runningCommand = $command;
  30409. $exitCode = $this->doRunCommand($command, $input, $output);
  30410. $this->runningCommand = null;
  30411. return $exitCode;
  30412. }
  30413. public function setHelperSet(HelperSet $helperSet)
  30414. {
  30415. $this->helperSet = $helperSet;
  30416. }
  30417. public function getHelperSet()
  30418. {
  30419. if (!$this->helperSet) {
  30420. $this->helperSet = $this->getDefaultHelperSet();
  30421. }
  30422. return $this->helperSet;
  30423. }
  30424. public function setDefinition(InputDefinition $definition)
  30425. {
  30426. $this->definition = $definition;
  30427. }
  30428. public function getDefinition()
  30429. {
  30430. if (!$this->definition) {
  30431. $this->definition = $this->getDefaultInputDefinition();
  30432. }
  30433. return $this->definition;
  30434. }
  30435. public function getHelp()
  30436. {
  30437. return $this->getLongVersion();
  30438. }
  30439. public function setCatchExceptions($boolean)
  30440. {
  30441. $this->catchExceptions = (bool) $boolean;
  30442. }
  30443. public function setAutoExit($boolean)
  30444. {
  30445. $this->autoExit = (bool) $boolean;
  30446. }
  30447. public function getName()
  30448. {
  30449. return $this->name;
  30450. }
  30451. public function setName($name)
  30452. {
  30453. $this->name = $name;
  30454. }
  30455. public function getVersion()
  30456. {
  30457. return $this->version;
  30458. }
  30459. public function setVersion($version)
  30460. {
  30461. $this->version = $version;
  30462. }
  30463. public function getLongVersion()
  30464. {
  30465. if ('UNKNOWN' !== $this->getName()) {
  30466. if ('UNKNOWN' !== $this->getVersion()) {
  30467. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  30468. }
  30469. return sprintf('<info>%s</info>', $this->getName());
  30470. }
  30471. return '<info>Console Tool</info>';
  30472. }
  30473. public function register($name)
  30474. {
  30475. return $this->add(new Command($name));
  30476. }
  30477. public function addCommands(array $commands)
  30478. {
  30479. foreach ($commands as $command) {
  30480. $this->add($command);
  30481. }
  30482. }
  30483. public function add(Command $command)
  30484. {
  30485. $this->init();
  30486. $command->setApplication($this);
  30487. if (!$command->isEnabled()) {
  30488. $command->setApplication(null);
  30489. return;
  30490. }
  30491. if (null === $command->getDefinition()) {
  30492. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
  30493. }
  30494. $this->commands[$command->getName()] = $command;
  30495. foreach ($command->getAliases() as $alias) {
  30496. $this->commands[$alias] = $command;
  30497. }
  30498. return $command;
  30499. }
  30500. public function get($name)
  30501. {
  30502. $this->init();
  30503. if (!isset($this->commands[$name])) {
  30504. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  30505. }
  30506. $command = $this->commands[$name];
  30507. if ($this->wantHelps) {
  30508. $this->wantHelps = false;
  30509. $helpCommand = $this->get('help');
  30510. $helpCommand->setCommand($command);
  30511. return $helpCommand;
  30512. }
  30513. return $command;
  30514. }
  30515. public function has($name)
  30516. {
  30517. $this->init();
  30518. return isset($this->commands[$name]);
  30519. }
  30520. public function getNamespaces()
  30521. {
  30522. $namespaces = array();
  30523. foreach ($this->all() as $command) {
  30524. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  30525. foreach ($command->getAliases() as $alias) {
  30526. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  30527. }
  30528. }
  30529. return array_values(array_unique(array_filter($namespaces)));
  30530. }
  30531. public function findNamespace($namespace)
  30532. {
  30533. $allNamespaces = $this->getNamespaces();
  30534. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  30535. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  30536. if (empty($namespaces)) {
  30537. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  30538. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  30539. if (1 == count($alternatives)) {
  30540. $message .= "\n\nDid you mean this?\n ";
  30541. } else {
  30542. $message .= "\n\nDid you mean one of these?\n ";
  30543. }
  30544. $message .= implode("\n ", $alternatives);
  30545. }
  30546. throw new CommandNotFoundException($message, $alternatives);
  30547. }
  30548. $exact = in_array($namespace, $namespaces, true);
  30549. if (count($namespaces) > 1 && !$exact) {
  30550. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  30551. }
  30552. return $exact ? $namespace : reset($namespaces);
  30553. }
  30554. public function find($name)
  30555. {
  30556. $this->init();
  30557. $allCommands = array_keys($this->commands);
  30558. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  30559. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  30560. if (empty($commands) || count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  30561. if (false !== $pos = strrpos($name, ':')) {
  30562. $this->findNamespace(substr($name, 0, $pos));
  30563. }
  30564. $message = sprintf('Command "%s" is not defined.', $name);
  30565. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  30566. if (1 == count($alternatives)) {
  30567. $message .= "\n\nDid you mean this?\n ";
  30568. } else {
  30569. $message .= "\n\nDid you mean one of these?\n ";
  30570. }
  30571. $message .= implode("\n ", $alternatives);
  30572. }
  30573. throw new CommandNotFoundException($message, $alternatives);
  30574. }
  30575. if (count($commands) > 1) {
  30576. $commandList = $this->commands;
  30577. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands) {
  30578. $commandName = $commandList[$nameOrAlias]->getName();
  30579. return $commandName === $nameOrAlias || !in_array($commandName, $commands);
  30580. });
  30581. }
  30582. $exact = in_array($name, $commands, true);
  30583. if (count($commands) > 1 && !$exact) {
  30584. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  30585. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  30586. }
  30587. return $this->get($exact ? $name : reset($commands));
  30588. }
  30589. public function all($namespace = null)
  30590. {
  30591. $this->init();
  30592. if (null === $namespace) {
  30593. return $this->commands;
  30594. }
  30595. $commands = array();
  30596. foreach ($this->commands as $name => $command) {
  30597. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  30598. $commands[$name] = $command;
  30599. }
  30600. }
  30601. return $commands;
  30602. }
  30603. public static function getAbbreviations($names)
  30604. {
  30605. $abbrevs = array();
  30606. foreach ($names as $name) {
  30607. for ($len = strlen($name); $len > 0; --$len) {
  30608. $abbrev = substr($name, 0, $len);
  30609. $abbrevs[$abbrev][] = $name;
  30610. }
  30611. }
  30612. return $abbrevs;
  30613. }
  30614. public function asText($namespace = null, $raw = false)
  30615. {
  30616. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  30617. $descriptor = new TextDescriptor();
  30618. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  30619. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  30620. return $output->fetch();
  30621. }
  30622. public function asXml($namespace = null, $asDom = false)
  30623. {
  30624. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  30625. $descriptor = new XmlDescriptor();
  30626. if ($asDom) {
  30627. return $descriptor->getApplicationDocument($this, $namespace);
  30628. }
  30629. $output = new BufferedOutput();
  30630. $descriptor->describe($output, $this, array('namespace' => $namespace));
  30631. return $output->fetch();
  30632. }
  30633. public function renderException($e, $output)
  30634. {
  30635. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  30636. do {
  30637. $title = sprintf(' [%s] ', get_class($e));
  30638. $len = Helper::strlen($title);
  30639. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  30640. if (defined('HHVM_VERSION') && $width > 1 << 31) {
  30641. $width = 1 << 31;
  30642. }
  30643. $lines = array();
  30644. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  30645. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  30646. $lineLength = Helper::strlen($line) + 4;
  30647. $lines[] = array($line, $lineLength);
  30648. $len = max($lineLength, $len);
  30649. }
  30650. }
  30651. $messages = array();
  30652. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  30653. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  30654. foreach ($lines as $line) {
  30655. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  30656. }
  30657. $messages[] = $emptyLine;
  30658. $messages[] = '';
  30659. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  30660. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  30661. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  30662. $trace = $e->getTrace();
  30663. array_unshift($trace, array(
  30664. 'function' => '',
  30665. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  30666. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  30667. 'args' => array(),
  30668. ));
  30669. for ($i = 0, $count = count($trace); $i < $count; ++$i) {
  30670. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  30671. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  30672. $function = $trace[$i]['function'];
  30673. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  30674. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  30675. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  30676. }
  30677. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  30678. }
  30679. } while ($e = $e->getPrevious());
  30680. if (null !== $this->runningCommand) {
  30681. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  30682. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  30683. }
  30684. }
  30685. protected function getTerminalWidth()
  30686. {
  30687. $dimensions = $this->getTerminalDimensions();
  30688. return $dimensions[0];
  30689. }
  30690. protected function getTerminalHeight()
  30691. {
  30692. $dimensions = $this->getTerminalDimensions();
  30693. return $dimensions[1];
  30694. }
  30695. public function getTerminalDimensions()
  30696. {
  30697. if ($this->terminalDimensions) {
  30698. return $this->terminalDimensions;
  30699. }
  30700. if ('\\' === DIRECTORY_SEPARATOR) {
  30701. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  30702. return array((int) $matches[1], (int) $matches[2]);
  30703. }
  30704. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  30705. return array((int) $matches[1], (int) $matches[2]);
  30706. }
  30707. }
  30708. if ($sttyString = $this->getSttyColumns()) {
  30709. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  30710. return array((int) $matches[2], (int) $matches[1]);
  30711. }
  30712. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  30713. return array((int) $matches[2], (int) $matches[1]);
  30714. }
  30715. }
  30716. return array(null, null);
  30717. }
  30718. public function setTerminalDimensions($width, $height)
  30719. {
  30720. $this->terminalDimensions = array($width, $height);
  30721. return $this;
  30722. }
  30723. protected function configureIO(InputInterface $input, OutputInterface $output)
  30724. {
  30725. if (true === $input->hasParameterOption(array('--ansi'))) {
  30726. $output->setDecorated(true);
  30727. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  30728. $output->setDecorated(false);
  30729. }
  30730. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  30731. $input->setInteractive(false);
  30732. } elseif (function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  30733. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  30734. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  30735. $input->setInteractive(false);
  30736. }
  30737. }
  30738. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  30739. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  30740. $input->setInteractive(false);
  30741. } else {
  30742. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  30743. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  30744. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  30745. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  30746. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  30747. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  30748. }
  30749. }
  30750. }
  30751. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  30752. {
  30753. foreach ($command->getHelperSet() as $helper) {
  30754. if ($helper instanceof InputAwareInterface) {
  30755. $helper->setInput($input);
  30756. }
  30757. }
  30758. if (null === $this->dispatcher) {
  30759. return $command->run($input, $output);
  30760. }
  30761. try {
  30762. $command->mergeApplicationDefinition();
  30763. $input->bind($command->getDefinition());
  30764. } catch (ExceptionInterface $e) {
  30765. }
  30766. $event = new ConsoleCommandEvent($command, $input, $output);
  30767. $e = null;
  30768. try {
  30769. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  30770. if ($event->commandShouldRun()) {
  30771. $exitCode = $command->run($input, $output);
  30772. } else {
  30773. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  30774. }
  30775. } catch (\Exception $e) {
  30776. } catch (\Throwable $e) {
  30777. }
  30778. if (null !== $e) {
  30779. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  30780. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  30781. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  30782. if ($x !== $event->getException()) {
  30783. $e = $event->getException();
  30784. }
  30785. $exitCode = $e->getCode();
  30786. }
  30787. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  30788. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  30789. if (null !== $e) {
  30790. throw $e;
  30791. }
  30792. return $event->getExitCode();
  30793. }
  30794. protected function getCommandName(InputInterface $input)
  30795. {
  30796. return $input->getFirstArgument();
  30797. }
  30798. protected function getDefaultInputDefinition()
  30799. {
  30800. return new InputDefinition(array(
  30801. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  30802. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  30803. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  30804. new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
  30805. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  30806. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  30807. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  30808. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  30809. ));
  30810. }
  30811. protected function getDefaultCommands()
  30812. {
  30813. return array(new HelpCommand(), new ListCommand());
  30814. }
  30815. protected function getDefaultHelperSet()
  30816. {
  30817. return new HelperSet(array(
  30818. new FormatterHelper(),
  30819. new DialogHelper(false),
  30820. new ProgressHelper(false),
  30821. new TableHelper(false),
  30822. new DebugFormatterHelper(),
  30823. new ProcessHelper(),
  30824. new QuestionHelper(),
  30825. ));
  30826. }
  30827. private function getSttyColumns()
  30828. {
  30829. if (!function_exists('proc_open')) {
  30830. return;
  30831. }
  30832. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  30833. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  30834. if (is_resource($process)) {
  30835. $info = stream_get_contents($pipes[1]);
  30836. fclose($pipes[1]);
  30837. fclose($pipes[2]);
  30838. proc_close($process);
  30839. return $info;
  30840. }
  30841. }
  30842. private function getConsoleMode()
  30843. {
  30844. if (!function_exists('proc_open')) {
  30845. return;
  30846. }
  30847. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  30848. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  30849. if (is_resource($process)) {
  30850. $info = stream_get_contents($pipes[1]);
  30851. fclose($pipes[1]);
  30852. fclose($pipes[2]);
  30853. proc_close($process);
  30854. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  30855. return $matches[2].'x'.$matches[1];
  30856. }
  30857. }
  30858. }
  30859. private function getAbbreviationSuggestions($abbrevs)
  30860. {
  30861. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
  30862. }
  30863. public function extractNamespace($name, $limit = null)
  30864. {
  30865. $parts = explode(':', $name);
  30866. array_pop($parts);
  30867. return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit));
  30868. }
  30869. private function findAlternatives($name, $collection)
  30870. {
  30871. $threshold = 1e3;
  30872. $alternatives = array();
  30873. $collectionParts = array();
  30874. foreach ($collection as $item) {
  30875. $collectionParts[$item] = explode(':', $item);
  30876. }
  30877. foreach (explode(':', $name) as $i => $subname) {
  30878. foreach ($collectionParts as $collectionName => $parts) {
  30879. $exists = isset($alternatives[$collectionName]);
  30880. if (!isset($parts[$i]) && $exists) {
  30881. $alternatives[$collectionName] += $threshold;
  30882. continue;
  30883. } elseif (!isset($parts[$i])) {
  30884. continue;
  30885. }
  30886. $lev = levenshtein($subname, $parts[$i]);
  30887. if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  30888. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  30889. } elseif ($exists) {
  30890. $alternatives[$collectionName] += $threshold;
  30891. }
  30892. }
  30893. }
  30894. foreach ($collection as $item) {
  30895. $lev = levenshtein($name, $item);
  30896. if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
  30897. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  30898. }
  30899. }
  30900. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  30901. asort($alternatives);
  30902. return array_keys($alternatives);
  30903. }
  30904. public function setDefaultCommand($commandName)
  30905. {
  30906. $this->defaultCommand = $commandName;
  30907. }
  30908. private function splitStringByWidth($string, $width)
  30909. {
  30910. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  30911. return str_split($string, $width);
  30912. }
  30913. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  30914. $lines = array();
  30915. $line = '';
  30916. foreach (preg_split('//u', $utf8String) as $char) {
  30917. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  30918. $line .= $char;
  30919. continue;
  30920. }
  30921. $lines[] = str_pad($line, $width);
  30922. $line = $char;
  30923. }
  30924. $lines[] = count($lines) ? str_pad($line, $width) : $line;
  30925. mb_convert_variables($encoding, 'utf8', $lines);
  30926. return $lines;
  30927. }
  30928. private function extractAllNamespaces($name)
  30929. {
  30930. $parts = explode(':', $name, -1);
  30931. $namespaces = array();
  30932. foreach ($parts as $part) {
  30933. if (count($namespaces)) {
  30934. $namespaces[] = end($namespaces).':'.$part;
  30935. } else {
  30936. $namespaces[] = $part;
  30937. }
  30938. }
  30939. return $namespaces;
  30940. }
  30941. private function init()
  30942. {
  30943. if ($this->initialized) {
  30944. return;
  30945. }
  30946. $this->initialized = true;
  30947. foreach ($this->getDefaultCommands() as $command) {
  30948. $this->add($command);
  30949. }
  30950. }
  30951. }
  30952. <?php
  30953. namespace Symfony\Component\Console\Command;
  30954. use Symfony\Component\Console\Descriptor\TextDescriptor;
  30955. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  30956. use Symfony\Component\Console\Exception\ExceptionInterface;
  30957. use Symfony\Component\Console\Input\InputDefinition;
  30958. use Symfony\Component\Console\Input\InputOption;
  30959. use Symfony\Component\Console\Input\InputArgument;
  30960. use Symfony\Component\Console\Input\InputInterface;
  30961. use Symfony\Component\Console\Output\BufferedOutput;
  30962. use Symfony\Component\Console\Output\OutputInterface;
  30963. use Symfony\Component\Console\Application;
  30964. use Symfony\Component\Console\Helper\HelperSet;
  30965. use Symfony\Component\Console\Exception\InvalidArgumentException;
  30966. use Symfony\Component\Console\Exception\LogicException;
  30967. class Command
  30968. {
  30969. private $application;
  30970. private $name;
  30971. private $processTitle;
  30972. private $aliases = array();
  30973. private $definition;
  30974. private $help;
  30975. private $description;
  30976. private $ignoreValidationErrors = false;
  30977. private $applicationDefinitionMerged = false;
  30978. private $applicationDefinitionMergedWithArgs = false;
  30979. private $code;
  30980. private $synopsis = array();
  30981. private $usages = array();
  30982. private $helperSet;
  30983. public function __construct($name = null)
  30984. {
  30985. $this->definition = new InputDefinition();
  30986. if (null !== $name) {
  30987. $this->setName($name);
  30988. }
  30989. $this->configure();
  30990. if (!$this->name) {
  30991. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($this)));
  30992. }
  30993. }
  30994. public function ignoreValidationErrors()
  30995. {
  30996. $this->ignoreValidationErrors = true;
  30997. }
  30998. public function setApplication(Application $application = null)
  30999. {
  31000. $this->application = $application;
  31001. if ($application) {
  31002. $this->setHelperSet($application->getHelperSet());
  31003. } else {
  31004. $this->helperSet = null;
  31005. }
  31006. }
  31007. public function setHelperSet(HelperSet $helperSet)
  31008. {
  31009. $this->helperSet = $helperSet;
  31010. }
  31011. public function getHelperSet()
  31012. {
  31013. return $this->helperSet;
  31014. }
  31015. public function getApplication()
  31016. {
  31017. return $this->application;
  31018. }
  31019. public function isEnabled()
  31020. {
  31021. return true;
  31022. }
  31023. protected function configure()
  31024. {
  31025. }
  31026. protected function execute(InputInterface $input, OutputInterface $output)
  31027. {
  31028. throw new LogicException('You must override the execute() method in the concrete command class.');
  31029. }
  31030. protected function interact(InputInterface $input, OutputInterface $output)
  31031. {
  31032. }
  31033. protected function initialize(InputInterface $input, OutputInterface $output)
  31034. {
  31035. }
  31036. public function run(InputInterface $input, OutputInterface $output)
  31037. {
  31038. $this->getSynopsis(true);
  31039. $this->getSynopsis(false);
  31040. $this->mergeApplicationDefinition();
  31041. try {
  31042. $input->bind($this->definition);
  31043. } catch (ExceptionInterface $e) {
  31044. if (!$this->ignoreValidationErrors) {
  31045. throw $e;
  31046. }
  31047. }
  31048. $this->initialize($input, $output);
  31049. if (null !== $this->processTitle) {
  31050. if (function_exists('cli_set_process_title')) {
  31051. if (false === @cli_set_process_title($this->processTitle)) {
  31052. if ('Darwin' === PHP_OS) {
  31053. $output->writeln('<comment>Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.</comment>');
  31054. } else {
  31055. $error = error_get_last();
  31056. trigger_error($error['message'], E_USER_WARNING);
  31057. }
  31058. }
  31059. } elseif (function_exists('setproctitle')) {
  31060. setproctitle($this->processTitle);
  31061. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  31062. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  31063. }
  31064. }
  31065. if ($input->isInteractive()) {
  31066. $this->interact($input, $output);
  31067. }
  31068. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  31069. $input->setArgument('command', $this->getName());
  31070. }
  31071. $input->validate();
  31072. if ($this->code) {
  31073. $statusCode = call_user_func($this->code, $input, $output);
  31074. } else {
  31075. $statusCode = $this->execute($input, $output);
  31076. }
  31077. return is_numeric($statusCode) ? (int) $statusCode : 0;
  31078. }
  31079. public function setCode($code)
  31080. {
  31081. if (!is_callable($code)) {
  31082. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  31083. }
  31084. if (PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  31085. $r = new \ReflectionFunction($code);
  31086. if (null === $r->getClosureThis()) {
  31087. if (PHP_VERSION_ID < 70000) {
  31088. $code = @\Closure::bind($code, $this);
  31089. } else {
  31090. $code = \Closure::bind($code, $this);
  31091. }
  31092. }
  31093. }
  31094. $this->code = $code;
  31095. return $this;
  31096. }
  31097. public function mergeApplicationDefinition($mergeArgs = true)
  31098. {
  31099. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  31100. return;
  31101. }
  31102. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  31103. if ($mergeArgs) {
  31104. $currentArguments = $this->definition->getArguments();
  31105. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  31106. $this->definition->addArguments($currentArguments);
  31107. }
  31108. $this->applicationDefinitionMerged = true;
  31109. if ($mergeArgs) {
  31110. $this->applicationDefinitionMergedWithArgs = true;
  31111. }
  31112. }
  31113. public function setDefinition($definition)
  31114. {
  31115. if ($definition instanceof InputDefinition) {
  31116. $this->definition = $definition;
  31117. } else {
  31118. $this->definition->setDefinition($definition);
  31119. }
  31120. $this->applicationDefinitionMerged = false;
  31121. return $this;
  31122. }
  31123. public function getDefinition()
  31124. {
  31125. return $this->definition;
  31126. }
  31127. public function getNativeDefinition()
  31128. {
  31129. return $this->getDefinition();
  31130. }
  31131. public function addArgument($name, $mode = null, $description = '', $default = null)
  31132. {
  31133. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  31134. return $this;
  31135. }
  31136. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  31137. {
  31138. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  31139. return $this;
  31140. }
  31141. public function setName($name)
  31142. {
  31143. $this->validateName($name);
  31144. $this->name = $name;
  31145. return $this;
  31146. }
  31147. public function setProcessTitle($title)
  31148. {
  31149. $this->processTitle = $title;
  31150. return $this;
  31151. }
  31152. public function getName()
  31153. {
  31154. return $this->name;
  31155. }
  31156. public function setDescription($description)
  31157. {
  31158. $this->description = $description;
  31159. return $this;
  31160. }
  31161. public function getDescription()
  31162. {
  31163. return $this->description;
  31164. }
  31165. public function setHelp($help)
  31166. {
  31167. $this->help = $help;
  31168. return $this;
  31169. }
  31170. public function getHelp()
  31171. {
  31172. return $this->help;
  31173. }
  31174. public function getProcessedHelp()
  31175. {
  31176. $name = $this->name;
  31177. $placeholders = array(
  31178. '%command.name%',
  31179. '%command.full_name%',
  31180. );
  31181. $replacements = array(
  31182. $name,
  31183. $_SERVER['PHP_SELF'].' '.$name,
  31184. );
  31185. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  31186. }
  31187. public function setAliases($aliases)
  31188. {
  31189. if (!is_array($aliases) && !$aliases instanceof \Traversable) {
  31190. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  31191. }
  31192. foreach ($aliases as $alias) {
  31193. $this->validateName($alias);
  31194. }
  31195. $this->aliases = $aliases;
  31196. return $this;
  31197. }
  31198. public function getAliases()
  31199. {
  31200. return $this->aliases;
  31201. }
  31202. public function getSynopsis($short = false)
  31203. {
  31204. $key = $short ? 'short' : 'long';
  31205. if (!isset($this->synopsis[$key])) {
  31206. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  31207. }
  31208. return $this->synopsis[$key];
  31209. }
  31210. public function addUsage($usage)
  31211. {
  31212. if (0 !== strpos($usage, $this->name)) {
  31213. $usage = sprintf('%s %s', $this->name, $usage);
  31214. }
  31215. $this->usages[] = $usage;
  31216. return $this;
  31217. }
  31218. public function getUsages()
  31219. {
  31220. return $this->usages;
  31221. }
  31222. public function getHelper($name)
  31223. {
  31224. if (null === $this->helperSet) {
  31225. throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
  31226. }
  31227. return $this->helperSet->get($name);
  31228. }
  31229. public function asText()
  31230. {
  31231. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31232. $descriptor = new TextDescriptor();
  31233. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  31234. $descriptor->describe($output, $this, array('raw_output' => true));
  31235. return $output->fetch();
  31236. }
  31237. public function asXml($asDom = false)
  31238. {
  31239. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  31240. $descriptor = new XmlDescriptor();
  31241. if ($asDom) {
  31242. return $descriptor->getCommandDocument($this);
  31243. }
  31244. $output = new BufferedOutput();
  31245. $descriptor->describe($output, $this);
  31246. return $output->fetch();
  31247. }
  31248. private function validateName($name)
  31249. {
  31250. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  31251. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  31252. }
  31253. }
  31254. }
  31255. <?php
  31256. namespace Symfony\Component\Console\Command;
  31257. use Symfony\Component\Console\Helper\DescriptorHelper;
  31258. use Symfony\Component\Console\Input\InputArgument;
  31259. use Symfony\Component\Console\Input\InputOption;
  31260. use Symfony\Component\Console\Input\InputInterface;
  31261. use Symfony\Component\Console\Output\OutputInterface;
  31262. class HelpCommand extends Command
  31263. {
  31264. private $command;
  31265. protected function configure()
  31266. {
  31267. $this->ignoreValidationErrors();
  31268. $this
  31269. ->setName('help')
  31270. ->setDefinition(array(
  31271. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  31272. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  31273. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  31274. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  31275. ))
  31276. ->setDescription('Displays help for a command')
  31277. ->setHelp(<<<'EOF'
  31278. The <info>%command.name%</info> command displays help for a given command:
  31279. <info>php %command.full_name% list</info>
  31280. You can also output the help in other formats by using the <comment>--format</comment> option:
  31281. <info>php %command.full_name% --format=xml list</info>
  31282. To display the list of available commands, please use the <info>list</info> command.
  31283. EOF
  31284. )
  31285. ;
  31286. }
  31287. public function setCommand(Command $command)
  31288. {
  31289. $this->command = $command;
  31290. }
  31291. protected function execute(InputInterface $input, OutputInterface $output)
  31292. {
  31293. if (null === $this->command) {
  31294. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  31295. }
  31296. if ($input->getOption('xml')) {
  31297. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  31298. $input->setOption('format', 'xml');
  31299. }
  31300. $helper = new DescriptorHelper();
  31301. $helper->describe($output, $this->command, array(
  31302. 'format' => $input->getOption('format'),
  31303. 'raw_text' => $input->getOption('raw'),
  31304. ));
  31305. $this->command = null;
  31306. }
  31307. }
  31308. <?php
  31309. namespace Symfony\Component\Console\Command;
  31310. use Symfony\Component\Console\Helper\DescriptorHelper;
  31311. use Symfony\Component\Console\Input\InputArgument;
  31312. use Symfony\Component\Console\Input\InputOption;
  31313. use Symfony\Component\Console\Input\InputInterface;
  31314. use Symfony\Component\Console\Output\OutputInterface;
  31315. use Symfony\Component\Console\Input\InputDefinition;
  31316. class ListCommand extends Command
  31317. {
  31318. protected function configure()
  31319. {
  31320. $this
  31321. ->setName('list')
  31322. ->setDefinition($this->createDefinition())
  31323. ->setDescription('Lists commands')
  31324. ->setHelp(<<<'EOF'
  31325. The <info>%command.name%</info> command lists all commands:
  31326. <info>php %command.full_name%</info>
  31327. You can also display the commands for a specific namespace:
  31328. <info>php %command.full_name% test</info>
  31329. You can also output the information in other formats by using the <comment>--format</comment> option:
  31330. <info>php %command.full_name% --format=xml</info>
  31331. It's also possible to get raw list of commands (useful for embedding command runner):
  31332. <info>php %command.full_name% --raw</info>
  31333. EOF
  31334. )
  31335. ;
  31336. }
  31337. public function getNativeDefinition()
  31338. {
  31339. return $this->createDefinition();
  31340. }
  31341. protected function execute(InputInterface $input, OutputInterface $output)
  31342. {
  31343. if ($input->getOption('xml')) {
  31344. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  31345. $input->setOption('format', 'xml');
  31346. }
  31347. $helper = new DescriptorHelper();
  31348. $helper->describe($output, $this->getApplication(), array(
  31349. 'format' => $input->getOption('format'),
  31350. 'raw_text' => $input->getOption('raw'),
  31351. 'namespace' => $input->getArgument('namespace'),
  31352. ));
  31353. }
  31354. private function createDefinition()
  31355. {
  31356. return new InputDefinition(array(
  31357. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  31358. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  31359. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  31360. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  31361. ));
  31362. }
  31363. }
  31364. <?php
  31365. namespace Symfony\Component\Console;
  31366. final class ConsoleEvents
  31367. {
  31368. const COMMAND = 'console.command';
  31369. const TERMINATE = 'console.terminate';
  31370. const EXCEPTION = 'console.exception';
  31371. }
  31372. <?php
  31373. namespace Symfony\Component\Console\Descriptor;
  31374. use Symfony\Component\Console\Application;
  31375. use Symfony\Component\Console\Command\Command;
  31376. use Symfony\Component\Console\Exception\CommandNotFoundException;
  31377. class ApplicationDescription
  31378. {
  31379. const GLOBAL_NAMESPACE = '_global';
  31380. private $application;
  31381. private $namespace;
  31382. private $namespaces;
  31383. private $commands;
  31384. private $aliases;
  31385. public function __construct(Application $application, $namespace = null)
  31386. {
  31387. $this->application = $application;
  31388. $this->namespace = $namespace;
  31389. }
  31390. public function getNamespaces()
  31391. {
  31392. if (null === $this->namespaces) {
  31393. $this->inspectApplication();
  31394. }
  31395. return $this->namespaces;
  31396. }
  31397. public function getCommands()
  31398. {
  31399. if (null === $this->commands) {
  31400. $this->inspectApplication();
  31401. }
  31402. return $this->commands;
  31403. }
  31404. public function getCommand($name)
  31405. {
  31406. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  31407. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  31408. }
  31409. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  31410. }
  31411. private function inspectApplication()
  31412. {
  31413. $this->commands = array();
  31414. $this->namespaces = array();
  31415. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  31416. foreach ($this->sortCommands($all) as $namespace => $commands) {
  31417. $names = array();
  31418. foreach ($commands as $name => $command) {
  31419. if (!$command->getName()) {
  31420. continue;
  31421. }
  31422. if ($command->getName() === $name) {
  31423. $this->commands[$name] = $command;
  31424. } else {
  31425. $this->aliases[$name] = $command;
  31426. }
  31427. $names[] = $name;
  31428. }
  31429. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  31430. }
  31431. }
  31432. private function sortCommands(array $commands)
  31433. {
  31434. $namespacedCommands = array();
  31435. $globalCommands = array();
  31436. foreach ($commands as $name => $command) {
  31437. $key = $this->application->extractNamespace($name, 1);
  31438. if (!$key) {
  31439. $globalCommands['_global'][$name] = $command;
  31440. } else {
  31441. $namespacedCommands[$key][$name] = $command;
  31442. }
  31443. }
  31444. ksort($namespacedCommands);
  31445. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  31446. foreach ($namespacedCommands as &$commandsSet) {
  31447. ksort($commandsSet);
  31448. }
  31449. unset($commandsSet);
  31450. return $namespacedCommands;
  31451. }
  31452. }
  31453. <?php
  31454. namespace Symfony\Component\Console\Descriptor;
  31455. use Symfony\Component\Console\Application;
  31456. use Symfony\Component\Console\Command\Command;
  31457. use Symfony\Component\Console\Input\InputArgument;
  31458. use Symfony\Component\Console\Input\InputDefinition;
  31459. use Symfony\Component\Console\Input\InputOption;
  31460. use Symfony\Component\Console\Output\OutputInterface;
  31461. use Symfony\Component\Console\Exception\InvalidArgumentException;
  31462. abstract class Descriptor implements DescriptorInterface
  31463. {
  31464. private $output;
  31465. public function describe(OutputInterface $output, $object, array $options = array())
  31466. {
  31467. $this->output = $output;
  31468. switch (true) {
  31469. case $object instanceof InputArgument:
  31470. $this->describeInputArgument($object, $options);
  31471. break;
  31472. case $object instanceof InputOption:
  31473. $this->describeInputOption($object, $options);
  31474. break;
  31475. case $object instanceof InputDefinition:
  31476. $this->describeInputDefinition($object, $options);
  31477. break;
  31478. case $object instanceof Command:
  31479. $this->describeCommand($object, $options);
  31480. break;
  31481. case $object instanceof Application:
  31482. $this->describeApplication($object, $options);
  31483. break;
  31484. default:
  31485. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object)));
  31486. }
  31487. }
  31488. protected function write($content, $decorated = false)
  31489. {
  31490. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  31491. }
  31492. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  31493. abstract protected function describeInputOption(InputOption $option, array $options = array());
  31494. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  31495. abstract protected function describeCommand(Command $command, array $options = array());
  31496. abstract protected function describeApplication(Application $application, array $options = array());
  31497. }
  31498. <?php
  31499. namespace Symfony\Component\Console\Descriptor;
  31500. use Symfony\Component\Console\Output\OutputInterface;
  31501. interface DescriptorInterface
  31502. {
  31503. public function describe(OutputInterface $output, $object, array $options = array());
  31504. }
  31505. <?php
  31506. namespace Symfony\Component\Console\Descriptor;
  31507. use Symfony\Component\Console\Application;
  31508. use Symfony\Component\Console\Command\Command;
  31509. use Symfony\Component\Console\Input\InputArgument;
  31510. use Symfony\Component\Console\Input\InputDefinition;
  31511. use Symfony\Component\Console\Input\InputOption;
  31512. class JsonDescriptor extends Descriptor
  31513. {
  31514. protected function describeInputArgument(InputArgument $argument, array $options = array())
  31515. {
  31516. $this->writeData($this->getInputArgumentData($argument), $options);
  31517. }
  31518. protected function describeInputOption(InputOption $option, array $options = array())
  31519. {
  31520. $this->writeData($this->getInputOptionData($option), $options);
  31521. }
  31522. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  31523. {
  31524. $this->writeData($this->getInputDefinitionData($definition), $options);
  31525. }
  31526. protected function describeCommand(Command $command, array $options = array())
  31527. {
  31528. $this->writeData($this->getCommandData($command), $options);
  31529. }
  31530. protected function describeApplication(Application $application, array $options = array())
  31531. {
  31532. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  31533. $description = new ApplicationDescription($application, $describedNamespace);
  31534. $commands = array();
  31535. foreach ($description->getCommands() as $command) {
  31536. $commands[] = $this->getCommandData($command);
  31537. }
  31538. $data = $describedNamespace
  31539. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  31540. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  31541. $this->writeData($data, $options);
  31542. }
  31543. private function writeData(array $data, array $options)
  31544. {
  31545. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  31546. }
  31547. private function getInputArgumentData(InputArgument $argument)
  31548. {
  31549. return array(
  31550. 'name' => $argument->getName(),
  31551. 'is_required' => $argument->isRequired(),
  31552. 'is_array' => $argument->isArray(),
  31553. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  31554. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  31555. );
  31556. }
  31557. private function getInputOptionData(InputOption $option)
  31558. {
  31559. return array(
  31560. 'name' => '--'.$option->getName(),
  31561. 'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '',
  31562. 'accept_value' => $option->acceptValue(),
  31563. 'is_value_required' => $option->isValueRequired(),
  31564. 'is_multiple' => $option->isArray(),
  31565. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  31566. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  31567. );
  31568. }
  31569. private function getInputDefinitionData(InputDefinition $definition)
  31570. {
  31571. $inputArguments = array();
  31572. foreach ($definition->getArguments() as $name => $argument) {
  31573. $inputArguments[$name] = $this->getInputArgumentData($argument);
  31574. }
  31575. $inputOptions = array();
  31576. foreach ($definition->getOptions() as $name => $option) {
  31577. $inputOptions[$name] = $this->getInputOptionData($option);
  31578. }
  31579. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  31580. }
  31581. private function getCommandData(Command $command)
  31582. {
  31583. $command->getSynopsis();
  31584. $command->mergeApplicationDefinition(false);
  31585. return array(
  31586. 'name' => $command->getName(),
  31587. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  31588. 'description' => $command->getDescription(),
  31589. 'help' => $command->getProcessedHelp(),
  31590. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  31591. );
  31592. }
  31593. }
  31594. <?php
  31595. namespace Symfony\Component\Console\Descriptor;
  31596. use Symfony\Component\Console\Application;
  31597. use Symfony\Component\Console\Command\Command;
  31598. use Symfony\Component\Console\Helper\Helper;
  31599. use Symfony\Component\Console\Input\InputArgument;
  31600. use Symfony\Component\Console\Input\InputDefinition;
  31601. use Symfony\Component\Console\Input\InputOption;
  31602. class MarkdownDescriptor extends Descriptor
  31603. {
  31604. protected function describeInputArgument(InputArgument $argument, array $options = array())
  31605. {
  31606. $this->write(
  31607. '**'.$argument->getName().':**'."\n\n"
  31608. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  31609. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  31610. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  31611. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  31612. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  31613. );
  31614. }
  31615. protected function describeInputOption(InputOption $option, array $options = array())
  31616. {
  31617. $this->write(
  31618. '**'.$option->getName().':**'."\n\n"
  31619. .'* Name: `--'.$option->getName().'`'."\n"
  31620. .'* Shortcut: '.($option->getShortcut() ? '`-'.implode('|-', explode('|', $option->getShortcut())).'`' : '<none>')."\n"
  31621. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  31622. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  31623. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  31624. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  31625. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  31626. );
  31627. }
  31628. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  31629. {
  31630. if ($showArguments = count($definition->getArguments()) > 0) {
  31631. $this->write('### Arguments:');
  31632. foreach ($definition->getArguments() as $argument) {
  31633. $this->write("\n\n");
  31634. $this->write($this->describeInputArgument($argument));
  31635. }
  31636. }
  31637. if (count($definition->getOptions()) > 0) {
  31638. if ($showArguments) {
  31639. $this->write("\n\n");
  31640. }
  31641. $this->write('### Options:');
  31642. foreach ($definition->getOptions() as $option) {
  31643. $this->write("\n\n");
  31644. $this->write($this->describeInputOption($option));
  31645. }
  31646. }
  31647. }
  31648. protected function describeCommand(Command $command, array $options = array())
  31649. {
  31650. $command->getSynopsis();
  31651. $command->mergeApplicationDefinition(false);
  31652. $this->write(
  31653. $command->getName()."\n"
  31654. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  31655. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  31656. .'* Usage:'."\n\n"
  31657. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  31658. return $carry.' * `'.$usage.'`'."\n";
  31659. })
  31660. );
  31661. if ($help = $command->getProcessedHelp()) {
  31662. $this->write("\n");
  31663. $this->write($help);
  31664. }
  31665. if ($command->getNativeDefinition()) {
  31666. $this->write("\n\n");
  31667. $this->describeInputDefinition($command->getNativeDefinition());
  31668. }
  31669. }
  31670. protected function describeApplication(Application $application, array $options = array())
  31671. {
  31672. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  31673. $description = new ApplicationDescription($application, $describedNamespace);
  31674. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  31675. foreach ($description->getNamespaces() as $namespace) {
  31676. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  31677. $this->write("\n\n");
  31678. $this->write('**'.$namespace['id'].':**');
  31679. }
  31680. $this->write("\n\n");
  31681. $this->write(implode("\n", array_map(function ($commandName) {
  31682. return '* '.$commandName;
  31683. }, $namespace['commands'])));
  31684. }
  31685. foreach ($description->getCommands() as $command) {
  31686. $this->write("\n\n");
  31687. $this->write($this->describeCommand($command));
  31688. }
  31689. }
  31690. }
  31691. <?php
  31692. namespace Symfony\Component\Console\Descriptor;
  31693. use Symfony\Component\Console\Application;
  31694. use Symfony\Component\Console\Command\Command;
  31695. use Symfony\Component\Console\Formatter\OutputFormatter;
  31696. use Symfony\Component\Console\Helper\Helper;
  31697. use Symfony\Component\Console\Input\InputArgument;
  31698. use Symfony\Component\Console\Input\InputDefinition;
  31699. use Symfony\Component\Console\Input\InputOption;
  31700. class TextDescriptor extends Descriptor
  31701. {
  31702. protected function describeInputArgument(InputArgument $argument, array $options = array())
  31703. {
  31704. if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) {
  31705. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  31706. } else {
  31707. $default = '';
  31708. }
  31709. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  31710. $spacingWidth = $totalWidth - strlen($argument->getName());
  31711. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  31712. $argument->getName(),
  31713. str_repeat(' ', $spacingWidth),
  31714. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  31715. $default
  31716. ), $options);
  31717. }
  31718. protected function describeInputOption(InputOption $option, array $options = array())
  31719. {
  31720. if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) {
  31721. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  31722. } else {
  31723. $default = '';
  31724. }
  31725. $value = '';
  31726. if ($option->acceptValue()) {
  31727. $value = '='.strtoupper($option->getName());
  31728. if ($option->isValueOptional()) {
  31729. $value = '['.$value.']';
  31730. }
  31731. }
  31732. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  31733. $synopsis = sprintf('%s%s',
  31734. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  31735. sprintf('--%s%s', $option->getName(), $value)
  31736. );
  31737. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  31738. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  31739. $synopsis,
  31740. str_repeat(' ', $spacingWidth),
  31741. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  31742. $default,
  31743. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  31744. ), $options);
  31745. }
  31746. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  31747. {
  31748. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  31749. foreach ($definition->getArguments() as $argument) {
  31750. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  31751. }
  31752. if ($definition->getArguments()) {
  31753. $this->writeText('<comment>Arguments:</comment>', $options);
  31754. $this->writeText("\n");
  31755. foreach ($definition->getArguments() as $argument) {
  31756. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  31757. $this->writeText("\n");
  31758. }
  31759. }
  31760. if ($definition->getArguments() && $definition->getOptions()) {
  31761. $this->writeText("\n");
  31762. }
  31763. if ($definition->getOptions()) {
  31764. $laterOptions = array();
  31765. $this->writeText('<comment>Options:</comment>', $options);
  31766. foreach ($definition->getOptions() as $option) {
  31767. if (strlen($option->getShortcut()) > 1) {
  31768. $laterOptions[] = $option;
  31769. continue;
  31770. }
  31771. $this->writeText("\n");
  31772. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  31773. }
  31774. foreach ($laterOptions as $option) {
  31775. $this->writeText("\n");
  31776. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  31777. }
  31778. }
  31779. }
  31780. protected function describeCommand(Command $command, array $options = array())
  31781. {
  31782. $command->getSynopsis(true);
  31783. $command->getSynopsis(false);
  31784. $command->mergeApplicationDefinition(false);
  31785. $this->writeText('<comment>Usage:</comment>', $options);
  31786. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  31787. $this->writeText("\n");
  31788. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  31789. }
  31790. $this->writeText("\n");
  31791. $definition = $command->getNativeDefinition();
  31792. if ($definition->getOptions() || $definition->getArguments()) {
  31793. $this->writeText("\n");
  31794. $this->describeInputDefinition($definition, $options);
  31795. $this->writeText("\n");
  31796. }
  31797. if ($help = $command->getProcessedHelp()) {
  31798. $this->writeText("\n");
  31799. $this->writeText('<comment>Help:</comment>', $options);
  31800. $this->writeText("\n");
  31801. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  31802. $this->writeText("\n");
  31803. }
  31804. }
  31805. protected function describeApplication(Application $application, array $options = array())
  31806. {
  31807. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  31808. $description = new ApplicationDescription($application, $describedNamespace);
  31809. if (isset($options['raw_text']) && $options['raw_text']) {
  31810. $width = $this->getColumnWidth($description->getCommands());
  31811. foreach ($description->getCommands() as $command) {
  31812. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  31813. $this->writeText("\n");
  31814. }
  31815. } else {
  31816. if ('' != $help = $application->getHelp()) {
  31817. $this->writeText("$help\n\n", $options);
  31818. }
  31819. $this->writeText("<comment>Usage:</comment>\n", $options);
  31820. $this->writeText(" command [options] [arguments]\n\n", $options);
  31821. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  31822. $this->writeText("\n");
  31823. $this->writeText("\n");
  31824. $width = $this->getColumnWidth($description->getCommands());
  31825. if ($describedNamespace) {
  31826. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  31827. } else {
  31828. $this->writeText('<comment>Available commands:</comment>', $options);
  31829. }
  31830. foreach ($description->getNamespaces() as $namespace) {
  31831. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  31832. $this->writeText("\n");
  31833. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  31834. }
  31835. foreach ($namespace['commands'] as $name) {
  31836. $this->writeText("\n");
  31837. $spacingWidth = $width - Helper::strlen($name);
  31838. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  31839. }
  31840. }
  31841. $this->writeText("\n");
  31842. }
  31843. }
  31844. private function writeText($content, array $options = array())
  31845. {
  31846. $this->write(
  31847. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  31848. isset($options['raw_output']) ? !$options['raw_output'] : true
  31849. );
  31850. }
  31851. private function formatDefaultValue($default)
  31852. {
  31853. if (INF === $default) {
  31854. return 'INF';
  31855. }
  31856. if (is_string($default)) {
  31857. $default = OutputFormatter::escape($default);
  31858. } elseif (is_array($default)) {
  31859. foreach ($default as $key => $value) {
  31860. if (is_string($value)) {
  31861. $default[$key] = OutputFormatter::escape($value);
  31862. }
  31863. }
  31864. }
  31865. if (\PHP_VERSION_ID < 50400) {
  31866. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  31867. }
  31868. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  31869. }
  31870. private function getColumnWidth(array $commands)
  31871. {
  31872. $widths = array();
  31873. foreach ($commands as $command) {
  31874. $widths[] = Helper::strlen($command->getName());
  31875. foreach ($command->getAliases() as $alias) {
  31876. $widths[] = Helper::strlen($alias);
  31877. }
  31878. }
  31879. return max($widths) + 2;
  31880. }
  31881. private function calculateTotalWidthForOptions(array $options)
  31882. {
  31883. $totalWidth = 0;
  31884. foreach ($options as $option) {
  31885. $nameLength = 1 + max(strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  31886. if ($option->acceptValue()) {
  31887. $valueLength = 1 + Helper::strlen($option->getName());
  31888. $valueLength += $option->isValueOptional() ? 2 : 0;
  31889. $nameLength += $valueLength;
  31890. }
  31891. $totalWidth = max($totalWidth, $nameLength);
  31892. }
  31893. return $totalWidth;
  31894. }
  31895. }
  31896. <?php
  31897. namespace Symfony\Component\Console\Descriptor;
  31898. use Symfony\Component\Console\Application;
  31899. use Symfony\Component\Console\Command\Command;
  31900. use Symfony\Component\Console\Input\InputArgument;
  31901. use Symfony\Component\Console\Input\InputDefinition;
  31902. use Symfony\Component\Console\Input\InputOption;
  31903. class XmlDescriptor extends Descriptor
  31904. {
  31905. public function getInputDefinitionDocument(InputDefinition $definition)
  31906. {
  31907. $dom = new \DOMDocument('1.0', 'UTF-8');
  31908. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  31909. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  31910. foreach ($definition->getArguments() as $argument) {
  31911. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  31912. }
  31913. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  31914. foreach ($definition->getOptions() as $option) {
  31915. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  31916. }
  31917. return $dom;
  31918. }
  31919. public function getCommandDocument(Command $command)
  31920. {
  31921. $dom = new \DOMDocument('1.0', 'UTF-8');
  31922. $dom->appendChild($commandXML = $dom->createElement('command'));
  31923. $command->getSynopsis();
  31924. $command->mergeApplicationDefinition(false);
  31925. $commandXML->setAttribute('id', $command->getName());
  31926. $commandXML->setAttribute('name', $command->getName());
  31927. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  31928. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  31929. $usagesXML->appendChild($dom->createElement('usage', $usage));
  31930. }
  31931. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  31932. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  31933. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  31934. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  31935. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  31936. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  31937. return $dom;
  31938. }
  31939. public function getApplicationDocument(Application $application, $namespace = null)
  31940. {
  31941. $dom = new \DOMDocument('1.0', 'UTF-8');
  31942. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  31943. if ('UNKNOWN' !== $application->getName()) {
  31944. $rootXml->setAttribute('name', $application->getName());
  31945. if ('UNKNOWN' !== $application->getVersion()) {
  31946. $rootXml->setAttribute('version', $application->getVersion());
  31947. }
  31948. }
  31949. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  31950. $description = new ApplicationDescription($application, $namespace);
  31951. if ($namespace) {
  31952. $commandsXML->setAttribute('namespace', $namespace);
  31953. }
  31954. foreach ($description->getCommands() as $command) {
  31955. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  31956. }
  31957. if (!$namespace) {
  31958. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  31959. foreach ($description->getNamespaces() as $namespaceDescription) {
  31960. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  31961. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  31962. foreach ($namespaceDescription['commands'] as $name) {
  31963. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  31964. $commandXML->appendChild($dom->createTextNode($name));
  31965. }
  31966. }
  31967. }
  31968. return $dom;
  31969. }
  31970. protected function describeInputArgument(InputArgument $argument, array $options = array())
  31971. {
  31972. $this->writeDocument($this->getInputArgumentDocument($argument));
  31973. }
  31974. protected function describeInputOption(InputOption $option, array $options = array())
  31975. {
  31976. $this->writeDocument($this->getInputOptionDocument($option));
  31977. }
  31978. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  31979. {
  31980. $this->writeDocument($this->getInputDefinitionDocument($definition));
  31981. }
  31982. protected function describeCommand(Command $command, array $options = array())
  31983. {
  31984. $this->writeDocument($this->getCommandDocument($command));
  31985. }
  31986. protected function describeApplication(Application $application, array $options = array())
  31987. {
  31988. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  31989. }
  31990. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  31991. {
  31992. foreach ($importedParent->childNodes as $childNode) {
  31993. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  31994. }
  31995. }
  31996. private function writeDocument(\DOMDocument $dom)
  31997. {
  31998. $dom->formatOutput = true;
  31999. $this->write($dom->saveXML());
  32000. }
  32001. private function getInputArgumentDocument(InputArgument $argument)
  32002. {
  32003. $dom = new \DOMDocument('1.0', 'UTF-8');
  32004. $dom->appendChild($objectXML = $dom->createElement('argument'));
  32005. $objectXML->setAttribute('name', $argument->getName());
  32006. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  32007. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  32008. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  32009. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  32010. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  32011. $defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  32012. foreach ($defaults as $default) {
  32013. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  32014. $defaultXML->appendChild($dom->createTextNode($default));
  32015. }
  32016. return $dom;
  32017. }
  32018. private function getInputOptionDocument(InputOption $option)
  32019. {
  32020. $dom = new \DOMDocument('1.0', 'UTF-8');
  32021. $dom->appendChild($objectXML = $dom->createElement('option'));
  32022. $objectXML->setAttribute('name', '--'.$option->getName());
  32023. $pos = strpos($option->getShortcut(), '|');
  32024. if (false !== $pos) {
  32025. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  32026. $objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut())));
  32027. } else {
  32028. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  32029. }
  32030. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  32031. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  32032. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  32033. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  32034. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  32035. if ($option->acceptValue()) {
  32036. $defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  32037. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  32038. if (!empty($defaults)) {
  32039. foreach ($defaults as $default) {
  32040. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  32041. $defaultXML->appendChild($dom->createTextNode($default));
  32042. }
  32043. }
  32044. }
  32045. return $dom;
  32046. }
  32047. }
  32048. <?php
  32049. namespace Symfony\Component\Console\Event;
  32050. class ConsoleCommandEvent extends ConsoleEvent
  32051. {
  32052. const RETURN_CODE_DISABLED = 113;
  32053. private $commandShouldRun = true;
  32054. public function disableCommand()
  32055. {
  32056. return $this->commandShouldRun = false;
  32057. }
  32058. public function enableCommand()
  32059. {
  32060. return $this->commandShouldRun = true;
  32061. }
  32062. public function commandShouldRun()
  32063. {
  32064. return $this->commandShouldRun;
  32065. }
  32066. }
  32067. <?php
  32068. namespace Symfony\Component\Console\Event;
  32069. use Symfony\Component\Console\Command\Command;
  32070. use Symfony\Component\Console\Input\InputInterface;
  32071. use Symfony\Component\Console\Output\OutputInterface;
  32072. use Symfony\Component\EventDispatcher\Event;
  32073. class ConsoleEvent extends Event
  32074. {
  32075. protected $command;
  32076. private $input;
  32077. private $output;
  32078. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  32079. {
  32080. $this->command = $command;
  32081. $this->input = $input;
  32082. $this->output = $output;
  32083. }
  32084. public function getCommand()
  32085. {
  32086. return $this->command;
  32087. }
  32088. public function getInput()
  32089. {
  32090. return $this->input;
  32091. }
  32092. public function getOutput()
  32093. {
  32094. return $this->output;
  32095. }
  32096. }
  32097. <?php
  32098. namespace Symfony\Component\Console\Event;
  32099. use Symfony\Component\Console\Command\Command;
  32100. use Symfony\Component\Console\Input\InputInterface;
  32101. use Symfony\Component\Console\Output\OutputInterface;
  32102. class ConsoleExceptionEvent extends ConsoleEvent
  32103. {
  32104. private $exception;
  32105. private $exitCode;
  32106. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  32107. {
  32108. parent::__construct($command, $input, $output);
  32109. $this->setException($exception);
  32110. $this->exitCode = (int) $exitCode;
  32111. }
  32112. public function getException()
  32113. {
  32114. return $this->exception;
  32115. }
  32116. public function setException(\Exception $exception)
  32117. {
  32118. $this->exception = $exception;
  32119. }
  32120. public function getExitCode()
  32121. {
  32122. return $this->exitCode;
  32123. }
  32124. }
  32125. <?php
  32126. namespace Symfony\Component\Console\Event;
  32127. use Symfony\Component\Console\Command\Command;
  32128. use Symfony\Component\Console\Input\InputInterface;
  32129. use Symfony\Component\Console\Output\OutputInterface;
  32130. class ConsoleTerminateEvent extends ConsoleEvent
  32131. {
  32132. private $exitCode;
  32133. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  32134. {
  32135. parent::__construct($command, $input, $output);
  32136. $this->setExitCode($exitCode);
  32137. }
  32138. public function setExitCode($exitCode)
  32139. {
  32140. $this->exitCode = (int) $exitCode;
  32141. }
  32142. public function getExitCode()
  32143. {
  32144. return $this->exitCode;
  32145. }
  32146. }
  32147. <?php
  32148. namespace Symfony\Component\Console\Exception;
  32149. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  32150. {
  32151. private $alternatives;
  32152. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  32153. {
  32154. parent::__construct($message, $code, $previous);
  32155. $this->alternatives = $alternatives;
  32156. }
  32157. public function getAlternatives()
  32158. {
  32159. return $this->alternatives;
  32160. }
  32161. }
  32162. <?php
  32163. namespace Symfony\Component\Console\Exception;
  32164. interface ExceptionInterface
  32165. {
  32166. }
  32167. <?php
  32168. namespace Symfony\Component\Console\Exception;
  32169. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  32170. {
  32171. }
  32172. <?php
  32173. namespace Symfony\Component\Console\Exception;
  32174. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  32175. {
  32176. }
  32177. <?php
  32178. namespace Symfony\Component\Console\Exception;
  32179. class LogicException extends \LogicException implements ExceptionInterface
  32180. {
  32181. }
  32182. <?php
  32183. namespace Symfony\Component\Console\Exception;
  32184. class RuntimeException extends \RuntimeException implements ExceptionInterface
  32185. {
  32186. }
  32187. <?php
  32188. namespace Symfony\Component\Console\Formatter;
  32189. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32190. class OutputFormatter implements OutputFormatterInterface
  32191. {
  32192. private $decorated;
  32193. private $styles = array();
  32194. private $styleStack;
  32195. public static function escape($text)
  32196. {
  32197. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  32198. return self::escapeTrailingBackslash($text);
  32199. }
  32200. public static function escapeTrailingBackslash($text)
  32201. {
  32202. if ('\\' === substr($text, -1)) {
  32203. $len = strlen($text);
  32204. $text = rtrim($text, '\\');
  32205. $text = str_replace("\0", '', $text);
  32206. $text .= str_repeat("\0", $len - strlen($text));
  32207. }
  32208. return $text;
  32209. }
  32210. public function __construct($decorated = false, array $styles = array())
  32211. {
  32212. $this->decorated = (bool) $decorated;
  32213. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  32214. $this->setStyle('info', new OutputFormatterStyle('green'));
  32215. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  32216. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  32217. foreach ($styles as $name => $style) {
  32218. $this->setStyle($name, $style);
  32219. }
  32220. $this->styleStack = new OutputFormatterStyleStack();
  32221. }
  32222. public function setDecorated($decorated)
  32223. {
  32224. $this->decorated = (bool) $decorated;
  32225. }
  32226. public function isDecorated()
  32227. {
  32228. return $this->decorated;
  32229. }
  32230. public function setStyle($name, OutputFormatterStyleInterface $style)
  32231. {
  32232. $this->styles[strtolower($name)] = $style;
  32233. }
  32234. public function hasStyle($name)
  32235. {
  32236. return isset($this->styles[strtolower($name)]);
  32237. }
  32238. public function getStyle($name)
  32239. {
  32240. if (!$this->hasStyle($name)) {
  32241. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  32242. }
  32243. return $this->styles[strtolower($name)];
  32244. }
  32245. public function format($message)
  32246. {
  32247. $message = (string) $message;
  32248. $offset = 0;
  32249. $output = '';
  32250. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  32251. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  32252. foreach ($matches[0] as $i => $match) {
  32253. $pos = $match[1];
  32254. $text = $match[0];
  32255. if (0 != $pos && '\\' == $message[$pos - 1]) {
  32256. continue;
  32257. }
  32258. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  32259. $offset = $pos + strlen($text);
  32260. if ($open = '/' != $text[1]) {
  32261. $tag = $matches[1][$i][0];
  32262. } else {
  32263. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  32264. }
  32265. if (!$open && !$tag) {
  32266. $this->styleStack->pop();
  32267. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  32268. $output .= $this->applyCurrentStyle($text);
  32269. } elseif ($open) {
  32270. $this->styleStack->push($style);
  32271. } else {
  32272. $this->styleStack->pop($style);
  32273. }
  32274. }
  32275. $output .= $this->applyCurrentStyle(substr($message, $offset));
  32276. if (false !== strpos($output, "\0")) {
  32277. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  32278. }
  32279. return str_replace('\\<', '<', $output);
  32280. }
  32281. public function getStyleStack()
  32282. {
  32283. return $this->styleStack;
  32284. }
  32285. private function createStyleFromString($string)
  32286. {
  32287. if (isset($this->styles[$string])) {
  32288. return $this->styles[$string];
  32289. }
  32290. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  32291. return false;
  32292. }
  32293. $style = new OutputFormatterStyle();
  32294. foreach ($matches as $match) {
  32295. array_shift($match);
  32296. if ('fg' == $match[0]) {
  32297. $style->setForeground($match[1]);
  32298. } elseif ('bg' == $match[0]) {
  32299. $style->setBackground($match[1]);
  32300. } else {
  32301. try {
  32302. $style->setOption($match[1]);
  32303. } catch (\InvalidArgumentException $e) {
  32304. return false;
  32305. }
  32306. }
  32307. }
  32308. return $style;
  32309. }
  32310. private function applyCurrentStyle($text)
  32311. {
  32312. return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  32313. }
  32314. }
  32315. <?php
  32316. namespace Symfony\Component\Console\Formatter;
  32317. interface OutputFormatterInterface
  32318. {
  32319. public function setDecorated($decorated);
  32320. public function isDecorated();
  32321. public function setStyle($name, OutputFormatterStyleInterface $style);
  32322. public function hasStyle($name);
  32323. public function getStyle($name);
  32324. public function format($message);
  32325. }
  32326. <?php
  32327. namespace Symfony\Component\Console\Formatter;
  32328. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32329. class OutputFormatterStyle implements OutputFormatterStyleInterface
  32330. {
  32331. private static $availableForegroundColors = array(
  32332. 'black' => array('set' => 30, 'unset' => 39),
  32333. 'red' => array('set' => 31, 'unset' => 39),
  32334. 'green' => array('set' => 32, 'unset' => 39),
  32335. 'yellow' => array('set' => 33, 'unset' => 39),
  32336. 'blue' => array('set' => 34, 'unset' => 39),
  32337. 'magenta' => array('set' => 35, 'unset' => 39),
  32338. 'cyan' => array('set' => 36, 'unset' => 39),
  32339. 'white' => array('set' => 37, 'unset' => 39),
  32340. 'default' => array('set' => 39, 'unset' => 39),
  32341. );
  32342. private static $availableBackgroundColors = array(
  32343. 'black' => array('set' => 40, 'unset' => 49),
  32344. 'red' => array('set' => 41, 'unset' => 49),
  32345. 'green' => array('set' => 42, 'unset' => 49),
  32346. 'yellow' => array('set' => 43, 'unset' => 49),
  32347. 'blue' => array('set' => 44, 'unset' => 49),
  32348. 'magenta' => array('set' => 45, 'unset' => 49),
  32349. 'cyan' => array('set' => 46, 'unset' => 49),
  32350. 'white' => array('set' => 47, 'unset' => 49),
  32351. 'default' => array('set' => 49, 'unset' => 49),
  32352. );
  32353. private static $availableOptions = array(
  32354. 'bold' => array('set' => 1, 'unset' => 22),
  32355. 'underscore' => array('set' => 4, 'unset' => 24),
  32356. 'blink' => array('set' => 5, 'unset' => 25),
  32357. 'reverse' => array('set' => 7, 'unset' => 27),
  32358. 'conceal' => array('set' => 8, 'unset' => 28),
  32359. );
  32360. private $foreground;
  32361. private $background;
  32362. private $options = array();
  32363. public function __construct($foreground = null, $background = null, array $options = array())
  32364. {
  32365. if (null !== $foreground) {
  32366. $this->setForeground($foreground);
  32367. }
  32368. if (null !== $background) {
  32369. $this->setBackground($background);
  32370. }
  32371. if (count($options)) {
  32372. $this->setOptions($options);
  32373. }
  32374. }
  32375. public function setForeground($color = null)
  32376. {
  32377. if (null === $color) {
  32378. $this->foreground = null;
  32379. return;
  32380. }
  32381. if (!isset(static::$availableForegroundColors[$color])) {
  32382. throw new InvalidArgumentException(sprintf(
  32383. 'Invalid foreground color specified: "%s". Expected one of (%s)',
  32384. $color,
  32385. implode(', ', array_keys(static::$availableForegroundColors))
  32386. ));
  32387. }
  32388. $this->foreground = static::$availableForegroundColors[$color];
  32389. }
  32390. public function setBackground($color = null)
  32391. {
  32392. if (null === $color) {
  32393. $this->background = null;
  32394. return;
  32395. }
  32396. if (!isset(static::$availableBackgroundColors[$color])) {
  32397. throw new InvalidArgumentException(sprintf(
  32398. 'Invalid background color specified: "%s". Expected one of (%s)',
  32399. $color,
  32400. implode(', ', array_keys(static::$availableBackgroundColors))
  32401. ));
  32402. }
  32403. $this->background = static::$availableBackgroundColors[$color];
  32404. }
  32405. public function setOption($option)
  32406. {
  32407. if (!isset(static::$availableOptions[$option])) {
  32408. throw new InvalidArgumentException(sprintf(
  32409. 'Invalid option specified: "%s". Expected one of (%s)',
  32410. $option,
  32411. implode(', ', array_keys(static::$availableOptions))
  32412. ));
  32413. }
  32414. if (!in_array(static::$availableOptions[$option], $this->options)) {
  32415. $this->options[] = static::$availableOptions[$option];
  32416. }
  32417. }
  32418. public function unsetOption($option)
  32419. {
  32420. if (!isset(static::$availableOptions[$option])) {
  32421. throw new InvalidArgumentException(sprintf(
  32422. 'Invalid option specified: "%s". Expected one of (%s)',
  32423. $option,
  32424. implode(', ', array_keys(static::$availableOptions))
  32425. ));
  32426. }
  32427. $pos = array_search(static::$availableOptions[$option], $this->options);
  32428. if (false !== $pos) {
  32429. unset($this->options[$pos]);
  32430. }
  32431. }
  32432. public function setOptions(array $options)
  32433. {
  32434. $this->options = array();
  32435. foreach ($options as $option) {
  32436. $this->setOption($option);
  32437. }
  32438. }
  32439. public function apply($text)
  32440. {
  32441. $setCodes = array();
  32442. $unsetCodes = array();
  32443. if (null !== $this->foreground) {
  32444. $setCodes[] = $this->foreground['set'];
  32445. $unsetCodes[] = $this->foreground['unset'];
  32446. }
  32447. if (null !== $this->background) {
  32448. $setCodes[] = $this->background['set'];
  32449. $unsetCodes[] = $this->background['unset'];
  32450. }
  32451. if (count($this->options)) {
  32452. foreach ($this->options as $option) {
  32453. $setCodes[] = $option['set'];
  32454. $unsetCodes[] = $option['unset'];
  32455. }
  32456. }
  32457. if (0 === count($setCodes)) {
  32458. return $text;
  32459. }
  32460. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  32461. }
  32462. }
  32463. <?php
  32464. namespace Symfony\Component\Console\Formatter;
  32465. interface OutputFormatterStyleInterface
  32466. {
  32467. public function setForeground($color = null);
  32468. public function setBackground($color = null);
  32469. public function setOption($option);
  32470. public function unsetOption($option);
  32471. public function setOptions(array $options);
  32472. public function apply($text);
  32473. }
  32474. <?php
  32475. namespace Symfony\Component\Console\Formatter;
  32476. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32477. class OutputFormatterStyleStack
  32478. {
  32479. private $styles;
  32480. private $emptyStyle;
  32481. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  32482. {
  32483. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  32484. $this->reset();
  32485. }
  32486. public function reset()
  32487. {
  32488. $this->styles = array();
  32489. }
  32490. public function push(OutputFormatterStyleInterface $style)
  32491. {
  32492. $this->styles[] = $style;
  32493. }
  32494. public function pop(OutputFormatterStyleInterface $style = null)
  32495. {
  32496. if (empty($this->styles)) {
  32497. return $this->emptyStyle;
  32498. }
  32499. if (null === $style) {
  32500. return array_pop($this->styles);
  32501. }
  32502. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  32503. if ($style->apply('') === $stackedStyle->apply('')) {
  32504. $this->styles = array_slice($this->styles, 0, $index);
  32505. return $stackedStyle;
  32506. }
  32507. }
  32508. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  32509. }
  32510. public function getCurrent()
  32511. {
  32512. if (empty($this->styles)) {
  32513. return $this->emptyStyle;
  32514. }
  32515. return $this->styles[count($this->styles) - 1];
  32516. }
  32517. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  32518. {
  32519. $this->emptyStyle = $emptyStyle;
  32520. return $this;
  32521. }
  32522. public function getEmptyStyle()
  32523. {
  32524. return $this->emptyStyle;
  32525. }
  32526. }
  32527. <?php
  32528. namespace Symfony\Component\Console\Helper;
  32529. class DebugFormatterHelper extends Helper
  32530. {
  32531. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  32532. private $started = array();
  32533. private $count = -1;
  32534. public function start($id, $message, $prefix = 'RUN')
  32535. {
  32536. $this->started[$id] = array('border' => ++$this->count % count($this->colors));
  32537. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  32538. }
  32539. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  32540. {
  32541. $message = '';
  32542. if ($error) {
  32543. if (isset($this->started[$id]['out'])) {
  32544. $message .= "\n";
  32545. unset($this->started[$id]['out']);
  32546. }
  32547. if (!isset($this->started[$id]['err'])) {
  32548. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  32549. $this->started[$id]['err'] = true;
  32550. }
  32551. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  32552. } else {
  32553. if (isset($this->started[$id]['err'])) {
  32554. $message .= "\n";
  32555. unset($this->started[$id]['err']);
  32556. }
  32557. if (!isset($this->started[$id]['out'])) {
  32558. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  32559. $this->started[$id]['out'] = true;
  32560. }
  32561. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  32562. }
  32563. return $message;
  32564. }
  32565. public function stop($id, $message, $successful, $prefix = 'RES')
  32566. {
  32567. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  32568. if ($successful) {
  32569. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  32570. }
  32571. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  32572. unset($this->started[$id]['out'], $this->started[$id]['err']);
  32573. return $message;
  32574. }
  32575. private function getBorder($id)
  32576. {
  32577. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  32578. }
  32579. public function getName()
  32580. {
  32581. return 'debug_formatter';
  32582. }
  32583. }
  32584. <?php
  32585. namespace Symfony\Component\Console\Helper;
  32586. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  32587. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  32588. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  32589. use Symfony\Component\Console\Descriptor\TextDescriptor;
  32590. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  32591. use Symfony\Component\Console\Output\OutputInterface;
  32592. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32593. class DescriptorHelper extends Helper
  32594. {
  32595. private $descriptors = array();
  32596. public function __construct()
  32597. {
  32598. $this
  32599. ->register('txt', new TextDescriptor())
  32600. ->register('xml', new XmlDescriptor())
  32601. ->register('json', new JsonDescriptor())
  32602. ->register('md', new MarkdownDescriptor())
  32603. ;
  32604. }
  32605. public function describe(OutputInterface $output, $object, array $options = array())
  32606. {
  32607. $options = array_merge(array(
  32608. 'raw_text' => false,
  32609. 'format' => 'txt',
  32610. ), $options);
  32611. if (!isset($this->descriptors[$options['format']])) {
  32612. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  32613. }
  32614. $descriptor = $this->descriptors[$options['format']];
  32615. $descriptor->describe($output, $object, $options);
  32616. }
  32617. public function register($format, DescriptorInterface $descriptor)
  32618. {
  32619. $this->descriptors[$format] = $descriptor;
  32620. return $this;
  32621. }
  32622. public function getName()
  32623. {
  32624. return 'descriptor';
  32625. }
  32626. }
  32627. <?php
  32628. namespace Symfony\Component\Console\Helper;
  32629. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32630. use Symfony\Component\Console\Exception\RuntimeException;
  32631. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  32632. use Symfony\Component\Console\Output\OutputInterface;
  32633. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  32634. class DialogHelper extends InputAwareHelper
  32635. {
  32636. private $inputStream;
  32637. private static $shell;
  32638. private static $stty;
  32639. public function __construct($triggerDeprecationError = true)
  32640. {
  32641. if ($triggerDeprecationError) {
  32642. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  32643. }
  32644. }
  32645. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  32646. {
  32647. if ($output instanceof ConsoleOutputInterface) {
  32648. $output = $output->getErrorOutput();
  32649. }
  32650. $width = max(array_map('strlen', array_keys($choices)));
  32651. $messages = (array) $question;
  32652. foreach ($choices as $key => $value) {
  32653. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  32654. }
  32655. $output->writeln($messages);
  32656. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  32657. $selectedChoices = str_replace(' ', '', $picked);
  32658. if ($multiselect) {
  32659. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  32660. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  32661. }
  32662. $selectedChoices = explode(',', $selectedChoices);
  32663. } else {
  32664. $selectedChoices = array($picked);
  32665. }
  32666. $multiselectChoices = array();
  32667. foreach ($selectedChoices as $value) {
  32668. if (empty($choices[$value])) {
  32669. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  32670. }
  32671. $multiselectChoices[] = $value;
  32672. }
  32673. if ($multiselect) {
  32674. return $multiselectChoices;
  32675. }
  32676. return $picked;
  32677. }, $attempts, $default);
  32678. return $result;
  32679. }
  32680. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  32681. {
  32682. if ($this->input && !$this->input->isInteractive()) {
  32683. return $default;
  32684. }
  32685. if ($output instanceof ConsoleOutputInterface) {
  32686. $output = $output->getErrorOutput();
  32687. }
  32688. $output->write($question);
  32689. $inputStream = $this->inputStream ?: STDIN;
  32690. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  32691. $ret = fgets($inputStream, 4096);
  32692. if (false === $ret) {
  32693. throw new RuntimeException('Aborted');
  32694. }
  32695. $ret = trim($ret);
  32696. } else {
  32697. $ret = '';
  32698. $i = 0;
  32699. $ofs = -1;
  32700. $matches = $autocomplete;
  32701. $numMatches = count($matches);
  32702. $sttyMode = shell_exec('stty -g');
  32703. shell_exec('stty -icanon -echo');
  32704. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  32705. while (!feof($inputStream)) {
  32706. $c = fread($inputStream, 1);
  32707. if ("\177" === $c) {
  32708. if (0 === $numMatches && 0 !== $i) {
  32709. --$i;
  32710. $output->write("\033[1D");
  32711. }
  32712. if (0 === $i) {
  32713. $ofs = -1;
  32714. $matches = $autocomplete;
  32715. $numMatches = count($matches);
  32716. } else {
  32717. $numMatches = 0;
  32718. }
  32719. $ret = substr($ret, 0, $i);
  32720. } elseif ("\033" === $c) {
  32721. $c .= fread($inputStream, 2);
  32722. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  32723. if ('A' === $c[2] && -1 === $ofs) {
  32724. $ofs = 0;
  32725. }
  32726. if (0 === $numMatches) {
  32727. continue;
  32728. }
  32729. $ofs += ('A' === $c[2]) ? -1 : 1;
  32730. $ofs = ($numMatches + $ofs) % $numMatches;
  32731. }
  32732. } elseif (ord($c) < 32) {
  32733. if ("\t" === $c || "\n" === $c) {
  32734. if ($numMatches > 0 && -1 !== $ofs) {
  32735. $ret = $matches[$ofs];
  32736. $output->write(substr($ret, $i));
  32737. $i = strlen($ret);
  32738. }
  32739. if ("\n" === $c) {
  32740. $output->write($c);
  32741. break;
  32742. }
  32743. $numMatches = 0;
  32744. }
  32745. continue;
  32746. } else {
  32747. $output->write($c);
  32748. $ret .= $c;
  32749. ++$i;
  32750. $numMatches = 0;
  32751. $ofs = 0;
  32752. foreach ($autocomplete as $value) {
  32753. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  32754. $matches[$numMatches++] = $value;
  32755. }
  32756. }
  32757. }
  32758. $output->write("\033[K");
  32759. if ($numMatches > 0 && -1 !== $ofs) {
  32760. $output->write("\0337");
  32761. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  32762. $output->write("\0338");
  32763. }
  32764. }
  32765. shell_exec(sprintf('stty %s', $sttyMode));
  32766. }
  32767. return strlen($ret) > 0 ? $ret : $default;
  32768. }
  32769. public function askConfirmation(OutputInterface $output, $question, $default = true)
  32770. {
  32771. $answer = 'z';
  32772. while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) {
  32773. $answer = $this->ask($output, $question);
  32774. }
  32775. if (false === $default) {
  32776. return $answer && 'y' == strtolower($answer[0]);
  32777. }
  32778. return !$answer || 'y' == strtolower($answer[0]);
  32779. }
  32780. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  32781. {
  32782. if ($output instanceof ConsoleOutputInterface) {
  32783. $output = $output->getErrorOutput();
  32784. }
  32785. if ('\\' === DIRECTORY_SEPARATOR) {
  32786. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  32787. if ('phar:' === substr(__FILE__, 0, 5)) {
  32788. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  32789. copy($exe, $tmpExe);
  32790. $exe = $tmpExe;
  32791. }
  32792. $output->write($question);
  32793. $value = rtrim(shell_exec($exe));
  32794. $output->writeln('');
  32795. if (isset($tmpExe)) {
  32796. unlink($tmpExe);
  32797. }
  32798. return $value;
  32799. }
  32800. if ($this->hasSttyAvailable()) {
  32801. $output->write($question);
  32802. $sttyMode = shell_exec('stty -g');
  32803. shell_exec('stty -echo');
  32804. $value = fgets($this->inputStream ?: STDIN, 4096);
  32805. shell_exec(sprintf('stty %s', $sttyMode));
  32806. if (false === $value) {
  32807. throw new RuntimeException('Aborted');
  32808. }
  32809. $value = trim($value);
  32810. $output->writeln('');
  32811. return $value;
  32812. }
  32813. if (false !== $shell = $this->getShell()) {
  32814. $output->write($question);
  32815. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  32816. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  32817. $value = rtrim(shell_exec($command));
  32818. $output->writeln('');
  32819. return $value;
  32820. }
  32821. if ($fallback) {
  32822. return $this->ask($output, $question);
  32823. }
  32824. throw new RuntimeException('Unable to hide the response');
  32825. }
  32826. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  32827. {
  32828. $that = $this;
  32829. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  32830. return $that->ask($output, $question, $default, $autocomplete);
  32831. };
  32832. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  32833. }
  32834. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  32835. {
  32836. $that = $this;
  32837. $interviewer = function () use ($output, $question, $fallback, $that) {
  32838. return $that->askHiddenResponse($output, $question, $fallback);
  32839. };
  32840. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  32841. }
  32842. public function setInputStream($stream)
  32843. {
  32844. $this->inputStream = $stream;
  32845. }
  32846. public function getInputStream()
  32847. {
  32848. return $this->inputStream;
  32849. }
  32850. public function getName()
  32851. {
  32852. return 'dialog';
  32853. }
  32854. private function getShell()
  32855. {
  32856. if (null !== self::$shell) {
  32857. return self::$shell;
  32858. }
  32859. self::$shell = false;
  32860. if (file_exists('/usr/bin/env')) {
  32861. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  32862. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  32863. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  32864. self::$shell = $sh;
  32865. break;
  32866. }
  32867. }
  32868. }
  32869. return self::$shell;
  32870. }
  32871. private function hasSttyAvailable()
  32872. {
  32873. if (null !== self::$stty) {
  32874. return self::$stty;
  32875. }
  32876. exec('stty 2>&1', $output, $exitcode);
  32877. return self::$stty = 0 === $exitcode;
  32878. }
  32879. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  32880. {
  32881. if ($output instanceof ConsoleOutputInterface) {
  32882. $output = $output->getErrorOutput();
  32883. }
  32884. $e = null;
  32885. while (false === $attempts || $attempts--) {
  32886. if (null !== $e) {
  32887. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  32888. }
  32889. try {
  32890. return call_user_func($validator, $interviewer());
  32891. } catch (\Exception $e) {
  32892. }
  32893. }
  32894. throw $e;
  32895. }
  32896. }
  32897. <?php
  32898. namespace Symfony\Component\Console\Helper;
  32899. use Symfony\Component\Console\Formatter\OutputFormatter;
  32900. class FormatterHelper extends Helper
  32901. {
  32902. public function formatSection($section, $message, $style = 'info')
  32903. {
  32904. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  32905. }
  32906. public function formatBlock($messages, $style, $large = false)
  32907. {
  32908. if (!is_array($messages)) {
  32909. $messages = array($messages);
  32910. }
  32911. $len = 0;
  32912. $lines = array();
  32913. foreach ($messages as $message) {
  32914. $message = OutputFormatter::escape($message);
  32915. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  32916. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  32917. }
  32918. $messages = $large ? array(str_repeat(' ', $len)) : array();
  32919. for ($i = 0; isset($lines[$i]); ++$i) {
  32920. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  32921. }
  32922. if ($large) {
  32923. $messages[] = str_repeat(' ', $len);
  32924. }
  32925. for ($i = 0; isset($messages[$i]); ++$i) {
  32926. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  32927. }
  32928. return implode("\n", $messages);
  32929. }
  32930. public function getName()
  32931. {
  32932. return 'formatter';
  32933. }
  32934. }
  32935. <?php
  32936. namespace Symfony\Component\Console\Helper;
  32937. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  32938. abstract class Helper implements HelperInterface
  32939. {
  32940. protected $helperSet = null;
  32941. public function setHelperSet(HelperSet $helperSet = null)
  32942. {
  32943. $this->helperSet = $helperSet;
  32944. }
  32945. public function getHelperSet()
  32946. {
  32947. return $this->helperSet;
  32948. }
  32949. public static function strlen($string)
  32950. {
  32951. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  32952. return strlen($string);
  32953. }
  32954. return mb_strwidth($string, $encoding);
  32955. }
  32956. public static function formatTime($secs)
  32957. {
  32958. static $timeFormats = array(
  32959. array(0, '< 1 sec'),
  32960. array(1, '1 sec'),
  32961. array(2, 'secs', 1),
  32962. array(60, '1 min'),
  32963. array(120, 'mins', 60),
  32964. array(3600, '1 hr'),
  32965. array(7200, 'hrs', 3600),
  32966. array(86400, '1 day'),
  32967. array(172800, 'days', 86400),
  32968. );
  32969. foreach ($timeFormats as $index => $format) {
  32970. if ($secs >= $format[0]) {
  32971. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  32972. || $index == count($timeFormats) - 1
  32973. ) {
  32974. if (2 == count($format)) {
  32975. return $format[1];
  32976. }
  32977. return floor($secs / $format[2]).' '.$format[1];
  32978. }
  32979. }
  32980. }
  32981. }
  32982. public static function formatMemory($memory)
  32983. {
  32984. if ($memory >= 1024 * 1024 * 1024) {
  32985. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  32986. }
  32987. if ($memory >= 1024 * 1024) {
  32988. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  32989. }
  32990. if ($memory >= 1024) {
  32991. return sprintf('%d KiB', $memory / 1024);
  32992. }
  32993. return sprintf('%d B', $memory);
  32994. }
  32995. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  32996. {
  32997. return self::strlen(self::removeDecoration($formatter, $string));
  32998. }
  32999. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  33000. {
  33001. $isDecorated = $formatter->isDecorated();
  33002. $formatter->setDecorated(false);
  33003. $string = $formatter->format($string);
  33004. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  33005. $formatter->setDecorated($isDecorated);
  33006. return $string;
  33007. }
  33008. }
  33009. <?php
  33010. namespace Symfony\Component\Console\Helper;
  33011. interface HelperInterface
  33012. {
  33013. public function setHelperSet(HelperSet $helperSet = null);
  33014. public function getHelperSet();
  33015. public function getName();
  33016. }
  33017. <?php
  33018. namespace Symfony\Component\Console\Helper;
  33019. use Symfony\Component\Console\Command\Command;
  33020. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33021. class HelperSet implements \IteratorAggregate
  33022. {
  33023. private $helpers = array();
  33024. private $command;
  33025. public function __construct(array $helpers = array())
  33026. {
  33027. foreach ($helpers as $alias => $helper) {
  33028. $this->set($helper, is_int($alias) ? null : $alias);
  33029. }
  33030. }
  33031. public function set(HelperInterface $helper, $alias = null)
  33032. {
  33033. $this->helpers[$helper->getName()] = $helper;
  33034. if (null !== $alias) {
  33035. $this->helpers[$alias] = $helper;
  33036. }
  33037. $helper->setHelperSet($this);
  33038. }
  33039. public function has($name)
  33040. {
  33041. return isset($this->helpers[$name]);
  33042. }
  33043. public function get($name)
  33044. {
  33045. if (!$this->has($name)) {
  33046. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  33047. }
  33048. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  33049. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  33050. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  33051. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  33052. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  33053. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  33054. }
  33055. return $this->helpers[$name];
  33056. }
  33057. public function setCommand(Command $command = null)
  33058. {
  33059. $this->command = $command;
  33060. }
  33061. public function getCommand()
  33062. {
  33063. return $this->command;
  33064. }
  33065. public function getIterator()
  33066. {
  33067. return new \ArrayIterator($this->helpers);
  33068. }
  33069. }
  33070. <?php
  33071. namespace Symfony\Component\Console\Helper;
  33072. use Symfony\Component\Console\Input\InputInterface;
  33073. use Symfony\Component\Console\Input\InputAwareInterface;
  33074. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  33075. {
  33076. protected $input;
  33077. public function setInput(InputInterface $input)
  33078. {
  33079. $this->input = $input;
  33080. }
  33081. }
  33082. <?php
  33083. namespace Symfony\Component\Console\Helper;
  33084. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33085. use Symfony\Component\Console\Output\OutputInterface;
  33086. use Symfony\Component\Process\Exception\ProcessFailedException;
  33087. use Symfony\Component\Process\Process;
  33088. use Symfony\Component\Process\ProcessBuilder;
  33089. class ProcessHelper extends Helper
  33090. {
  33091. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  33092. {
  33093. if ($output instanceof ConsoleOutputInterface) {
  33094. $output = $output->getErrorOutput();
  33095. }
  33096. $formatter = $this->getHelperSet()->get('debug_formatter');
  33097. if (is_array($cmd)) {
  33098. $process = ProcessBuilder::create($cmd)->getProcess();
  33099. } elseif ($cmd instanceof Process) {
  33100. $process = $cmd;
  33101. } else {
  33102. $process = new Process($cmd);
  33103. }
  33104. if ($verbosity <= $output->getVerbosity()) {
  33105. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  33106. }
  33107. if ($output->isDebug()) {
  33108. $callback = $this->wrapCallback($output, $process, $callback);
  33109. }
  33110. $process->run($callback);
  33111. if ($verbosity <= $output->getVerbosity()) {
  33112. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  33113. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  33114. }
  33115. if (!$process->isSuccessful() && null !== $error) {
  33116. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  33117. }
  33118. return $process;
  33119. }
  33120. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  33121. {
  33122. $process = $this->run($output, $cmd, $error, $callback);
  33123. if (!$process->isSuccessful()) {
  33124. throw new ProcessFailedException($process);
  33125. }
  33126. return $process;
  33127. }
  33128. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  33129. {
  33130. if ($output instanceof ConsoleOutputInterface) {
  33131. $output = $output->getErrorOutput();
  33132. }
  33133. $formatter = $this->getHelperSet()->get('debug_formatter');
  33134. $that = $this;
  33135. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  33136. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  33137. if (null !== $callback) {
  33138. call_user_func($callback, $type, $buffer);
  33139. }
  33140. };
  33141. }
  33142. public function escapeString($str)
  33143. {
  33144. return str_replace('<', '\\<', $str);
  33145. }
  33146. public function getName()
  33147. {
  33148. return 'process';
  33149. }
  33150. }
  33151. <?php
  33152. namespace Symfony\Component\Console\Helper;
  33153. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33154. use Symfony\Component\Console\Output\OutputInterface;
  33155. use Symfony\Component\Console\Exception\LogicException;
  33156. class ProgressBar
  33157. {
  33158. private $barWidth = 28;
  33159. private $barChar;
  33160. private $emptyBarChar = '-';
  33161. private $progressChar = '>';
  33162. private $format;
  33163. private $internalFormat;
  33164. private $redrawFreq = 1;
  33165. private $output;
  33166. private $step = 0;
  33167. private $max;
  33168. private $startTime;
  33169. private $stepWidth;
  33170. private $percent = 0.0;
  33171. private $formatLineCount;
  33172. private $messages = array();
  33173. private $overwrite = true;
  33174. private $firstRun = true;
  33175. private static $formatters;
  33176. private static $formats;
  33177. public function __construct(OutputInterface $output, $max = 0)
  33178. {
  33179. if ($output instanceof ConsoleOutputInterface) {
  33180. $output = $output->getErrorOutput();
  33181. }
  33182. $this->output = $output;
  33183. $this->setMaxSteps($max);
  33184. if (!$this->output->isDecorated()) {
  33185. $this->overwrite = false;
  33186. $this->setRedrawFrequency($max / 10);
  33187. }
  33188. $this->startTime = time();
  33189. }
  33190. public static function setPlaceholderFormatterDefinition($name, $callable)
  33191. {
  33192. if (!self::$formatters) {
  33193. self::$formatters = self::initPlaceholderFormatters();
  33194. }
  33195. self::$formatters[$name] = $callable;
  33196. }
  33197. public static function getPlaceholderFormatterDefinition($name)
  33198. {
  33199. if (!self::$formatters) {
  33200. self::$formatters = self::initPlaceholderFormatters();
  33201. }
  33202. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  33203. }
  33204. public static function setFormatDefinition($name, $format)
  33205. {
  33206. if (!self::$formats) {
  33207. self::$formats = self::initFormats();
  33208. }
  33209. self::$formats[$name] = $format;
  33210. }
  33211. public static function getFormatDefinition($name)
  33212. {
  33213. if (!self::$formats) {
  33214. self::$formats = self::initFormats();
  33215. }
  33216. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  33217. }
  33218. public function setMessage($message, $name = 'message')
  33219. {
  33220. $this->messages[$name] = $message;
  33221. }
  33222. public function getMessage($name = 'message')
  33223. {
  33224. return $this->messages[$name];
  33225. }
  33226. public function getStartTime()
  33227. {
  33228. return $this->startTime;
  33229. }
  33230. public function getMaxSteps()
  33231. {
  33232. return $this->max;
  33233. }
  33234. public function getStep()
  33235. {
  33236. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  33237. return $this->getProgress();
  33238. }
  33239. public function getProgress()
  33240. {
  33241. return $this->step;
  33242. }
  33243. public function getStepWidth()
  33244. {
  33245. return $this->stepWidth;
  33246. }
  33247. public function getProgressPercent()
  33248. {
  33249. return $this->percent;
  33250. }
  33251. public function setBarWidth($size)
  33252. {
  33253. $this->barWidth = (int) $size;
  33254. }
  33255. public function getBarWidth()
  33256. {
  33257. return $this->barWidth;
  33258. }
  33259. public function setBarCharacter($char)
  33260. {
  33261. $this->barChar = $char;
  33262. }
  33263. public function getBarCharacter()
  33264. {
  33265. if (null === $this->barChar) {
  33266. return $this->max ? '=' : $this->emptyBarChar;
  33267. }
  33268. return $this->barChar;
  33269. }
  33270. public function setEmptyBarCharacter($char)
  33271. {
  33272. $this->emptyBarChar = $char;
  33273. }
  33274. public function getEmptyBarCharacter()
  33275. {
  33276. return $this->emptyBarChar;
  33277. }
  33278. public function setProgressCharacter($char)
  33279. {
  33280. $this->progressChar = $char;
  33281. }
  33282. public function getProgressCharacter()
  33283. {
  33284. return $this->progressChar;
  33285. }
  33286. public function setFormat($format)
  33287. {
  33288. $this->format = null;
  33289. $this->internalFormat = $format;
  33290. }
  33291. public function setRedrawFrequency($freq)
  33292. {
  33293. $this->redrawFreq = max((int) $freq, 1);
  33294. }
  33295. public function start($max = null)
  33296. {
  33297. $this->startTime = time();
  33298. $this->step = 0;
  33299. $this->percent = 0.0;
  33300. if (null !== $max) {
  33301. $this->setMaxSteps($max);
  33302. }
  33303. $this->display();
  33304. }
  33305. public function advance($step = 1)
  33306. {
  33307. $this->setProgress($this->step + $step);
  33308. }
  33309. public function setCurrent($step)
  33310. {
  33311. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  33312. $this->setProgress($step);
  33313. }
  33314. public function setOverwrite($overwrite)
  33315. {
  33316. $this->overwrite = (bool) $overwrite;
  33317. }
  33318. public function setProgress($step)
  33319. {
  33320. $step = (int) $step;
  33321. if ($step < $this->step) {
  33322. throw new LogicException('You can\'t regress the progress bar.');
  33323. }
  33324. if ($this->max && $step > $this->max) {
  33325. $this->max = $step;
  33326. }
  33327. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  33328. $currPeriod = (int) ($step / $this->redrawFreq);
  33329. $this->step = $step;
  33330. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  33331. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  33332. $this->display();
  33333. }
  33334. }
  33335. public function finish()
  33336. {
  33337. if (!$this->max) {
  33338. $this->max = $this->step;
  33339. }
  33340. if ($this->step === $this->max && !$this->overwrite) {
  33341. return;
  33342. }
  33343. $this->setProgress($this->max);
  33344. }
  33345. public function display()
  33346. {
  33347. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  33348. return;
  33349. }
  33350. if (null === $this->format) {
  33351. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  33352. }
  33353. $self = $this;
  33354. $output = $this->output;
  33355. $messages = $this->messages;
  33356. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  33357. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  33358. $text = call_user_func($formatter, $self, $output);
  33359. } elseif (isset($messages[$matches[1]])) {
  33360. $text = $messages[$matches[1]];
  33361. } else {
  33362. return $matches[0];
  33363. }
  33364. if (isset($matches[2])) {
  33365. $text = sprintf('%'.$matches[2], $text);
  33366. }
  33367. return $text;
  33368. }, $this->format));
  33369. }
  33370. public function clear()
  33371. {
  33372. if (!$this->overwrite) {
  33373. return;
  33374. }
  33375. if (null === $this->format) {
  33376. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  33377. }
  33378. $this->overwrite('');
  33379. }
  33380. private function setRealFormat($format)
  33381. {
  33382. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  33383. $this->format = self::getFormatDefinition($format.'_nomax');
  33384. } elseif (null !== self::getFormatDefinition($format)) {
  33385. $this->format = self::getFormatDefinition($format);
  33386. } else {
  33387. $this->format = $format;
  33388. }
  33389. $this->formatLineCount = substr_count($this->format, "\n");
  33390. }
  33391. private function setMaxSteps($max)
  33392. {
  33393. $this->max = max(0, (int) $max);
  33394. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  33395. }
  33396. private function overwrite($message)
  33397. {
  33398. if ($this->overwrite) {
  33399. if (!$this->firstRun) {
  33400. $this->output->write("\x0D");
  33401. $this->output->write("\x1B[2K");
  33402. if ($this->formatLineCount > 0) {
  33403. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  33404. }
  33405. }
  33406. } elseif ($this->step > 0) {
  33407. $this->output->writeln('');
  33408. }
  33409. $this->firstRun = false;
  33410. $this->output->write($message);
  33411. }
  33412. private function determineBestFormat()
  33413. {
  33414. switch ($this->output->getVerbosity()) {
  33415. case OutputInterface::VERBOSITY_VERBOSE:
  33416. return $this->max ? 'verbose' : 'verbose_nomax';
  33417. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  33418. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  33419. case OutputInterface::VERBOSITY_DEBUG:
  33420. return $this->max ? 'debug' : 'debug_nomax';
  33421. default:
  33422. return $this->max ? 'normal' : 'normal_nomax';
  33423. }
  33424. }
  33425. private static function initPlaceholderFormatters()
  33426. {
  33427. return array(
  33428. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  33429. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  33430. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  33431. if ($completeBars < $bar->getBarWidth()) {
  33432. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  33433. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  33434. }
  33435. return $display;
  33436. },
  33437. 'elapsed' => function (ProgressBar $bar) {
  33438. return Helper::formatTime(time() - $bar->getStartTime());
  33439. },
  33440. 'remaining' => function (ProgressBar $bar) {
  33441. if (!$bar->getMaxSteps()) {
  33442. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  33443. }
  33444. if (!$bar->getProgress()) {
  33445. $remaining = 0;
  33446. } else {
  33447. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  33448. }
  33449. return Helper::formatTime($remaining);
  33450. },
  33451. 'estimated' => function (ProgressBar $bar) {
  33452. if (!$bar->getMaxSteps()) {
  33453. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  33454. }
  33455. if (!$bar->getProgress()) {
  33456. $estimated = 0;
  33457. } else {
  33458. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  33459. }
  33460. return Helper::formatTime($estimated);
  33461. },
  33462. 'memory' => function (ProgressBar $bar) {
  33463. return Helper::formatMemory(memory_get_usage(true));
  33464. },
  33465. 'current' => function (ProgressBar $bar) {
  33466. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  33467. },
  33468. 'max' => function (ProgressBar $bar) {
  33469. return $bar->getMaxSteps();
  33470. },
  33471. 'percent' => function (ProgressBar $bar) {
  33472. return floor($bar->getProgressPercent() * 100);
  33473. },
  33474. );
  33475. }
  33476. private static function initFormats()
  33477. {
  33478. return array(
  33479. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  33480. 'normal_nomax' => ' %current% [%bar%]',
  33481. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  33482. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  33483. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  33484. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  33485. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  33486. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  33487. );
  33488. }
  33489. }
  33490. <?php
  33491. namespace Symfony\Component\Console\Helper;
  33492. use Symfony\Component\Console\Output\NullOutput;
  33493. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33494. use Symfony\Component\Console\Output\OutputInterface;
  33495. use Symfony\Component\Console\Exception\LogicException;
  33496. class ProgressHelper extends Helper
  33497. {
  33498. const FORMAT_QUIET = ' %percent%%';
  33499. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  33500. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  33501. const FORMAT_QUIET_NOMAX = ' %current%';
  33502. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  33503. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  33504. private $barWidth = 28;
  33505. private $barChar = '=';
  33506. private $emptyBarChar = '-';
  33507. private $progressChar = '>';
  33508. private $format = null;
  33509. private $redrawFreq = 1;
  33510. private $lastMessagesLength;
  33511. private $barCharOriginal;
  33512. private $output;
  33513. private $current;
  33514. private $max;
  33515. private $startTime;
  33516. private $defaultFormatVars = array(
  33517. 'current',
  33518. 'max',
  33519. 'bar',
  33520. 'percent',
  33521. 'elapsed',
  33522. );
  33523. private $formatVars;
  33524. private $widths = array(
  33525. 'current' => 4,
  33526. 'max' => 4,
  33527. 'percent' => 3,
  33528. 'elapsed' => 6,
  33529. );
  33530. private $timeFormats = array(
  33531. array(0, '???'),
  33532. array(2, '1 sec'),
  33533. array(59, 'secs', 1),
  33534. array(60, '1 min'),
  33535. array(3600, 'mins', 60),
  33536. array(5400, '1 hr'),
  33537. array(86400, 'hrs', 3600),
  33538. array(129600, '1 day'),
  33539. array(604800, 'days', 86400),
  33540. );
  33541. public function __construct($triggerDeprecationError = true)
  33542. {
  33543. if ($triggerDeprecationError) {
  33544. @trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  33545. }
  33546. }
  33547. public function setBarWidth($size)
  33548. {
  33549. $this->barWidth = (int) $size;
  33550. }
  33551. public function setBarCharacter($char)
  33552. {
  33553. $this->barChar = $char;
  33554. }
  33555. public function setEmptyBarCharacter($char)
  33556. {
  33557. $this->emptyBarChar = $char;
  33558. }
  33559. public function setProgressCharacter($char)
  33560. {
  33561. $this->progressChar = $char;
  33562. }
  33563. public function setFormat($format)
  33564. {
  33565. $this->format = $format;
  33566. }
  33567. public function setRedrawFrequency($freq)
  33568. {
  33569. $this->redrawFreq = (int) $freq;
  33570. }
  33571. public function start(OutputInterface $output, $max = null)
  33572. {
  33573. if ($output instanceof ConsoleOutputInterface) {
  33574. $output = $output->getErrorOutput();
  33575. }
  33576. $this->startTime = time();
  33577. $this->current = 0;
  33578. $this->max = (int) $max;
  33579. $this->output = $output->isDecorated() ? $output : new NullOutput();
  33580. $this->lastMessagesLength = 0;
  33581. $this->barCharOriginal = '';
  33582. if (null === $this->format) {
  33583. switch ($output->getVerbosity()) {
  33584. case OutputInterface::VERBOSITY_QUIET:
  33585. $this->format = self::FORMAT_QUIET_NOMAX;
  33586. if ($this->max > 0) {
  33587. $this->format = self::FORMAT_QUIET;
  33588. }
  33589. break;
  33590. case OutputInterface::VERBOSITY_VERBOSE:
  33591. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  33592. case OutputInterface::VERBOSITY_DEBUG:
  33593. $this->format = self::FORMAT_VERBOSE_NOMAX;
  33594. if ($this->max > 0) {
  33595. $this->format = self::FORMAT_VERBOSE;
  33596. }
  33597. break;
  33598. default:
  33599. $this->format = self::FORMAT_NORMAL_NOMAX;
  33600. if ($this->max > 0) {
  33601. $this->format = self::FORMAT_NORMAL;
  33602. }
  33603. break;
  33604. }
  33605. }
  33606. $this->initialize();
  33607. }
  33608. public function advance($step = 1, $redraw = false)
  33609. {
  33610. $this->setCurrent($this->current + $step, $redraw);
  33611. }
  33612. public function setCurrent($current, $redraw = false)
  33613. {
  33614. if (null === $this->startTime) {
  33615. throw new LogicException('You must start the progress bar before calling setCurrent().');
  33616. }
  33617. $current = (int) $current;
  33618. if ($current < $this->current) {
  33619. throw new LogicException('You can\'t regress the progress bar');
  33620. }
  33621. if (0 === $this->current) {
  33622. $redraw = true;
  33623. }
  33624. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  33625. $this->current = $current;
  33626. $currPeriod = (int) ($this->current / $this->redrawFreq);
  33627. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  33628. $this->display();
  33629. }
  33630. }
  33631. public function display($finish = false)
  33632. {
  33633. if (null === $this->startTime) {
  33634. throw new LogicException('You must start the progress bar before calling display().');
  33635. }
  33636. $message = $this->format;
  33637. foreach ($this->generate($finish) as $name => $value) {
  33638. $message = str_replace("%{$name}%", $value, $message);
  33639. }
  33640. $this->overwrite($this->output, $message);
  33641. }
  33642. public function clear()
  33643. {
  33644. $this->overwrite($this->output, '');
  33645. }
  33646. public function finish()
  33647. {
  33648. if (null === $this->startTime) {
  33649. throw new LogicException('You must start the progress bar before calling finish().');
  33650. }
  33651. if (null !== $this->startTime) {
  33652. if (!$this->max) {
  33653. $this->barChar = $this->barCharOriginal;
  33654. $this->display(true);
  33655. }
  33656. $this->startTime = null;
  33657. $this->output->writeln('');
  33658. $this->output = null;
  33659. }
  33660. }
  33661. private function initialize()
  33662. {
  33663. $this->formatVars = array();
  33664. foreach ($this->defaultFormatVars as $var) {
  33665. if (false !== strpos($this->format, "%{$var}%")) {
  33666. $this->formatVars[$var] = true;
  33667. }
  33668. }
  33669. if ($this->max > 0) {
  33670. $this->widths['max'] = $this->strlen($this->max);
  33671. $this->widths['current'] = $this->widths['max'];
  33672. } else {
  33673. $this->barCharOriginal = $this->barChar;
  33674. $this->barChar = $this->emptyBarChar;
  33675. }
  33676. }
  33677. private function generate($finish = false)
  33678. {
  33679. $vars = array();
  33680. $percent = 0;
  33681. if ($this->max > 0) {
  33682. $percent = (float) $this->current / $this->max;
  33683. }
  33684. if (isset($this->formatVars['bar'])) {
  33685. if ($this->max > 0) {
  33686. $completeBars = floor($percent * $this->barWidth);
  33687. } else {
  33688. if (!$finish) {
  33689. $completeBars = floor($this->current % $this->barWidth);
  33690. } else {
  33691. $completeBars = $this->barWidth;
  33692. }
  33693. }
  33694. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  33695. $bar = str_repeat($this->barChar, $completeBars);
  33696. if ($completeBars < $this->barWidth) {
  33697. $bar .= $this->progressChar;
  33698. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  33699. }
  33700. $vars['bar'] = $bar;
  33701. }
  33702. if (isset($this->formatVars['elapsed'])) {
  33703. $elapsed = time() - $this->startTime;
  33704. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  33705. }
  33706. if (isset($this->formatVars['current'])) {
  33707. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  33708. }
  33709. if (isset($this->formatVars['max'])) {
  33710. $vars['max'] = $this->max;
  33711. }
  33712. if (isset($this->formatVars['percent'])) {
  33713. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  33714. }
  33715. return $vars;
  33716. }
  33717. private function humaneTime($secs)
  33718. {
  33719. $text = '';
  33720. foreach ($this->timeFormats as $format) {
  33721. if ($secs < $format[0]) {
  33722. if (2 == count($format)) {
  33723. $text = $format[1];
  33724. break;
  33725. } else {
  33726. $text = ceil($secs / $format[2]).' '.$format[1];
  33727. break;
  33728. }
  33729. }
  33730. }
  33731. return $text;
  33732. }
  33733. private function overwrite(OutputInterface $output, $message)
  33734. {
  33735. $length = $this->strlen($message);
  33736. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  33737. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  33738. }
  33739. $output->write("\x0D");
  33740. $output->write($message);
  33741. $this->lastMessagesLength = $this->strlen($message);
  33742. }
  33743. public function getName()
  33744. {
  33745. return 'progress';
  33746. }
  33747. }
  33748. <?php
  33749. namespace Symfony\Component\Console\Helper;
  33750. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33751. use Symfony\Component\Console\Exception\LogicException;
  33752. use Symfony\Component\Console\Output\OutputInterface;
  33753. class ProgressIndicator
  33754. {
  33755. private $output;
  33756. private $startTime;
  33757. private $format;
  33758. private $message;
  33759. private $indicatorValues;
  33760. private $indicatorCurrent;
  33761. private $indicatorChangeInterval;
  33762. private $indicatorUpdateTime;
  33763. private $started = false;
  33764. private static $formatters;
  33765. private static $formats;
  33766. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  33767. {
  33768. $this->output = $output;
  33769. if (null === $format) {
  33770. $format = $this->determineBestFormat();
  33771. }
  33772. if (null === $indicatorValues) {
  33773. $indicatorValues = array('-', '\\', '|', '/');
  33774. }
  33775. $indicatorValues = array_values($indicatorValues);
  33776. if (2 > count($indicatorValues)) {
  33777. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  33778. }
  33779. $this->format = self::getFormatDefinition($format);
  33780. $this->indicatorChangeInterval = $indicatorChangeInterval;
  33781. $this->indicatorValues = $indicatorValues;
  33782. $this->startTime = time();
  33783. }
  33784. public function setMessage($message)
  33785. {
  33786. $this->message = $message;
  33787. $this->display();
  33788. }
  33789. public function getMessage()
  33790. {
  33791. return $this->message;
  33792. }
  33793. public function getStartTime()
  33794. {
  33795. return $this->startTime;
  33796. }
  33797. public function getCurrentValue()
  33798. {
  33799. return $this->indicatorValues[$this->indicatorCurrent % count($this->indicatorValues)];
  33800. }
  33801. public function start($message)
  33802. {
  33803. if ($this->started) {
  33804. throw new LogicException('Progress indicator already started.');
  33805. }
  33806. $this->message = $message;
  33807. $this->started = true;
  33808. $this->startTime = time();
  33809. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  33810. $this->indicatorCurrent = 0;
  33811. $this->display();
  33812. }
  33813. public function advance()
  33814. {
  33815. if (!$this->started) {
  33816. throw new LogicException('Progress indicator has not yet been started.');
  33817. }
  33818. if (!$this->output->isDecorated()) {
  33819. return;
  33820. }
  33821. $currentTime = $this->getCurrentTimeInMilliseconds();
  33822. if ($currentTime < $this->indicatorUpdateTime) {
  33823. return;
  33824. }
  33825. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  33826. ++$this->indicatorCurrent;
  33827. $this->display();
  33828. }
  33829. public function finish($message)
  33830. {
  33831. if (!$this->started) {
  33832. throw new LogicException('Progress indicator has not yet been started.');
  33833. }
  33834. $this->message = $message;
  33835. $this->display();
  33836. $this->output->writeln('');
  33837. $this->started = false;
  33838. }
  33839. public static function getFormatDefinition($name)
  33840. {
  33841. if (!self::$formats) {
  33842. self::$formats = self::initFormats();
  33843. }
  33844. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  33845. }
  33846. public static function setPlaceholderFormatterDefinition($name, $callable)
  33847. {
  33848. if (!self::$formatters) {
  33849. self::$formatters = self::initPlaceholderFormatters();
  33850. }
  33851. self::$formatters[$name] = $callable;
  33852. }
  33853. public static function getPlaceholderFormatterDefinition($name)
  33854. {
  33855. if (!self::$formatters) {
  33856. self::$formatters = self::initPlaceholderFormatters();
  33857. }
  33858. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  33859. }
  33860. private function display()
  33861. {
  33862. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  33863. return;
  33864. }
  33865. $self = $this;
  33866. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  33867. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  33868. return call_user_func($formatter, $self);
  33869. }
  33870. return $matches[0];
  33871. }, $this->format));
  33872. }
  33873. private function determineBestFormat()
  33874. {
  33875. switch ($this->output->getVerbosity()) {
  33876. case OutputInterface::VERBOSITY_VERBOSE:
  33877. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  33878. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  33879. case OutputInterface::VERBOSITY_DEBUG:
  33880. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  33881. default:
  33882. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  33883. }
  33884. }
  33885. private function overwrite($message)
  33886. {
  33887. if ($this->output->isDecorated()) {
  33888. $this->output->write("\x0D\x1B[2K");
  33889. $this->output->write($message);
  33890. } else {
  33891. $this->output->writeln($message);
  33892. }
  33893. }
  33894. private function getCurrentTimeInMilliseconds()
  33895. {
  33896. return round(microtime(true) * 1000);
  33897. }
  33898. private static function initPlaceholderFormatters()
  33899. {
  33900. return array(
  33901. 'indicator' => function (ProgressIndicator $indicator) {
  33902. return $indicator->getCurrentValue();
  33903. },
  33904. 'message' => function (ProgressIndicator $indicator) {
  33905. return $indicator->getMessage();
  33906. },
  33907. 'elapsed' => function (ProgressIndicator $indicator) {
  33908. return Helper::formatTime(time() - $indicator->getStartTime());
  33909. },
  33910. 'memory' => function () {
  33911. return Helper::formatMemory(memory_get_usage(true));
  33912. },
  33913. );
  33914. }
  33915. private static function initFormats()
  33916. {
  33917. return array(
  33918. 'normal' => ' %indicator% %message%',
  33919. 'normal_no_ansi' => ' %message%',
  33920. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  33921. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  33922. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  33923. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  33924. );
  33925. }
  33926. }
  33927. <?php
  33928. namespace Symfony\Component\Console\Helper;
  33929. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33930. use Symfony\Component\Console\Exception\RuntimeException;
  33931. use Symfony\Component\Console\Formatter\OutputFormatter;
  33932. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  33933. use Symfony\Component\Console\Input\InputInterface;
  33934. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33935. use Symfony\Component\Console\Output\OutputInterface;
  33936. use Symfony\Component\Console\Question\Question;
  33937. use Symfony\Component\Console\Question\ChoiceQuestion;
  33938. class QuestionHelper extends Helper
  33939. {
  33940. private $inputStream;
  33941. private static $shell;
  33942. private static $stty;
  33943. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  33944. {
  33945. if ($output instanceof ConsoleOutputInterface) {
  33946. $output = $output->getErrorOutput();
  33947. }
  33948. if (!$input->isInteractive()) {
  33949. return $question->getDefault();
  33950. }
  33951. if (!$question->getValidator()) {
  33952. return $this->doAsk($output, $question);
  33953. }
  33954. $that = $this;
  33955. $interviewer = function () use ($output, $question, $that) {
  33956. return $that->doAsk($output, $question);
  33957. };
  33958. return $this->validateAttempts($interviewer, $output, $question);
  33959. }
  33960. public function setInputStream($stream)
  33961. {
  33962. if (!is_resource($stream)) {
  33963. throw new InvalidArgumentException('Input stream must be a valid resource.');
  33964. }
  33965. $this->inputStream = $stream;
  33966. }
  33967. public function getInputStream()
  33968. {
  33969. return $this->inputStream;
  33970. }
  33971. public function getName()
  33972. {
  33973. return 'question';
  33974. }
  33975. public function doAsk(OutputInterface $output, Question $question)
  33976. {
  33977. $this->writePrompt($output, $question);
  33978. $inputStream = $this->inputStream ?: STDIN;
  33979. $autocomplete = $question->getAutocompleterValues();
  33980. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  33981. $ret = false;
  33982. if ($question->isHidden()) {
  33983. try {
  33984. $ret = trim($this->getHiddenResponse($output, $inputStream));
  33985. } catch (RuntimeException $e) {
  33986. if (!$question->isHiddenFallback()) {
  33987. throw $e;
  33988. }
  33989. }
  33990. }
  33991. if (false === $ret) {
  33992. $ret = fgets($inputStream, 4096);
  33993. if (false === $ret) {
  33994. throw new RuntimeException('Aborted');
  33995. }
  33996. $ret = trim($ret);
  33997. }
  33998. } else {
  33999. $ret = trim($this->autocomplete($output, $question, $inputStream, is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  34000. }
  34001. $ret = strlen($ret) > 0 ? $ret : $question->getDefault();
  34002. if ($normalizer = $question->getNormalizer()) {
  34003. return $normalizer($ret);
  34004. }
  34005. return $ret;
  34006. }
  34007. protected function writePrompt(OutputInterface $output, Question $question)
  34008. {
  34009. $message = $question->getQuestion();
  34010. if ($question instanceof ChoiceQuestion) {
  34011. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  34012. $messages = (array) $question->getQuestion();
  34013. foreach ($question->getChoices() as $key => $value) {
  34014. $width = $maxWidth - $this->strlen($key);
  34015. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  34016. }
  34017. $output->writeln($messages);
  34018. $message = $question->getPrompt();
  34019. }
  34020. $output->write($message);
  34021. }
  34022. protected function writeError(OutputInterface $output, \Exception $error)
  34023. {
  34024. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  34025. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  34026. } else {
  34027. $message = '<error>'.$error->getMessage().'</error>';
  34028. }
  34029. $output->writeln($message);
  34030. }
  34031. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  34032. {
  34033. $ret = '';
  34034. $i = 0;
  34035. $ofs = -1;
  34036. $matches = $autocomplete;
  34037. $numMatches = count($matches);
  34038. $sttyMode = shell_exec('stty -g');
  34039. shell_exec('stty -icanon -echo');
  34040. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  34041. while (!feof($inputStream)) {
  34042. $c = fread($inputStream, 1);
  34043. if ("\177" === $c) {
  34044. if (0 === $numMatches && 0 !== $i) {
  34045. --$i;
  34046. $output->write("\033[1D");
  34047. }
  34048. if (0 === $i) {
  34049. $ofs = -1;
  34050. $matches = $autocomplete;
  34051. $numMatches = count($matches);
  34052. } else {
  34053. $numMatches = 0;
  34054. }
  34055. $ret = substr($ret, 0, $i);
  34056. } elseif ("\033" === $c) {
  34057. $c .= fread($inputStream, 2);
  34058. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  34059. if ('A' === $c[2] && -1 === $ofs) {
  34060. $ofs = 0;
  34061. }
  34062. if (0 === $numMatches) {
  34063. continue;
  34064. }
  34065. $ofs += ('A' === $c[2]) ? -1 : 1;
  34066. $ofs = ($numMatches + $ofs) % $numMatches;
  34067. }
  34068. } elseif (ord($c) < 32) {
  34069. if ("\t" === $c || "\n" === $c) {
  34070. if ($numMatches > 0 && -1 !== $ofs) {
  34071. $ret = $matches[$ofs];
  34072. $output->write(substr($ret, $i));
  34073. $i = strlen($ret);
  34074. }
  34075. if ("\n" === $c) {
  34076. $output->write($c);
  34077. break;
  34078. }
  34079. $numMatches = 0;
  34080. }
  34081. continue;
  34082. } else {
  34083. $output->write($c);
  34084. $ret .= $c;
  34085. ++$i;
  34086. $numMatches = 0;
  34087. $ofs = 0;
  34088. foreach ($autocomplete as $value) {
  34089. if (0 === strpos($value, $ret) && $i !== strlen($value)) {
  34090. $matches[$numMatches++] = $value;
  34091. }
  34092. }
  34093. }
  34094. $output->write("\033[K");
  34095. if ($numMatches > 0 && -1 !== $ofs) {
  34096. $output->write("\0337");
  34097. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  34098. $output->write("\0338");
  34099. }
  34100. }
  34101. shell_exec(sprintf('stty %s', $sttyMode));
  34102. return $ret;
  34103. }
  34104. private function getHiddenResponse(OutputInterface $output, $inputStream)
  34105. {
  34106. if ('\\' === DIRECTORY_SEPARATOR) {
  34107. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  34108. if ('phar:' === substr(__FILE__, 0, 5)) {
  34109. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  34110. copy($exe, $tmpExe);
  34111. $exe = $tmpExe;
  34112. }
  34113. $value = rtrim(shell_exec($exe));
  34114. $output->writeln('');
  34115. if (isset($tmpExe)) {
  34116. unlink($tmpExe);
  34117. }
  34118. return $value;
  34119. }
  34120. if ($this->hasSttyAvailable()) {
  34121. $sttyMode = shell_exec('stty -g');
  34122. shell_exec('stty -echo');
  34123. $value = fgets($inputStream, 4096);
  34124. shell_exec(sprintf('stty %s', $sttyMode));
  34125. if (false === $value) {
  34126. throw new RuntimeException('Aborted');
  34127. }
  34128. $value = trim($value);
  34129. $output->writeln('');
  34130. return $value;
  34131. }
  34132. if (false !== $shell = $this->getShell()) {
  34133. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  34134. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  34135. $value = rtrim(shell_exec($command));
  34136. $output->writeln('');
  34137. return $value;
  34138. }
  34139. throw new RuntimeException('Unable to hide the response.');
  34140. }
  34141. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  34142. {
  34143. $error = null;
  34144. $attempts = $question->getMaxAttempts();
  34145. while (null === $attempts || $attempts--) {
  34146. if (null !== $error) {
  34147. $this->writeError($output, $error);
  34148. }
  34149. try {
  34150. return call_user_func($question->getValidator(), $interviewer());
  34151. } catch (RuntimeException $e) {
  34152. throw $e;
  34153. } catch (\Exception $error) {
  34154. }
  34155. }
  34156. throw $error;
  34157. }
  34158. private function getShell()
  34159. {
  34160. if (null !== self::$shell) {
  34161. return self::$shell;
  34162. }
  34163. self::$shell = false;
  34164. if (file_exists('/usr/bin/env')) {
  34165. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  34166. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  34167. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  34168. self::$shell = $sh;
  34169. break;
  34170. }
  34171. }
  34172. }
  34173. return self::$shell;
  34174. }
  34175. private function hasSttyAvailable()
  34176. {
  34177. if (null !== self::$stty) {
  34178. return self::$stty;
  34179. }
  34180. exec('stty 2>&1', $output, $exitcode);
  34181. return self::$stty = 0 === $exitcode;
  34182. }
  34183. }
  34184. <?php
  34185. namespace Symfony\Component\Console\Helper;
  34186. use Symfony\Component\Console\Exception\LogicException;
  34187. use Symfony\Component\Console\Input\InputInterface;
  34188. use Symfony\Component\Console\Output\OutputInterface;
  34189. use Symfony\Component\Console\Question\ChoiceQuestion;
  34190. use Symfony\Component\Console\Question\ConfirmationQuestion;
  34191. use Symfony\Component\Console\Question\Question;
  34192. use Symfony\Component\Console\Style\SymfonyStyle;
  34193. use Symfony\Component\Console\Formatter\OutputFormatter;
  34194. class SymfonyQuestionHelper extends QuestionHelper
  34195. {
  34196. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  34197. {
  34198. $validator = $question->getValidator();
  34199. $question->setValidator(function ($value) use ($validator) {
  34200. if (null !== $validator) {
  34201. $value = $validator($value);
  34202. } else {
  34203. if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) {
  34204. throw new LogicException('A value is required.');
  34205. }
  34206. }
  34207. return $value;
  34208. });
  34209. return parent::ask($input, $output, $question);
  34210. }
  34211. protected function writePrompt(OutputInterface $output, Question $question)
  34212. {
  34213. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  34214. $default = $question->getDefault();
  34215. switch (true) {
  34216. case null === $default:
  34217. $text = sprintf(' <info>%s</info>:', $text);
  34218. break;
  34219. case $question instanceof ConfirmationQuestion:
  34220. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  34221. break;
  34222. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  34223. $choices = $question->getChoices();
  34224. $default = explode(',', $default);
  34225. foreach ($default as $key => $value) {
  34226. $default[$key] = $choices[trim($value)];
  34227. }
  34228. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  34229. break;
  34230. case $question instanceof ChoiceQuestion:
  34231. $choices = $question->getChoices();
  34232. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default]));
  34233. break;
  34234. default:
  34235. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  34236. }
  34237. $output->writeln($text);
  34238. if ($question instanceof ChoiceQuestion) {
  34239. $width = max(array_map('strlen', array_keys($question->getChoices())));
  34240. foreach ($question->getChoices() as $key => $value) {
  34241. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  34242. }
  34243. }
  34244. $output->write(' > ');
  34245. }
  34246. protected function writeError(OutputInterface $output, \Exception $error)
  34247. {
  34248. if ($output instanceof SymfonyStyle) {
  34249. $output->newLine();
  34250. $output->error($error->getMessage());
  34251. return;
  34252. }
  34253. parent::writeError($output, $error);
  34254. }
  34255. }
  34256. <?php
  34257. namespace Symfony\Component\Console\Helper;
  34258. use Symfony\Component\Console\Output\OutputInterface;
  34259. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34260. class Table
  34261. {
  34262. private $headers = array();
  34263. private $rows = array();
  34264. private $columnWidths = array();
  34265. private $numberOfColumns;
  34266. private $output;
  34267. private $style;
  34268. private $columnStyles = array();
  34269. private static $styles;
  34270. public function __construct(OutputInterface $output)
  34271. {
  34272. $this->output = $output;
  34273. if (!self::$styles) {
  34274. self::$styles = self::initStyles();
  34275. }
  34276. $this->setStyle('default');
  34277. }
  34278. public static function setStyleDefinition($name, TableStyle $style)
  34279. {
  34280. if (!self::$styles) {
  34281. self::$styles = self::initStyles();
  34282. }
  34283. self::$styles[$name] = $style;
  34284. }
  34285. public static function getStyleDefinition($name)
  34286. {
  34287. if (!self::$styles) {
  34288. self::$styles = self::initStyles();
  34289. }
  34290. if (isset(self::$styles[$name])) {
  34291. return self::$styles[$name];
  34292. }
  34293. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  34294. }
  34295. public function setStyle($name)
  34296. {
  34297. $this->style = $this->resolveStyle($name);
  34298. return $this;
  34299. }
  34300. public function getStyle()
  34301. {
  34302. return $this->style;
  34303. }
  34304. public function setColumnStyle($columnIndex, $name)
  34305. {
  34306. $columnIndex = (int) $columnIndex;
  34307. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  34308. return $this;
  34309. }
  34310. public function getColumnStyle($columnIndex)
  34311. {
  34312. if (isset($this->columnStyles[$columnIndex])) {
  34313. return $this->columnStyles[$columnIndex];
  34314. }
  34315. return $this->getStyle();
  34316. }
  34317. public function setHeaders(array $headers)
  34318. {
  34319. $headers = array_values($headers);
  34320. if (!empty($headers) && !is_array($headers[0])) {
  34321. $headers = array($headers);
  34322. }
  34323. $this->headers = $headers;
  34324. return $this;
  34325. }
  34326. public function setRows(array $rows)
  34327. {
  34328. $this->rows = array();
  34329. return $this->addRows($rows);
  34330. }
  34331. public function addRows(array $rows)
  34332. {
  34333. foreach ($rows as $row) {
  34334. $this->addRow($row);
  34335. }
  34336. return $this;
  34337. }
  34338. public function addRow($row)
  34339. {
  34340. if ($row instanceof TableSeparator) {
  34341. $this->rows[] = $row;
  34342. return $this;
  34343. }
  34344. if (!is_array($row)) {
  34345. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  34346. }
  34347. $this->rows[] = array_values($row);
  34348. return $this;
  34349. }
  34350. public function setRow($column, array $row)
  34351. {
  34352. $this->rows[$column] = $row;
  34353. return $this;
  34354. }
  34355. public function render()
  34356. {
  34357. $this->calculateNumberOfColumns();
  34358. $rows = $this->buildTableRows($this->rows);
  34359. $headers = $this->buildTableRows($this->headers);
  34360. $this->calculateColumnsWidth(array_merge($headers, $rows));
  34361. $this->renderRowSeparator();
  34362. if (!empty($headers)) {
  34363. foreach ($headers as $header) {
  34364. $this->renderRow($header, $this->style->getCellHeaderFormat());
  34365. $this->renderRowSeparator();
  34366. }
  34367. }
  34368. foreach ($rows as $row) {
  34369. if ($row instanceof TableSeparator) {
  34370. $this->renderRowSeparator();
  34371. } else {
  34372. $this->renderRow($row, $this->style->getCellRowFormat());
  34373. }
  34374. }
  34375. if (!empty($rows)) {
  34376. $this->renderRowSeparator();
  34377. }
  34378. $this->cleanup();
  34379. }
  34380. private function renderRowSeparator()
  34381. {
  34382. if (0 === $count = $this->numberOfColumns) {
  34383. return;
  34384. }
  34385. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  34386. return;
  34387. }
  34388. $markup = $this->style->getCrossingChar();
  34389. for ($column = 0; $column < $count; ++$column) {
  34390. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  34391. }
  34392. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  34393. }
  34394. private function renderColumnSeparator()
  34395. {
  34396. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  34397. }
  34398. private function renderRow(array $row, $cellFormat)
  34399. {
  34400. if (empty($row)) {
  34401. return;
  34402. }
  34403. $rowContent = $this->renderColumnSeparator();
  34404. foreach ($this->getRowColumns($row) as $column) {
  34405. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  34406. $rowContent .= $this->renderColumnSeparator();
  34407. }
  34408. $this->output->writeln($rowContent);
  34409. }
  34410. private function renderCell(array $row, $column, $cellFormat)
  34411. {
  34412. $cell = isset($row[$column]) ? $row[$column] : '';
  34413. $width = $this->columnWidths[$column];
  34414. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  34415. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  34416. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  34417. }
  34418. }
  34419. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  34420. $width += strlen($cell) - mb_strwidth($cell, $encoding);
  34421. }
  34422. $style = $this->getColumnStyle($column);
  34423. if ($cell instanceof TableSeparator) {
  34424. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  34425. }
  34426. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  34427. $content = sprintf($style->getCellRowContentFormat(), $cell);
  34428. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  34429. }
  34430. private function calculateNumberOfColumns()
  34431. {
  34432. if (null !== $this->numberOfColumns) {
  34433. return;
  34434. }
  34435. $columns = array(0);
  34436. foreach (array_merge($this->headers, $this->rows) as $row) {
  34437. if ($row instanceof TableSeparator) {
  34438. continue;
  34439. }
  34440. $columns[] = $this->getNumberOfColumns($row);
  34441. }
  34442. $this->numberOfColumns = max($columns);
  34443. }
  34444. private function buildTableRows($rows)
  34445. {
  34446. $unmergedRows = array();
  34447. for ($rowKey = 0; $rowKey < count($rows); ++$rowKey) {
  34448. $rows = $this->fillNextRows($rows, $rowKey);
  34449. foreach ($rows[$rowKey] as $column => $cell) {
  34450. if (!strstr($cell, "\n")) {
  34451. continue;
  34452. }
  34453. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  34454. foreach ($lines as $lineKey => $line) {
  34455. if ($cell instanceof TableCell) {
  34456. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  34457. }
  34458. if (0 === $lineKey) {
  34459. $rows[$rowKey][$column] = $line;
  34460. } else {
  34461. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  34462. }
  34463. }
  34464. }
  34465. }
  34466. $tableRows = array();
  34467. foreach ($rows as $rowKey => $row) {
  34468. $tableRows[] = $this->fillCells($row);
  34469. if (isset($unmergedRows[$rowKey])) {
  34470. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  34471. }
  34472. }
  34473. return $tableRows;
  34474. }
  34475. private function fillNextRows(array $rows, $line)
  34476. {
  34477. $unmergedRows = array();
  34478. foreach ($rows[$line] as $column => $cell) {
  34479. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  34480. $nbLines = $cell->getRowspan() - 1;
  34481. $lines = array($cell);
  34482. if (strstr($cell, "\n")) {
  34483. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  34484. $nbLines = count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  34485. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  34486. unset($lines[0]);
  34487. }
  34488. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  34489. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  34490. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  34491. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  34492. if ($nbLines === $unmergedRowKey - $line) {
  34493. break;
  34494. }
  34495. }
  34496. }
  34497. }
  34498. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  34499. if (isset($rows[$unmergedRowKey]) && is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  34500. foreach ($unmergedRow as $cellKey => $cell) {
  34501. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  34502. }
  34503. } else {
  34504. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  34505. foreach ($unmergedRow as $column => $cell) {
  34506. if (!empty($cell)) {
  34507. $row[$column] = $unmergedRow[$column];
  34508. }
  34509. }
  34510. array_splice($rows, $unmergedRowKey, 0, array($row));
  34511. }
  34512. }
  34513. return $rows;
  34514. }
  34515. private function fillCells($row)
  34516. {
  34517. $newRow = array();
  34518. foreach ($row as $column => $cell) {
  34519. $newRow[] = $cell;
  34520. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  34521. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  34522. $newRow[] = '';
  34523. }
  34524. }
  34525. }
  34526. return $newRow ?: $row;
  34527. }
  34528. private function copyRow(array $rows, $line)
  34529. {
  34530. $row = $rows[$line];
  34531. foreach ($row as $cellKey => $cellValue) {
  34532. $row[$cellKey] = '';
  34533. if ($cellValue instanceof TableCell) {
  34534. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  34535. }
  34536. }
  34537. return $row;
  34538. }
  34539. private function getNumberOfColumns(array $row)
  34540. {
  34541. $columns = count($row);
  34542. foreach ($row as $column) {
  34543. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  34544. }
  34545. return $columns;
  34546. }
  34547. private function getRowColumns(array $row)
  34548. {
  34549. $columns = range(0, $this->numberOfColumns - 1);
  34550. foreach ($row as $cellKey => $cell) {
  34551. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  34552. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  34553. }
  34554. }
  34555. return $columns;
  34556. }
  34557. private function calculateColumnsWidth($rows)
  34558. {
  34559. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  34560. $lengths = array();
  34561. foreach ($rows as $row) {
  34562. if ($row instanceof TableSeparator) {
  34563. continue;
  34564. }
  34565. foreach ($row as $i => $cell) {
  34566. if ($cell instanceof TableCell) {
  34567. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  34568. $textLength = Helper::strlen($textContent);
  34569. if ($textLength > 0) {
  34570. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  34571. foreach ($contentColumns as $position => $content) {
  34572. $row[$i + $position] = $content;
  34573. }
  34574. }
  34575. }
  34576. }
  34577. $lengths[] = $this->getCellWidth($row, $column);
  34578. }
  34579. $this->columnWidths[$column] = max($lengths) + strlen($this->style->getCellRowContentFormat()) - 2;
  34580. }
  34581. }
  34582. private function getColumnSeparatorWidth()
  34583. {
  34584. return strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  34585. }
  34586. private function getCellWidth(array $row, $column)
  34587. {
  34588. if (isset($row[$column])) {
  34589. $cell = $row[$column];
  34590. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  34591. return $cellWidth;
  34592. }
  34593. return 0;
  34594. }
  34595. private function cleanup()
  34596. {
  34597. $this->columnWidths = array();
  34598. $this->numberOfColumns = null;
  34599. }
  34600. private static function initStyles()
  34601. {
  34602. $borderless = new TableStyle();
  34603. $borderless
  34604. ->setHorizontalBorderChar('=')
  34605. ->setVerticalBorderChar(' ')
  34606. ->setCrossingChar(' ')
  34607. ;
  34608. $compact = new TableStyle();
  34609. $compact
  34610. ->setHorizontalBorderChar('')
  34611. ->setVerticalBorderChar(' ')
  34612. ->setCrossingChar('')
  34613. ->setCellRowContentFormat('%s')
  34614. ;
  34615. $styleGuide = new TableStyle();
  34616. $styleGuide
  34617. ->setHorizontalBorderChar('-')
  34618. ->setVerticalBorderChar(' ')
  34619. ->setCrossingChar(' ')
  34620. ->setCellHeaderFormat('%s')
  34621. ;
  34622. return array(
  34623. 'default' => new TableStyle(),
  34624. 'borderless' => $borderless,
  34625. 'compact' => $compact,
  34626. 'symfony-style-guide' => $styleGuide,
  34627. );
  34628. }
  34629. private function resolveStyle($name)
  34630. {
  34631. if ($name instanceof TableStyle) {
  34632. return $name;
  34633. }
  34634. if (isset(self::$styles[$name])) {
  34635. return self::$styles[$name];
  34636. }
  34637. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  34638. }
  34639. }
  34640. <?php
  34641. namespace Symfony\Component\Console\Helper;
  34642. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34643. class TableCell
  34644. {
  34645. private $value;
  34646. private $options = array(
  34647. 'rowspan' => 1,
  34648. 'colspan' => 1,
  34649. );
  34650. public function __construct($value = '', array $options = array())
  34651. {
  34652. if (is_numeric($value) && !is_string($value)) {
  34653. $value = (string) $value;
  34654. }
  34655. $this->value = $value;
  34656. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  34657. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  34658. }
  34659. $this->options = array_merge($this->options, $options);
  34660. }
  34661. public function __toString()
  34662. {
  34663. return $this->value;
  34664. }
  34665. public function getColspan()
  34666. {
  34667. return (int) $this->options['colspan'];
  34668. }
  34669. public function getRowspan()
  34670. {
  34671. return (int) $this->options['rowspan'];
  34672. }
  34673. }
  34674. <?php
  34675. namespace Symfony\Component\Console\Helper;
  34676. use Symfony\Component\Console\Output\OutputInterface;
  34677. use Symfony\Component\Console\Output\NullOutput;
  34678. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34679. class TableHelper extends Helper
  34680. {
  34681. const LAYOUT_DEFAULT = 0;
  34682. const LAYOUT_BORDERLESS = 1;
  34683. const LAYOUT_COMPACT = 2;
  34684. private $table;
  34685. public function __construct($triggerDeprecationError = true)
  34686. {
  34687. if ($triggerDeprecationError) {
  34688. @trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  34689. }
  34690. $this->table = new Table(new NullOutput());
  34691. }
  34692. public function setLayout($layout)
  34693. {
  34694. switch ($layout) {
  34695. case self::LAYOUT_BORDERLESS:
  34696. $this->table->setStyle('borderless');
  34697. break;
  34698. case self::LAYOUT_COMPACT:
  34699. $this->table->setStyle('compact');
  34700. break;
  34701. case self::LAYOUT_DEFAULT:
  34702. $this->table->setStyle('default');
  34703. break;
  34704. default:
  34705. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  34706. }
  34707. return $this;
  34708. }
  34709. public function setHeaders(array $headers)
  34710. {
  34711. $this->table->setHeaders($headers);
  34712. return $this;
  34713. }
  34714. public function setRows(array $rows)
  34715. {
  34716. $this->table->setRows($rows);
  34717. return $this;
  34718. }
  34719. public function addRows(array $rows)
  34720. {
  34721. $this->table->addRows($rows);
  34722. return $this;
  34723. }
  34724. public function addRow(array $row)
  34725. {
  34726. $this->table->addRow($row);
  34727. return $this;
  34728. }
  34729. public function setRow($column, array $row)
  34730. {
  34731. $this->table->setRow($column, $row);
  34732. return $this;
  34733. }
  34734. public function setPaddingChar($paddingChar)
  34735. {
  34736. $this->table->getStyle()->setPaddingChar($paddingChar);
  34737. return $this;
  34738. }
  34739. public function setHorizontalBorderChar($horizontalBorderChar)
  34740. {
  34741. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  34742. return $this;
  34743. }
  34744. public function setVerticalBorderChar($verticalBorderChar)
  34745. {
  34746. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  34747. return $this;
  34748. }
  34749. public function setCrossingChar($crossingChar)
  34750. {
  34751. $this->table->getStyle()->setCrossingChar($crossingChar);
  34752. return $this;
  34753. }
  34754. public function setCellHeaderFormat($cellHeaderFormat)
  34755. {
  34756. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  34757. return $this;
  34758. }
  34759. public function setCellRowFormat($cellRowFormat)
  34760. {
  34761. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  34762. return $this;
  34763. }
  34764. public function setCellRowContentFormat($cellRowContentFormat)
  34765. {
  34766. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  34767. return $this;
  34768. }
  34769. public function setBorderFormat($borderFormat)
  34770. {
  34771. $this->table->getStyle()->setBorderFormat($borderFormat);
  34772. return $this;
  34773. }
  34774. public function setPadType($padType)
  34775. {
  34776. $this->table->getStyle()->setPadType($padType);
  34777. return $this;
  34778. }
  34779. public function render(OutputInterface $output)
  34780. {
  34781. $p = new \ReflectionProperty($this->table, 'output');
  34782. $p->setAccessible(true);
  34783. $p->setValue($this->table, $output);
  34784. $this->table->render();
  34785. }
  34786. public function getName()
  34787. {
  34788. return 'table';
  34789. }
  34790. }
  34791. <?php
  34792. namespace Symfony\Component\Console\Helper;
  34793. class TableSeparator extends TableCell
  34794. {
  34795. public function __construct(array $options = array())
  34796. {
  34797. parent::__construct('', $options);
  34798. }
  34799. }
  34800. <?php
  34801. namespace Symfony\Component\Console\Helper;
  34802. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34803. use Symfony\Component\Console\Exception\LogicException;
  34804. class TableStyle
  34805. {
  34806. private $paddingChar = ' ';
  34807. private $horizontalBorderChar = '-';
  34808. private $verticalBorderChar = '|';
  34809. private $crossingChar = '+';
  34810. private $cellHeaderFormat = '<info>%s</info>';
  34811. private $cellRowFormat = '%s';
  34812. private $cellRowContentFormat = ' %s ';
  34813. private $borderFormat = '%s';
  34814. private $padType = STR_PAD_RIGHT;
  34815. public function setPaddingChar($paddingChar)
  34816. {
  34817. if (!$paddingChar) {
  34818. throw new LogicException('The padding char must not be empty');
  34819. }
  34820. $this->paddingChar = $paddingChar;
  34821. return $this;
  34822. }
  34823. public function getPaddingChar()
  34824. {
  34825. return $this->paddingChar;
  34826. }
  34827. public function setHorizontalBorderChar($horizontalBorderChar)
  34828. {
  34829. $this->horizontalBorderChar = $horizontalBorderChar;
  34830. return $this;
  34831. }
  34832. public function getHorizontalBorderChar()
  34833. {
  34834. return $this->horizontalBorderChar;
  34835. }
  34836. public function setVerticalBorderChar($verticalBorderChar)
  34837. {
  34838. $this->verticalBorderChar = $verticalBorderChar;
  34839. return $this;
  34840. }
  34841. public function getVerticalBorderChar()
  34842. {
  34843. return $this->verticalBorderChar;
  34844. }
  34845. public function setCrossingChar($crossingChar)
  34846. {
  34847. $this->crossingChar = $crossingChar;
  34848. return $this;
  34849. }
  34850. public function getCrossingChar()
  34851. {
  34852. return $this->crossingChar;
  34853. }
  34854. public function setCellHeaderFormat($cellHeaderFormat)
  34855. {
  34856. $this->cellHeaderFormat = $cellHeaderFormat;
  34857. return $this;
  34858. }
  34859. public function getCellHeaderFormat()
  34860. {
  34861. return $this->cellHeaderFormat;
  34862. }
  34863. public function setCellRowFormat($cellRowFormat)
  34864. {
  34865. $this->cellRowFormat = $cellRowFormat;
  34866. return $this;
  34867. }
  34868. public function getCellRowFormat()
  34869. {
  34870. return $this->cellRowFormat;
  34871. }
  34872. public function setCellRowContentFormat($cellRowContentFormat)
  34873. {
  34874. $this->cellRowContentFormat = $cellRowContentFormat;
  34875. return $this;
  34876. }
  34877. public function getCellRowContentFormat()
  34878. {
  34879. return $this->cellRowContentFormat;
  34880. }
  34881. public function setBorderFormat($borderFormat)
  34882. {
  34883. $this->borderFormat = $borderFormat;
  34884. return $this;
  34885. }
  34886. public function getBorderFormat()
  34887. {
  34888. return $this->borderFormat;
  34889. }
  34890. public function setPadType($padType)
  34891. {
  34892. if (!in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  34893. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  34894. }
  34895. $this->padType = $padType;
  34896. return $this;
  34897. }
  34898. public function getPadType()
  34899. {
  34900. return $this->padType;
  34901. }
  34902. }
  34903. <?php
  34904. namespace Symfony\Component\Console\Input;
  34905. use Symfony\Component\Console\Exception\RuntimeException;
  34906. class ArgvInput extends Input
  34907. {
  34908. private $tokens;
  34909. private $parsed;
  34910. public function __construct(array $argv = null, InputDefinition $definition = null)
  34911. {
  34912. if (null === $argv) {
  34913. $argv = $_SERVER['argv'];
  34914. }
  34915. array_shift($argv);
  34916. $this->tokens = $argv;
  34917. parent::__construct($definition);
  34918. }
  34919. protected function setTokens(array $tokens)
  34920. {
  34921. $this->tokens = $tokens;
  34922. }
  34923. protected function parse()
  34924. {
  34925. $parseOptions = true;
  34926. $this->parsed = $this->tokens;
  34927. while (null !== $token = array_shift($this->parsed)) {
  34928. if ($parseOptions && '' == $token) {
  34929. $this->parseArgument($token);
  34930. } elseif ($parseOptions && '--' == $token) {
  34931. $parseOptions = false;
  34932. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  34933. $this->parseLongOption($token);
  34934. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  34935. $this->parseShortOption($token);
  34936. } else {
  34937. $this->parseArgument($token);
  34938. }
  34939. }
  34940. }
  34941. private function parseShortOption($token)
  34942. {
  34943. $name = substr($token, 1);
  34944. if (strlen($name) > 1) {
  34945. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  34946. $this->addShortOption($name[0], substr($name, 1));
  34947. } else {
  34948. $this->parseShortOptionSet($name);
  34949. }
  34950. } else {
  34951. $this->addShortOption($name, null);
  34952. }
  34953. }
  34954. private function parseShortOptionSet($name)
  34955. {
  34956. $len = strlen($name);
  34957. for ($i = 0; $i < $len; ++$i) {
  34958. if (!$this->definition->hasShortcut($name[$i])) {
  34959. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
  34960. }
  34961. $option = $this->definition->getOptionForShortcut($name[$i]);
  34962. if ($option->acceptValue()) {
  34963. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  34964. break;
  34965. } else {
  34966. $this->addLongOption($option->getName(), null);
  34967. }
  34968. }
  34969. }
  34970. private function parseLongOption($token)
  34971. {
  34972. $name = substr($token, 2);
  34973. if (false !== $pos = strpos($name, '=')) {
  34974. if (0 === strlen($value = substr($name, $pos + 1))) {
  34975. array_unshift($this->parsed, null);
  34976. }
  34977. $this->addLongOption(substr($name, 0, $pos), $value);
  34978. } else {
  34979. $this->addLongOption($name, null);
  34980. }
  34981. }
  34982. private function parseArgument($token)
  34983. {
  34984. $c = count($this->arguments);
  34985. if ($this->definition->hasArgument($c)) {
  34986. $arg = $this->definition->getArgument($c);
  34987. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  34988. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  34989. $arg = $this->definition->getArgument($c - 1);
  34990. $this->arguments[$arg->getName()][] = $token;
  34991. } else {
  34992. $all = $this->definition->getArguments();
  34993. if (count($all)) {
  34994. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  34995. }
  34996. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  34997. }
  34998. }
  34999. private function addShortOption($shortcut, $value)
  35000. {
  35001. if (!$this->definition->hasShortcut($shortcut)) {
  35002. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  35003. }
  35004. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  35005. }
  35006. private function addLongOption($name, $value)
  35007. {
  35008. if (!$this->definition->hasOption($name)) {
  35009. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  35010. }
  35011. $option = $this->definition->getOption($name);
  35012. if (!isset($value[0])) {
  35013. $value = null;
  35014. }
  35015. if (null !== $value && !$option->acceptValue()) {
  35016. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  35017. }
  35018. if (null === $value && $option->acceptValue() && count($this->parsed)) {
  35019. $next = array_shift($this->parsed);
  35020. if (isset($next[0]) && '-' !== $next[0]) {
  35021. $value = $next;
  35022. } elseif (empty($next)) {
  35023. $value = null;
  35024. } else {
  35025. array_unshift($this->parsed, $next);
  35026. }
  35027. }
  35028. if (null === $value) {
  35029. if ($option->isValueRequired()) {
  35030. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  35031. }
  35032. if (!$option->isArray()) {
  35033. $value = $option->isValueOptional() ? $option->getDefault() : true;
  35034. }
  35035. }
  35036. if ($option->isArray()) {
  35037. $this->options[$name][] = $value;
  35038. } else {
  35039. $this->options[$name] = $value;
  35040. }
  35041. }
  35042. public function getFirstArgument()
  35043. {
  35044. foreach ($this->tokens as $token) {
  35045. if ($token && '-' === $token[0]) {
  35046. continue;
  35047. }
  35048. return $token;
  35049. }
  35050. }
  35051. public function hasParameterOption($values)
  35052. {
  35053. $values = (array) $values;
  35054. foreach ($this->tokens as $token) {
  35055. foreach ($values as $value) {
  35056. if ($token === $value || 0 === strpos($token, $value.'=')) {
  35057. return true;
  35058. }
  35059. if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) {
  35060. $searchableToken = str_replace('-', '', $token);
  35061. $searchableValue = str_replace('-', '', $value);
  35062. if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) {
  35063. return true;
  35064. }
  35065. }
  35066. }
  35067. }
  35068. return false;
  35069. }
  35070. public function getParameterOption($values, $default = false)
  35071. {
  35072. $values = (array) $values;
  35073. $tokens = $this->tokens;
  35074. while (0 < count($tokens)) {
  35075. $token = array_shift($tokens);
  35076. foreach ($values as $value) {
  35077. if ($token === $value || 0 === strpos($token, $value.'=')) {
  35078. if (false !== $pos = strpos($token, '=')) {
  35079. return substr($token, $pos + 1);
  35080. }
  35081. return array_shift($tokens);
  35082. }
  35083. }
  35084. }
  35085. return $default;
  35086. }
  35087. public function __toString()
  35088. {
  35089. $self = $this;
  35090. $tokens = array_map(function ($token) use ($self) {
  35091. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  35092. return $match[1].$self->escapeToken($match[2]);
  35093. }
  35094. if ($token && '-' !== $token[0]) {
  35095. return $self->escapeToken($token);
  35096. }
  35097. return $token;
  35098. }, $this->tokens);
  35099. return implode(' ', $tokens);
  35100. }
  35101. }
  35102. <?php
  35103. namespace Symfony\Component\Console\Input;
  35104. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35105. use Symfony\Component\Console\Exception\InvalidOptionException;
  35106. class ArrayInput extends Input
  35107. {
  35108. private $parameters;
  35109. public function __construct(array $parameters, InputDefinition $definition = null)
  35110. {
  35111. $this->parameters = $parameters;
  35112. parent::__construct($definition);
  35113. }
  35114. public function getFirstArgument()
  35115. {
  35116. foreach ($this->parameters as $key => $value) {
  35117. if ($key && '-' === $key[0]) {
  35118. continue;
  35119. }
  35120. return $value;
  35121. }
  35122. }
  35123. public function hasParameterOption($values)
  35124. {
  35125. $values = (array) $values;
  35126. foreach ($this->parameters as $k => $v) {
  35127. if (!is_int($k)) {
  35128. $v = $k;
  35129. }
  35130. if (in_array($v, $values)) {
  35131. return true;
  35132. }
  35133. }
  35134. return false;
  35135. }
  35136. public function getParameterOption($values, $default = false)
  35137. {
  35138. $values = (array) $values;
  35139. foreach ($this->parameters as $k => $v) {
  35140. if (is_int($k)) {
  35141. if (in_array($v, $values)) {
  35142. return true;
  35143. }
  35144. } elseif (in_array($k, $values)) {
  35145. return $v;
  35146. }
  35147. }
  35148. return $default;
  35149. }
  35150. public function __toString()
  35151. {
  35152. $params = array();
  35153. foreach ($this->parameters as $param => $val) {
  35154. if ($param && '-' === $param[0]) {
  35155. if (is_array($val)) {
  35156. foreach ($val as $v) {
  35157. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  35158. }
  35159. } else {
  35160. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  35161. }
  35162. } else {
  35163. $params[] = is_array($val) ? array_map(array($this, 'escapeToken'), $val) : $this->escapeToken($val);
  35164. }
  35165. }
  35166. return implode(' ', $params);
  35167. }
  35168. protected function parse()
  35169. {
  35170. foreach ($this->parameters as $key => $value) {
  35171. if (0 === strpos($key, '--')) {
  35172. $this->addLongOption(substr($key, 2), $value);
  35173. } elseif ('-' === $key[0]) {
  35174. $this->addShortOption(substr($key, 1), $value);
  35175. } else {
  35176. $this->addArgument($key, $value);
  35177. }
  35178. }
  35179. }
  35180. private function addShortOption($shortcut, $value)
  35181. {
  35182. if (!$this->definition->hasShortcut($shortcut)) {
  35183. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  35184. }
  35185. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  35186. }
  35187. private function addLongOption($name, $value)
  35188. {
  35189. if (!$this->definition->hasOption($name)) {
  35190. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  35191. }
  35192. $option = $this->definition->getOption($name);
  35193. if (null === $value) {
  35194. if ($option->isValueRequired()) {
  35195. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  35196. }
  35197. $value = $option->isValueOptional() ? $option->getDefault() : true;
  35198. }
  35199. $this->options[$name] = $value;
  35200. }
  35201. private function addArgument($name, $value)
  35202. {
  35203. if (!$this->definition->hasArgument($name)) {
  35204. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35205. }
  35206. $this->arguments[$name] = $value;
  35207. }
  35208. }
  35209. <?php
  35210. namespace Symfony\Component\Console\Input;
  35211. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35212. use Symfony\Component\Console\Exception\RuntimeException;
  35213. abstract class Input implements InputInterface
  35214. {
  35215. protected $definition;
  35216. protected $options = array();
  35217. protected $arguments = array();
  35218. protected $interactive = true;
  35219. public function __construct(InputDefinition $definition = null)
  35220. {
  35221. if (null === $definition) {
  35222. $this->definition = new InputDefinition();
  35223. } else {
  35224. $this->bind($definition);
  35225. $this->validate();
  35226. }
  35227. }
  35228. public function bind(InputDefinition $definition)
  35229. {
  35230. $this->arguments = array();
  35231. $this->options = array();
  35232. $this->definition = $definition;
  35233. $this->parse();
  35234. }
  35235. abstract protected function parse();
  35236. public function validate()
  35237. {
  35238. $definition = $this->definition;
  35239. $givenArguments = $this->arguments;
  35240. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  35241. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  35242. });
  35243. if (count($missingArguments) > 0) {
  35244. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  35245. }
  35246. }
  35247. public function isInteractive()
  35248. {
  35249. return $this->interactive;
  35250. }
  35251. public function setInteractive($interactive)
  35252. {
  35253. $this->interactive = (bool) $interactive;
  35254. }
  35255. public function getArguments()
  35256. {
  35257. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  35258. }
  35259. public function getArgument($name)
  35260. {
  35261. if (!$this->definition->hasArgument($name)) {
  35262. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35263. }
  35264. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  35265. }
  35266. public function setArgument($name, $value)
  35267. {
  35268. if (!$this->definition->hasArgument($name)) {
  35269. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35270. }
  35271. $this->arguments[$name] = $value;
  35272. }
  35273. public function hasArgument($name)
  35274. {
  35275. return $this->definition->hasArgument($name);
  35276. }
  35277. public function getOptions()
  35278. {
  35279. return array_merge($this->definition->getOptionDefaults(), $this->options);
  35280. }
  35281. public function getOption($name)
  35282. {
  35283. if (!$this->definition->hasOption($name)) {
  35284. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  35285. }
  35286. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  35287. }
  35288. public function setOption($name, $value)
  35289. {
  35290. if (!$this->definition->hasOption($name)) {
  35291. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  35292. }
  35293. $this->options[$name] = $value;
  35294. }
  35295. public function hasOption($name)
  35296. {
  35297. return $this->definition->hasOption($name);
  35298. }
  35299. public function escapeToken($token)
  35300. {
  35301. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  35302. }
  35303. }
  35304. <?php
  35305. namespace Symfony\Component\Console\Input;
  35306. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35307. use Symfony\Component\Console\Exception\LogicException;
  35308. class InputArgument
  35309. {
  35310. const REQUIRED = 1;
  35311. const OPTIONAL = 2;
  35312. const IS_ARRAY = 4;
  35313. private $name;
  35314. private $mode;
  35315. private $default;
  35316. private $description;
  35317. public function __construct($name, $mode = null, $description = '', $default = null)
  35318. {
  35319. if (null === $mode) {
  35320. $mode = self::OPTIONAL;
  35321. } elseif (!is_int($mode) || $mode > 7 || $mode < 1) {
  35322. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  35323. }
  35324. $this->name = $name;
  35325. $this->mode = $mode;
  35326. $this->description = $description;
  35327. $this->setDefault($default);
  35328. }
  35329. public function getName()
  35330. {
  35331. return $this->name;
  35332. }
  35333. public function isRequired()
  35334. {
  35335. return self::REQUIRED === (self::REQUIRED & $this->mode);
  35336. }
  35337. public function isArray()
  35338. {
  35339. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  35340. }
  35341. public function setDefault($default = null)
  35342. {
  35343. if (self::REQUIRED === $this->mode && null !== $default) {
  35344. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  35345. }
  35346. if ($this->isArray()) {
  35347. if (null === $default) {
  35348. $default = array();
  35349. } elseif (!is_array($default)) {
  35350. throw new LogicException('A default value for an array argument must be an array.');
  35351. }
  35352. }
  35353. $this->default = $default;
  35354. }
  35355. public function getDefault()
  35356. {
  35357. return $this->default;
  35358. }
  35359. public function getDescription()
  35360. {
  35361. return $this->description;
  35362. }
  35363. }
  35364. <?php
  35365. namespace Symfony\Component\Console\Input;
  35366. interface InputAwareInterface
  35367. {
  35368. public function setInput(InputInterface $input);
  35369. }
  35370. <?php
  35371. namespace Symfony\Component\Console\Input;
  35372. use Symfony\Component\Console\Descriptor\TextDescriptor;
  35373. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  35374. use Symfony\Component\Console\Output\BufferedOutput;
  35375. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35376. use Symfony\Component\Console\Exception\LogicException;
  35377. class InputDefinition
  35378. {
  35379. private $arguments;
  35380. private $requiredCount;
  35381. private $hasAnArrayArgument = false;
  35382. private $hasOptional;
  35383. private $options;
  35384. private $shortcuts;
  35385. public function __construct(array $definition = array())
  35386. {
  35387. $this->setDefinition($definition);
  35388. }
  35389. public function setDefinition(array $definition)
  35390. {
  35391. $arguments = array();
  35392. $options = array();
  35393. foreach ($definition as $item) {
  35394. if ($item instanceof InputOption) {
  35395. $options[] = $item;
  35396. } else {
  35397. $arguments[] = $item;
  35398. }
  35399. }
  35400. $this->setArguments($arguments);
  35401. $this->setOptions($options);
  35402. }
  35403. public function setArguments($arguments = array())
  35404. {
  35405. $this->arguments = array();
  35406. $this->requiredCount = 0;
  35407. $this->hasOptional = false;
  35408. $this->hasAnArrayArgument = false;
  35409. $this->addArguments($arguments);
  35410. }
  35411. public function addArguments($arguments = array())
  35412. {
  35413. if (null !== $arguments) {
  35414. foreach ($arguments as $argument) {
  35415. $this->addArgument($argument);
  35416. }
  35417. }
  35418. }
  35419. public function addArgument(InputArgument $argument)
  35420. {
  35421. if (isset($this->arguments[$argument->getName()])) {
  35422. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  35423. }
  35424. if ($this->hasAnArrayArgument) {
  35425. throw new LogicException('Cannot add an argument after an array argument.');
  35426. }
  35427. if ($argument->isRequired() && $this->hasOptional) {
  35428. throw new LogicException('Cannot add a required argument after an optional one.');
  35429. }
  35430. if ($argument->isArray()) {
  35431. $this->hasAnArrayArgument = true;
  35432. }
  35433. if ($argument->isRequired()) {
  35434. ++$this->requiredCount;
  35435. } else {
  35436. $this->hasOptional = true;
  35437. }
  35438. $this->arguments[$argument->getName()] = $argument;
  35439. }
  35440. public function getArgument($name)
  35441. {
  35442. if (!$this->hasArgument($name)) {
  35443. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  35444. }
  35445. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  35446. return $arguments[$name];
  35447. }
  35448. public function hasArgument($name)
  35449. {
  35450. $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  35451. return isset($arguments[$name]);
  35452. }
  35453. public function getArguments()
  35454. {
  35455. return $this->arguments;
  35456. }
  35457. public function getArgumentCount()
  35458. {
  35459. return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments);
  35460. }
  35461. public function getArgumentRequiredCount()
  35462. {
  35463. return $this->requiredCount;
  35464. }
  35465. public function getArgumentDefaults()
  35466. {
  35467. $values = array();
  35468. foreach ($this->arguments as $argument) {
  35469. $values[$argument->getName()] = $argument->getDefault();
  35470. }
  35471. return $values;
  35472. }
  35473. public function setOptions($options = array())
  35474. {
  35475. $this->options = array();
  35476. $this->shortcuts = array();
  35477. $this->addOptions($options);
  35478. }
  35479. public function addOptions($options = array())
  35480. {
  35481. foreach ($options as $option) {
  35482. $this->addOption($option);
  35483. }
  35484. }
  35485. public function addOption(InputOption $option)
  35486. {
  35487. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  35488. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  35489. }
  35490. if ($option->getShortcut()) {
  35491. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  35492. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  35493. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  35494. }
  35495. }
  35496. }
  35497. $this->options[$option->getName()] = $option;
  35498. if ($option->getShortcut()) {
  35499. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  35500. $this->shortcuts[$shortcut] = $option->getName();
  35501. }
  35502. }
  35503. }
  35504. public function getOption($name)
  35505. {
  35506. if (!$this->hasOption($name)) {
  35507. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  35508. }
  35509. return $this->options[$name];
  35510. }
  35511. public function hasOption($name)
  35512. {
  35513. return isset($this->options[$name]);
  35514. }
  35515. public function getOptions()
  35516. {
  35517. return $this->options;
  35518. }
  35519. public function hasShortcut($name)
  35520. {
  35521. return isset($this->shortcuts[$name]);
  35522. }
  35523. public function getOptionForShortcut($shortcut)
  35524. {
  35525. return $this->getOption($this->shortcutToName($shortcut));
  35526. }
  35527. public function getOptionDefaults()
  35528. {
  35529. $values = array();
  35530. foreach ($this->options as $option) {
  35531. $values[$option->getName()] = $option->getDefault();
  35532. }
  35533. return $values;
  35534. }
  35535. private function shortcutToName($shortcut)
  35536. {
  35537. if (!isset($this->shortcuts[$shortcut])) {
  35538. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  35539. }
  35540. return $this->shortcuts[$shortcut];
  35541. }
  35542. public function getSynopsis($short = false)
  35543. {
  35544. $elements = array();
  35545. if ($short && $this->getOptions()) {
  35546. $elements[] = '[options]';
  35547. } elseif (!$short) {
  35548. foreach ($this->getOptions() as $option) {
  35549. $value = '';
  35550. if ($option->acceptValue()) {
  35551. $value = sprintf(
  35552. ' %s%s%s',
  35553. $option->isValueOptional() ? '[' : '',
  35554. strtoupper($option->getName()),
  35555. $option->isValueOptional() ? ']' : ''
  35556. );
  35557. }
  35558. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  35559. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  35560. }
  35561. }
  35562. if (count($elements) && $this->getArguments()) {
  35563. $elements[] = '[--]';
  35564. }
  35565. foreach ($this->getArguments() as $argument) {
  35566. $element = '<'.$argument->getName().'>';
  35567. if (!$argument->isRequired()) {
  35568. $element = '['.$element.']';
  35569. } elseif ($argument->isArray()) {
  35570. $element = $element.' ('.$element.')';
  35571. }
  35572. if ($argument->isArray()) {
  35573. $element .= '...';
  35574. }
  35575. $elements[] = $element;
  35576. }
  35577. return implode(' ', $elements);
  35578. }
  35579. public function asText()
  35580. {
  35581. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  35582. $descriptor = new TextDescriptor();
  35583. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  35584. $descriptor->describe($output, $this, array('raw_output' => true));
  35585. return $output->fetch();
  35586. }
  35587. public function asXml($asDom = false)
  35588. {
  35589. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  35590. $descriptor = new XmlDescriptor();
  35591. if ($asDom) {
  35592. return $descriptor->getInputDefinitionDocument($this);
  35593. }
  35594. $output = new BufferedOutput();
  35595. $descriptor->describe($output, $this);
  35596. return $output->fetch();
  35597. }
  35598. }
  35599. <?php
  35600. namespace Symfony\Component\Console\Input;
  35601. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35602. use Symfony\Component\Console\Exception\RuntimeException;
  35603. interface InputInterface
  35604. {
  35605. public function getFirstArgument();
  35606. public function hasParameterOption($values);
  35607. public function getParameterOption($values, $default = false);
  35608. public function bind(InputDefinition $definition);
  35609. public function validate();
  35610. public function getArguments();
  35611. public function getArgument($name);
  35612. public function setArgument($name, $value);
  35613. public function hasArgument($name);
  35614. public function getOptions();
  35615. public function getOption($name);
  35616. public function setOption($name, $value);
  35617. public function hasOption($name);
  35618. public function isInteractive();
  35619. public function setInteractive($interactive);
  35620. }
  35621. <?php
  35622. namespace Symfony\Component\Console\Input;
  35623. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35624. use Symfony\Component\Console\Exception\LogicException;
  35625. class InputOption
  35626. {
  35627. const VALUE_NONE = 1;
  35628. const VALUE_REQUIRED = 2;
  35629. const VALUE_OPTIONAL = 4;
  35630. const VALUE_IS_ARRAY = 8;
  35631. private $name;
  35632. private $shortcut;
  35633. private $mode;
  35634. private $default;
  35635. private $description;
  35636. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  35637. {
  35638. if (0 === strpos($name, '--')) {
  35639. $name = substr($name, 2);
  35640. }
  35641. if (empty($name)) {
  35642. throw new InvalidArgumentException('An option name cannot be empty.');
  35643. }
  35644. if (empty($shortcut)) {
  35645. $shortcut = null;
  35646. }
  35647. if (null !== $shortcut) {
  35648. if (is_array($shortcut)) {
  35649. $shortcut = implode('|', $shortcut);
  35650. }
  35651. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  35652. $shortcuts = array_filter($shortcuts);
  35653. $shortcut = implode('|', $shortcuts);
  35654. if (empty($shortcut)) {
  35655. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  35656. }
  35657. }
  35658. if (null === $mode) {
  35659. $mode = self::VALUE_NONE;
  35660. } elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
  35661. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  35662. }
  35663. $this->name = $name;
  35664. $this->shortcut = $shortcut;
  35665. $this->mode = $mode;
  35666. $this->description = $description;
  35667. if ($this->isArray() && !$this->acceptValue()) {
  35668. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  35669. }
  35670. $this->setDefault($default);
  35671. }
  35672. public function getShortcut()
  35673. {
  35674. return $this->shortcut;
  35675. }
  35676. public function getName()
  35677. {
  35678. return $this->name;
  35679. }
  35680. public function acceptValue()
  35681. {
  35682. return $this->isValueRequired() || $this->isValueOptional();
  35683. }
  35684. public function isValueRequired()
  35685. {
  35686. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  35687. }
  35688. public function isValueOptional()
  35689. {
  35690. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  35691. }
  35692. public function isArray()
  35693. {
  35694. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  35695. }
  35696. public function setDefault($default = null)
  35697. {
  35698. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  35699. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  35700. }
  35701. if ($this->isArray()) {
  35702. if (null === $default) {
  35703. $default = array();
  35704. } elseif (!is_array($default)) {
  35705. throw new LogicException('A default value for an array option must be an array.');
  35706. }
  35707. }
  35708. $this->default = $this->acceptValue() ? $default : false;
  35709. }
  35710. public function getDefault()
  35711. {
  35712. return $this->default;
  35713. }
  35714. public function getDescription()
  35715. {
  35716. return $this->description;
  35717. }
  35718. public function equals(InputOption $option)
  35719. {
  35720. return $option->getName() === $this->getName()
  35721. && $option->getShortcut() === $this->getShortcut()
  35722. && $option->getDefault() === $this->getDefault()
  35723. && $option->isArray() === $this->isArray()
  35724. && $option->isValueRequired() === $this->isValueRequired()
  35725. && $option->isValueOptional() === $this->isValueOptional()
  35726. ;
  35727. }
  35728. }
  35729. <?php
  35730. namespace Symfony\Component\Console\Input;
  35731. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35732. class StringInput extends ArgvInput
  35733. {
  35734. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  35735. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  35736. public function __construct($input, InputDefinition $definition = null)
  35737. {
  35738. if ($definition) {
  35739. @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
  35740. }
  35741. parent::__construct(array(), null);
  35742. $this->setTokens($this->tokenize($input));
  35743. if (null !== $definition) {
  35744. $this->bind($definition);
  35745. }
  35746. }
  35747. private function tokenize($input)
  35748. {
  35749. $tokens = array();
  35750. $length = strlen($input);
  35751. $cursor = 0;
  35752. while ($cursor < $length) {
  35753. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  35754. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  35755. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
  35756. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  35757. $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
  35758. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  35759. $tokens[] = stripcslashes($match[1]);
  35760. } else {
  35761. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  35762. }
  35763. $cursor += strlen($match[0]);
  35764. }
  35765. return $tokens;
  35766. }
  35767. }
  35768. Copyright (c) 2004-2017 Fabien Potencier
  35769. Permission is hereby granted, free of charge, to any person obtaining a copy
  35770. of this software and associated documentation files (the "Software"), to deal
  35771. in the Software without restriction, including without limitation the rights
  35772. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  35773. copies of the Software, and to permit persons to whom the Software is furnished
  35774. to do so, subject to the following conditions:
  35775. The above copyright notice and this permission notice shall be included in all
  35776. copies or substantial portions of the Software.
  35777. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35778. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35779. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35780. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35781. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  35782. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  35783. THE SOFTWARE.
  35784. <?php
  35785. namespace Symfony\Component\Console\Logger;
  35786. use Psr\Log\AbstractLogger;
  35787. use Psr\Log\InvalidArgumentException;
  35788. use Psr\Log\LogLevel;
  35789. use Symfony\Component\Console\Output\OutputInterface;
  35790. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35791. class ConsoleLogger extends AbstractLogger
  35792. {
  35793. const INFO = 'info';
  35794. const ERROR = 'error';
  35795. private $output;
  35796. private $verbosityLevelMap = array(
  35797. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  35798. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  35799. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  35800. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  35801. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  35802. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  35803. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  35804. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  35805. );
  35806. private $formatLevelMap = array(
  35807. LogLevel::EMERGENCY => self::ERROR,
  35808. LogLevel::ALERT => self::ERROR,
  35809. LogLevel::CRITICAL => self::ERROR,
  35810. LogLevel::ERROR => self::ERROR,
  35811. LogLevel::WARNING => self::INFO,
  35812. LogLevel::NOTICE => self::INFO,
  35813. LogLevel::INFO => self::INFO,
  35814. LogLevel::DEBUG => self::INFO,
  35815. );
  35816. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  35817. {
  35818. $this->output = $output;
  35819. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  35820. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  35821. }
  35822. public function log($level, $message, array $context = array())
  35823. {
  35824. if (!isset($this->verbosityLevelMap[$level])) {
  35825. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  35826. }
  35827. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  35828. $output = $this->output->getErrorOutput();
  35829. } else {
  35830. $output = $this->output;
  35831. }
  35832. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  35833. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  35834. }
  35835. }
  35836. private function interpolate($message, array $context)
  35837. {
  35838. $replace = array();
  35839. foreach ($context as $key => $val) {
  35840. if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) {
  35841. $replace[sprintf('{%s}', $key)] = $val;
  35842. }
  35843. }
  35844. return strtr($message, $replace);
  35845. }
  35846. }
  35847. <?php
  35848. namespace Symfony\Component\Console\Output;
  35849. class BufferedOutput extends Output
  35850. {
  35851. private $buffer = '';
  35852. public function fetch()
  35853. {
  35854. $content = $this->buffer;
  35855. $this->buffer = '';
  35856. return $content;
  35857. }
  35858. protected function doWrite($message, $newline)
  35859. {
  35860. $this->buffer .= $message;
  35861. if ($newline) {
  35862. $this->buffer .= PHP_EOL;
  35863. }
  35864. }
  35865. }
  35866. <?php
  35867. namespace Symfony\Component\Console\Output;
  35868. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  35869. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  35870. {
  35871. private $stderr;
  35872. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  35873. {
  35874. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  35875. $actualDecorated = $this->isDecorated();
  35876. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  35877. if (null === $decorated) {
  35878. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  35879. }
  35880. }
  35881. public function setDecorated($decorated)
  35882. {
  35883. parent::setDecorated($decorated);
  35884. $this->stderr->setDecorated($decorated);
  35885. }
  35886. public function setFormatter(OutputFormatterInterface $formatter)
  35887. {
  35888. parent::setFormatter($formatter);
  35889. $this->stderr->setFormatter($formatter);
  35890. }
  35891. public function setVerbosity($level)
  35892. {
  35893. parent::setVerbosity($level);
  35894. $this->stderr->setVerbosity($level);
  35895. }
  35896. public function getErrorOutput()
  35897. {
  35898. return $this->stderr;
  35899. }
  35900. public function setErrorOutput(OutputInterface $error)
  35901. {
  35902. $this->stderr = $error;
  35903. }
  35904. protected function hasStdoutSupport()
  35905. {
  35906. return false === $this->isRunningOS400();
  35907. }
  35908. protected function hasStderrSupport()
  35909. {
  35910. return false === $this->isRunningOS400();
  35911. }
  35912. private function isRunningOS400()
  35913. {
  35914. $checks = array(
  35915. function_exists('php_uname') ? php_uname('s') : '',
  35916. getenv('OSTYPE'),
  35917. PHP_OS,
  35918. );
  35919. return false !== stripos(implode(';', $checks), 'OS400');
  35920. }
  35921. private function openOutputStream()
  35922. {
  35923. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  35924. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  35925. }
  35926. private function openErrorStream()
  35927. {
  35928. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  35929. return fopen($errorStream, 'w');
  35930. }
  35931. }
  35932. <?php
  35933. namespace Symfony\Component\Console\Output;
  35934. interface ConsoleOutputInterface extends OutputInterface
  35935. {
  35936. public function getErrorOutput();
  35937. public function setErrorOutput(OutputInterface $error);
  35938. }
  35939. <?php
  35940. namespace Symfony\Component\Console\Output;
  35941. use Symfony\Component\Console\Formatter\OutputFormatter;
  35942. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  35943. class NullOutput implements OutputInterface
  35944. {
  35945. public function setFormatter(OutputFormatterInterface $formatter)
  35946. {
  35947. }
  35948. public function getFormatter()
  35949. {
  35950. return new OutputFormatter();
  35951. }
  35952. public function setDecorated($decorated)
  35953. {
  35954. }
  35955. public function isDecorated()
  35956. {
  35957. return false;
  35958. }
  35959. public function setVerbosity($level)
  35960. {
  35961. }
  35962. public function getVerbosity()
  35963. {
  35964. return self::VERBOSITY_QUIET;
  35965. }
  35966. public function isQuiet()
  35967. {
  35968. return true;
  35969. }
  35970. public function isVerbose()
  35971. {
  35972. return false;
  35973. }
  35974. public function isVeryVerbose()
  35975. {
  35976. return false;
  35977. }
  35978. public function isDebug()
  35979. {
  35980. return false;
  35981. }
  35982. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  35983. {
  35984. }
  35985. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  35986. {
  35987. }
  35988. }
  35989. <?php
  35990. namespace Symfony\Component\Console\Output;
  35991. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  35992. use Symfony\Component\Console\Formatter\OutputFormatter;
  35993. abstract class Output implements OutputInterface
  35994. {
  35995. private $verbosity;
  35996. private $formatter;
  35997. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  35998. {
  35999. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  36000. $this->formatter = $formatter ?: new OutputFormatter();
  36001. $this->formatter->setDecorated($decorated);
  36002. }
  36003. public function setFormatter(OutputFormatterInterface $formatter)
  36004. {
  36005. $this->formatter = $formatter;
  36006. }
  36007. public function getFormatter()
  36008. {
  36009. return $this->formatter;
  36010. }
  36011. public function setDecorated($decorated)
  36012. {
  36013. $this->formatter->setDecorated($decorated);
  36014. }
  36015. public function isDecorated()
  36016. {
  36017. return $this->formatter->isDecorated();
  36018. }
  36019. public function setVerbosity($level)
  36020. {
  36021. $this->verbosity = (int) $level;
  36022. }
  36023. public function getVerbosity()
  36024. {
  36025. return $this->verbosity;
  36026. }
  36027. public function isQuiet()
  36028. {
  36029. return self::VERBOSITY_QUIET === $this->verbosity;
  36030. }
  36031. public function isVerbose()
  36032. {
  36033. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  36034. }
  36035. public function isVeryVerbose()
  36036. {
  36037. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  36038. }
  36039. public function isDebug()
  36040. {
  36041. return self::VERBOSITY_DEBUG <= $this->verbosity;
  36042. }
  36043. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  36044. {
  36045. $this->write($messages, true, $options);
  36046. }
  36047. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  36048. {
  36049. $messages = (array) $messages;
  36050. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  36051. $type = $types & $options ?: self::OUTPUT_NORMAL;
  36052. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  36053. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  36054. if ($verbosity > $this->getVerbosity()) {
  36055. return;
  36056. }
  36057. foreach ($messages as $message) {
  36058. switch ($type) {
  36059. case OutputInterface::OUTPUT_NORMAL:
  36060. $message = $this->formatter->format($message);
  36061. break;
  36062. case OutputInterface::OUTPUT_RAW:
  36063. break;
  36064. case OutputInterface::OUTPUT_PLAIN:
  36065. $message = strip_tags($this->formatter->format($message));
  36066. break;
  36067. }
  36068. $this->doWrite($message, $newline);
  36069. }
  36070. }
  36071. abstract protected function doWrite($message, $newline);
  36072. }
  36073. <?php
  36074. namespace Symfony\Component\Console\Output;
  36075. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36076. interface OutputInterface
  36077. {
  36078. const VERBOSITY_QUIET = 16;
  36079. const VERBOSITY_NORMAL = 32;
  36080. const VERBOSITY_VERBOSE = 64;
  36081. const VERBOSITY_VERY_VERBOSE = 128;
  36082. const VERBOSITY_DEBUG = 256;
  36083. const OUTPUT_NORMAL = 1;
  36084. const OUTPUT_RAW = 2;
  36085. const OUTPUT_PLAIN = 4;
  36086. public function write($messages, $newline = false, $options = 0);
  36087. public function writeln($messages, $options = 0);
  36088. public function setVerbosity($level);
  36089. public function getVerbosity();
  36090. public function setDecorated($decorated);
  36091. public function isDecorated();
  36092. public function setFormatter(OutputFormatterInterface $formatter);
  36093. public function getFormatter();
  36094. }
  36095. <?php
  36096. namespace Symfony\Component\Console\Output;
  36097. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36098. use Symfony\Component\Console\Exception\RuntimeException;
  36099. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36100. class StreamOutput extends Output
  36101. {
  36102. private $stream;
  36103. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  36104. {
  36105. if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  36106. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  36107. }
  36108. $this->stream = $stream;
  36109. if (null === $decorated) {
  36110. $decorated = $this->hasColorSupport();
  36111. }
  36112. parent::__construct($verbosity, $decorated, $formatter);
  36113. }
  36114. public function getStream()
  36115. {
  36116. return $this->stream;
  36117. }
  36118. protected function doWrite($message, $newline)
  36119. {
  36120. if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) {
  36121. throw new RuntimeException('Unable to write output.');
  36122. }
  36123. fflush($this->stream);
  36124. }
  36125. protected function hasColorSupport()
  36126. {
  36127. if (DIRECTORY_SEPARATOR === '\\') {
  36128. return
  36129. '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
  36130. || false !== getenv('ANSICON')
  36131. || 'ON' === getenv('ConEmuANSI')
  36132. || 'xterm' === getenv('TERM');
  36133. }
  36134. return function_exists('posix_isatty') && @posix_isatty($this->stream);
  36135. }
  36136. }
  36137. <?php
  36138. namespace Symfony\Component\Console\Question;
  36139. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36140. class ChoiceQuestion extends Question
  36141. {
  36142. private $choices;
  36143. private $multiselect = false;
  36144. private $prompt = ' > ';
  36145. private $errorMessage = 'Value "%s" is invalid';
  36146. public function __construct($question, array $choices, $default = null)
  36147. {
  36148. if (!$choices) {
  36149. throw new \LogicException('Choice question must have at least 1 choice available.');
  36150. }
  36151. parent::__construct($question, $default);
  36152. $this->choices = $choices;
  36153. $this->setValidator($this->getDefaultValidator());
  36154. $this->setAutocompleterValues($choices);
  36155. }
  36156. public function getChoices()
  36157. {
  36158. return $this->choices;
  36159. }
  36160. public function setMultiselect($multiselect)
  36161. {
  36162. $this->multiselect = $multiselect;
  36163. $this->setValidator($this->getDefaultValidator());
  36164. return $this;
  36165. }
  36166. public function isMultiselect()
  36167. {
  36168. return $this->multiselect;
  36169. }
  36170. public function getPrompt()
  36171. {
  36172. return $this->prompt;
  36173. }
  36174. public function setPrompt($prompt)
  36175. {
  36176. $this->prompt = $prompt;
  36177. return $this;
  36178. }
  36179. public function setErrorMessage($errorMessage)
  36180. {
  36181. $this->errorMessage = $errorMessage;
  36182. $this->setValidator($this->getDefaultValidator());
  36183. return $this;
  36184. }
  36185. private function getDefaultValidator()
  36186. {
  36187. $choices = $this->choices;
  36188. $errorMessage = $this->errorMessage;
  36189. $multiselect = $this->multiselect;
  36190. $isAssoc = $this->isAssoc($choices);
  36191. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  36192. $selectedChoices = str_replace(' ', '', $selected);
  36193. if ($multiselect) {
  36194. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  36195. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  36196. }
  36197. $selectedChoices = explode(',', $selectedChoices);
  36198. } else {
  36199. $selectedChoices = array($selected);
  36200. }
  36201. $multiselectChoices = array();
  36202. foreach ($selectedChoices as $value) {
  36203. $results = array();
  36204. foreach ($choices as $key => $choice) {
  36205. if ($choice === $value) {
  36206. $results[] = $key;
  36207. }
  36208. }
  36209. if (count($results) > 1) {
  36210. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  36211. }
  36212. $result = array_search($value, $choices);
  36213. if (!$isAssoc) {
  36214. if (false !== $result) {
  36215. $result = $choices[$result];
  36216. } elseif (isset($choices[$value])) {
  36217. $result = $choices[$value];
  36218. }
  36219. } elseif (false === $result && isset($choices[$value])) {
  36220. $result = $value;
  36221. }
  36222. if (false === $result) {
  36223. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  36224. }
  36225. $multiselectChoices[] = (string) $result;
  36226. }
  36227. if ($multiselect) {
  36228. return $multiselectChoices;
  36229. }
  36230. return current($multiselectChoices);
  36231. };
  36232. }
  36233. }
  36234. <?php
  36235. namespace Symfony\Component\Console\Question;
  36236. class ConfirmationQuestion extends Question
  36237. {
  36238. private $trueAnswerRegex;
  36239. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  36240. {
  36241. parent::__construct($question, (bool) $default);
  36242. $this->trueAnswerRegex = $trueAnswerRegex;
  36243. $this->setNormalizer($this->getDefaultNormalizer());
  36244. }
  36245. private function getDefaultNormalizer()
  36246. {
  36247. $default = $this->getDefault();
  36248. $regex = $this->trueAnswerRegex;
  36249. return function ($answer) use ($default, $regex) {
  36250. if (is_bool($answer)) {
  36251. return $answer;
  36252. }
  36253. $answerIsTrue = (bool) preg_match($regex, $answer);
  36254. if (false === $default) {
  36255. return $answer && $answerIsTrue;
  36256. }
  36257. return !$answer || $answerIsTrue;
  36258. };
  36259. }
  36260. }
  36261. <?php
  36262. namespace Symfony\Component\Console\Question;
  36263. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36264. use Symfony\Component\Console\Exception\LogicException;
  36265. class Question
  36266. {
  36267. private $question;
  36268. private $attempts;
  36269. private $hidden = false;
  36270. private $hiddenFallback = true;
  36271. private $autocompleterValues;
  36272. private $validator;
  36273. private $default;
  36274. private $normalizer;
  36275. public function __construct($question, $default = null)
  36276. {
  36277. $this->question = $question;
  36278. $this->default = $default;
  36279. }
  36280. public function getQuestion()
  36281. {
  36282. return $this->question;
  36283. }
  36284. public function getDefault()
  36285. {
  36286. return $this->default;
  36287. }
  36288. public function isHidden()
  36289. {
  36290. return $this->hidden;
  36291. }
  36292. public function setHidden($hidden)
  36293. {
  36294. if ($this->autocompleterValues) {
  36295. throw new LogicException('A hidden question cannot use the autocompleter.');
  36296. }
  36297. $this->hidden = (bool) $hidden;
  36298. return $this;
  36299. }
  36300. public function isHiddenFallback()
  36301. {
  36302. return $this->hiddenFallback;
  36303. }
  36304. public function setHiddenFallback($fallback)
  36305. {
  36306. $this->hiddenFallback = (bool) $fallback;
  36307. return $this;
  36308. }
  36309. public function getAutocompleterValues()
  36310. {
  36311. return $this->autocompleterValues;
  36312. }
  36313. public function setAutocompleterValues($values)
  36314. {
  36315. if (is_array($values)) {
  36316. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  36317. }
  36318. if (null !== $values && !is_array($values) && !$values instanceof \Traversable) {
  36319. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  36320. }
  36321. if ($this->hidden) {
  36322. throw new LogicException('A hidden question cannot use the autocompleter.');
  36323. }
  36324. $this->autocompleterValues = $values;
  36325. return $this;
  36326. }
  36327. public function setValidator($validator)
  36328. {
  36329. $this->validator = $validator;
  36330. return $this;
  36331. }
  36332. public function getValidator()
  36333. {
  36334. return $this->validator;
  36335. }
  36336. public function setMaxAttempts($attempts)
  36337. {
  36338. if (null !== $attempts && $attempts < 1) {
  36339. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  36340. }
  36341. $this->attempts = $attempts;
  36342. return $this;
  36343. }
  36344. public function getMaxAttempts()
  36345. {
  36346. return $this->attempts;
  36347. }
  36348. public function setNormalizer($normalizer)
  36349. {
  36350. $this->normalizer = $normalizer;
  36351. return $this;
  36352. }
  36353. public function getNormalizer()
  36354. {
  36355. return $this->normalizer;
  36356. }
  36357. protected function isAssoc($array)
  36358. {
  36359. return (bool) count(array_filter(array_keys($array), 'is_string'));
  36360. }
  36361. }
  36362. <?php
  36363. namespace Symfony\Component\Console;
  36364. use Symfony\Component\Console\Exception\RuntimeException;
  36365. use Symfony\Component\Console\Input\StringInput;
  36366. use Symfony\Component\Console\Output\ConsoleOutput;
  36367. use Symfony\Component\Process\ProcessBuilder;
  36368. use Symfony\Component\Process\PhpExecutableFinder;
  36369. class Shell
  36370. {
  36371. private $application;
  36372. private $history;
  36373. private $output;
  36374. private $hasReadline;
  36375. private $processIsolation = false;
  36376. public function __construct(Application $application)
  36377. {
  36378. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  36379. $this->hasReadline = function_exists('readline');
  36380. $this->application = $application;
  36381. $this->history = getenv('HOME').'/.history_'.$application->getName();
  36382. $this->output = new ConsoleOutput();
  36383. }
  36384. public function run()
  36385. {
  36386. $this->application->setAutoExit(false);
  36387. $this->application->setCatchExceptions(true);
  36388. if ($this->hasReadline) {
  36389. readline_read_history($this->history);
  36390. readline_completion_function(array($this, 'autocompleter'));
  36391. }
  36392. $this->output->writeln($this->getHeader());
  36393. $php = null;
  36394. if ($this->processIsolation) {
  36395. $finder = new PhpExecutableFinder();
  36396. $php = $finder->find();
  36397. $this->output->writeln(<<<'EOF'
  36398. <info>Running with process isolation, you should consider this:</info>
  36399. * each command is executed as separate process,
  36400. * commands don't support interactivity, all params must be passed explicitly,
  36401. * commands output is not colorized.
  36402. EOF
  36403. );
  36404. }
  36405. while (true) {
  36406. $command = $this->readline();
  36407. if (false === $command) {
  36408. $this->output->writeln("\n");
  36409. break;
  36410. }
  36411. if ($this->hasReadline) {
  36412. readline_add_history($command);
  36413. readline_write_history($this->history);
  36414. }
  36415. if ($this->processIsolation) {
  36416. $pb = new ProcessBuilder();
  36417. $process = $pb
  36418. ->add($php)
  36419. ->add($_SERVER['argv'][0])
  36420. ->add($command)
  36421. ->inheritEnvironmentVariables(true)
  36422. ->getProcess()
  36423. ;
  36424. $output = $this->output;
  36425. $process->run(function ($type, $data) use ($output) {
  36426. $output->writeln($data);
  36427. });
  36428. $ret = $process->getExitCode();
  36429. } else {
  36430. $ret = $this->application->run(new StringInput($command), $this->output);
  36431. }
  36432. if (0 !== $ret) {
  36433. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  36434. }
  36435. }
  36436. }
  36437. protected function getHeader()
  36438. {
  36439. return <<<EOF
  36440. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  36441. At the prompt, type <comment>help</comment> for some help,
  36442. or <comment>list</comment> to get a list of available commands.
  36443. To exit the shell, type <comment>^D</comment>.
  36444. EOF;
  36445. }
  36446. protected function getPrompt()
  36447. {
  36448. return $this->output->getFormatter()->format($this->application->getName().' > ');
  36449. }
  36450. protected function getOutput()
  36451. {
  36452. return $this->output;
  36453. }
  36454. protected function getApplication()
  36455. {
  36456. return $this->application;
  36457. }
  36458. private function autocompleter($text)
  36459. {
  36460. $info = readline_info();
  36461. $text = substr($info['line_buffer'], 0, $info['end']);
  36462. if ($info['point'] !== $info['end']) {
  36463. return true;
  36464. }
  36465. if (false === strpos($text, ' ') || !$text) {
  36466. return array_keys($this->application->all());
  36467. }
  36468. try {
  36469. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  36470. } catch (\Exception $e) {
  36471. return true;
  36472. }
  36473. $list = array('--help');
  36474. foreach ($command->getDefinition()->getOptions() as $option) {
  36475. $list[] = '--'.$option->getName();
  36476. }
  36477. return $list;
  36478. }
  36479. private function readline()
  36480. {
  36481. if ($this->hasReadline) {
  36482. $line = readline($this->getPrompt());
  36483. } else {
  36484. $this->output->write($this->getPrompt());
  36485. $line = fgets(STDIN, 1024);
  36486. $line = (false === $line || '' === $line) ? false : rtrim($line);
  36487. }
  36488. return $line;
  36489. }
  36490. public function getProcessIsolation()
  36491. {
  36492. return $this->processIsolation;
  36493. }
  36494. public function setProcessIsolation($processIsolation)
  36495. {
  36496. $this->processIsolation = (bool) $processIsolation;
  36497. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  36498. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  36499. }
  36500. }
  36501. }
  36502. <?php
  36503. namespace Symfony\Component\Console\Style;
  36504. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  36505. use Symfony\Component\Console\Helper\ProgressBar;
  36506. use Symfony\Component\Console\Output\OutputInterface;
  36507. abstract class OutputStyle implements OutputInterface, StyleInterface
  36508. {
  36509. private $output;
  36510. public function __construct(OutputInterface $output)
  36511. {
  36512. $this->output = $output;
  36513. }
  36514. public function newLine($count = 1)
  36515. {
  36516. $this->output->write(str_repeat(PHP_EOL, $count));
  36517. }
  36518. public function createProgressBar($max = 0)
  36519. {
  36520. return new ProgressBar($this->output, $max);
  36521. }
  36522. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  36523. {
  36524. $this->output->write($messages, $newline, $type);
  36525. }
  36526. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  36527. {
  36528. $this->output->writeln($messages, $type);
  36529. }
  36530. public function setVerbosity($level)
  36531. {
  36532. $this->output->setVerbosity($level);
  36533. }
  36534. public function getVerbosity()
  36535. {
  36536. return $this->output->getVerbosity();
  36537. }
  36538. public function setDecorated($decorated)
  36539. {
  36540. $this->output->setDecorated($decorated);
  36541. }
  36542. public function isDecorated()
  36543. {
  36544. return $this->output->isDecorated();
  36545. }
  36546. public function setFormatter(OutputFormatterInterface $formatter)
  36547. {
  36548. $this->output->setFormatter($formatter);
  36549. }
  36550. public function getFormatter()
  36551. {
  36552. return $this->output->getFormatter();
  36553. }
  36554. }
  36555. <?php
  36556. namespace Symfony\Component\Console\Style;
  36557. interface StyleInterface
  36558. {
  36559. public function title($message);
  36560. public function section($message);
  36561. public function listing(array $elements);
  36562. public function text($message);
  36563. public function success($message);
  36564. public function error($message);
  36565. public function warning($message);
  36566. public function note($message);
  36567. public function caution($message);
  36568. public function table(array $headers, array $rows);
  36569. public function ask($question, $default = null, $validator = null);
  36570. public function askHidden($question, $validator = null);
  36571. public function confirm($question, $default = true);
  36572. public function choice($question, array $choices, $default = null);
  36573. public function newLine($count = 1);
  36574. public function progressStart($max = 0);
  36575. public function progressAdvance($step = 1);
  36576. public function progressFinish();
  36577. }
  36578. <?php
  36579. namespace Symfony\Component\Console\Style;
  36580. use Symfony\Component\Console\Application;
  36581. use Symfony\Component\Console\Exception\RuntimeException;
  36582. use Symfony\Component\Console\Formatter\OutputFormatter;
  36583. use Symfony\Component\Console\Helper\Helper;
  36584. use Symfony\Component\Console\Helper\ProgressBar;
  36585. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  36586. use Symfony\Component\Console\Helper\Table;
  36587. use Symfony\Component\Console\Input\InputInterface;
  36588. use Symfony\Component\Console\Output\BufferedOutput;
  36589. use Symfony\Component\Console\Output\OutputInterface;
  36590. use Symfony\Component\Console\Question\ChoiceQuestion;
  36591. use Symfony\Component\Console\Question\ConfirmationQuestion;
  36592. use Symfony\Component\Console\Question\Question;
  36593. class SymfonyStyle extends OutputStyle
  36594. {
  36595. const MAX_LINE_LENGTH = 120;
  36596. private $input;
  36597. private $questionHelper;
  36598. private $progressBar;
  36599. private $lineLength;
  36600. private $bufferedOutput;
  36601. public function __construct(InputInterface $input, OutputInterface $output)
  36602. {
  36603. $this->input = $input;
  36604. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  36605. $this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  36606. parent::__construct($output);
  36607. }
  36608. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  36609. {
  36610. $messages = is_array($messages) ? array_values($messages) : array($messages);
  36611. $this->autoPrependBlock();
  36612. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  36613. $this->newLine();
  36614. }
  36615. public function title($message)
  36616. {
  36617. $this->autoPrependBlock();
  36618. $this->writeln(array(
  36619. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  36620. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  36621. ));
  36622. $this->newLine();
  36623. }
  36624. public function section($message)
  36625. {
  36626. $this->autoPrependBlock();
  36627. $this->writeln(array(
  36628. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  36629. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  36630. ));
  36631. $this->newLine();
  36632. }
  36633. public function listing(array $elements)
  36634. {
  36635. $this->autoPrependText();
  36636. $elements = array_map(function ($element) {
  36637. return sprintf(' * %s', $element);
  36638. }, $elements);
  36639. $this->writeln($elements);
  36640. $this->newLine();
  36641. }
  36642. public function text($message)
  36643. {
  36644. $this->autoPrependText();
  36645. $messages = is_array($message) ? array_values($message) : array($message);
  36646. foreach ($messages as $message) {
  36647. $this->writeln(sprintf(' %s', $message));
  36648. }
  36649. }
  36650. public function comment($message)
  36651. {
  36652. $messages = is_array($message) ? array_values($message) : array($message);
  36653. $this->autoPrependBlock();
  36654. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  36655. $this->newLine();
  36656. }
  36657. public function success($message)
  36658. {
  36659. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  36660. }
  36661. public function error($message)
  36662. {
  36663. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  36664. }
  36665. public function warning($message)
  36666. {
  36667. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  36668. }
  36669. public function note($message)
  36670. {
  36671. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  36672. }
  36673. public function caution($message)
  36674. {
  36675. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  36676. }
  36677. public function table(array $headers, array $rows)
  36678. {
  36679. $style = clone Table::getStyleDefinition('symfony-style-guide');
  36680. $style->setCellHeaderFormat('<info>%s</info>');
  36681. $table = new Table($this);
  36682. $table->setHeaders($headers);
  36683. $table->setRows($rows);
  36684. $table->setStyle($style);
  36685. $table->render();
  36686. $this->newLine();
  36687. }
  36688. public function ask($question, $default = null, $validator = null)
  36689. {
  36690. $question = new Question($question, $default);
  36691. $question->setValidator($validator);
  36692. return $this->askQuestion($question);
  36693. }
  36694. public function askHidden($question, $validator = null)
  36695. {
  36696. $question = new Question($question);
  36697. $question->setHidden(true);
  36698. $question->setValidator($validator);
  36699. return $this->askQuestion($question);
  36700. }
  36701. public function confirm($question, $default = true)
  36702. {
  36703. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  36704. }
  36705. public function choice($question, array $choices, $default = null)
  36706. {
  36707. if (null !== $default) {
  36708. $values = array_flip($choices);
  36709. $default = $values[$default];
  36710. }
  36711. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  36712. }
  36713. public function progressStart($max = 0)
  36714. {
  36715. $this->progressBar = $this->createProgressBar($max);
  36716. $this->progressBar->start();
  36717. }
  36718. public function progressAdvance($step = 1)
  36719. {
  36720. $this->getProgressBar()->advance($step);
  36721. }
  36722. public function progressFinish()
  36723. {
  36724. $this->getProgressBar()->finish();
  36725. $this->newLine(2);
  36726. $this->progressBar = null;
  36727. }
  36728. public function createProgressBar($max = 0)
  36729. {
  36730. $progressBar = parent::createProgressBar($max);
  36731. if ('\\' !== DIRECTORY_SEPARATOR) {
  36732. $progressBar->setEmptyBarCharacter('â–‘');
  36733. $progressBar->setProgressCharacter('');
  36734. $progressBar->setBarCharacter('â–“');
  36735. }
  36736. return $progressBar;
  36737. }
  36738. public function askQuestion(Question $question)
  36739. {
  36740. if ($this->input->isInteractive()) {
  36741. $this->autoPrependBlock();
  36742. }
  36743. if (!$this->questionHelper) {
  36744. $this->questionHelper = new SymfonyQuestionHelper();
  36745. }
  36746. $answer = $this->questionHelper->ask($this->input, $this, $question);
  36747. if ($this->input->isInteractive()) {
  36748. $this->newLine();
  36749. $this->bufferedOutput->write("\n");
  36750. }
  36751. return $answer;
  36752. }
  36753. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  36754. {
  36755. parent::writeln($messages, $type);
  36756. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  36757. }
  36758. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  36759. {
  36760. parent::write($messages, $newline, $type);
  36761. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  36762. }
  36763. public function newLine($count = 1)
  36764. {
  36765. parent::newLine($count);
  36766. $this->bufferedOutput->write(str_repeat("\n", $count));
  36767. }
  36768. private function getProgressBar()
  36769. {
  36770. if (!$this->progressBar) {
  36771. throw new RuntimeException('The ProgressBar is not started.');
  36772. }
  36773. return $this->progressBar;
  36774. }
  36775. private function getTerminalWidth()
  36776. {
  36777. $application = new Application();
  36778. $dimensions = $application->getTerminalDimensions();
  36779. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  36780. }
  36781. private function autoPrependBlock()
  36782. {
  36783. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  36784. if (!isset($chars[0])) {
  36785. return $this->newLine();
  36786. }
  36787. $this->newLine(2 - substr_count($chars, "\n"));
  36788. }
  36789. private function autoPrependText()
  36790. {
  36791. $fetched = $this->bufferedOutput->fetch();
  36792. if ("\n" !== substr($fetched, -1)) {
  36793. $this->newLine();
  36794. }
  36795. }
  36796. private function reduceBuffer($messages)
  36797. {
  36798. return array_map(function ($value) {
  36799. return substr($value, -4);
  36800. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  36801. }
  36802. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  36803. {
  36804. $indentLength = 0;
  36805. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  36806. $lines = array();
  36807. if (null !== $type) {
  36808. $type = sprintf('[%s] ', $type);
  36809. $indentLength = strlen($type);
  36810. $lineIndentation = str_repeat(' ', $indentLength);
  36811. }
  36812. foreach ($messages as $key => $message) {
  36813. if ($escape) {
  36814. $message = OutputFormatter::escape($message);
  36815. }
  36816. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  36817. if (count($messages) > 1 && $key < count($messages) - 1) {
  36818. $lines[] = '';
  36819. }
  36820. }
  36821. $firstLineIndex = 0;
  36822. if ($padding && $this->isDecorated()) {
  36823. $firstLineIndex = 1;
  36824. array_unshift($lines, '');
  36825. $lines[] = '';
  36826. }
  36827. foreach ($lines as $i => &$line) {
  36828. if (null !== $type) {
  36829. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  36830. }
  36831. $line = $prefix.$line;
  36832. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  36833. if ($style) {
  36834. $line = sprintf('<%s>%s</>', $style, $line);
  36835. }
  36836. }
  36837. return $lines;
  36838. }
  36839. }
  36840. <?php
  36841. namespace Symfony\Component\Console\Tester;
  36842. use Symfony\Component\Console\Application;
  36843. use Symfony\Component\Console\Input\ArrayInput;
  36844. use Symfony\Component\Console\Input\InputInterface;
  36845. use Symfony\Component\Console\Output\OutputInterface;
  36846. use Symfony\Component\Console\Output\StreamOutput;
  36847. class ApplicationTester
  36848. {
  36849. private $application;
  36850. private $input;
  36851. private $output;
  36852. private $statusCode;
  36853. public function __construct(Application $application)
  36854. {
  36855. $this->application = $application;
  36856. }
  36857. public function run(array $input, $options = array())
  36858. {
  36859. $this->input = new ArrayInput($input);
  36860. if (isset($options['interactive'])) {
  36861. $this->input->setInteractive($options['interactive']);
  36862. }
  36863. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  36864. if (isset($options['decorated'])) {
  36865. $this->output->setDecorated($options['decorated']);
  36866. }
  36867. if (isset($options['verbosity'])) {
  36868. $this->output->setVerbosity($options['verbosity']);
  36869. }
  36870. return $this->statusCode = $this->application->run($this->input, $this->output);
  36871. }
  36872. public function getDisplay($normalize = false)
  36873. {
  36874. rewind($this->output->getStream());
  36875. $display = stream_get_contents($this->output->getStream());
  36876. if ($normalize) {
  36877. $display = str_replace(PHP_EOL, "\n", $display);
  36878. }
  36879. return $display;
  36880. }
  36881. public function getInput()
  36882. {
  36883. return $this->input;
  36884. }
  36885. public function getOutput()
  36886. {
  36887. return $this->output;
  36888. }
  36889. public function getStatusCode()
  36890. {
  36891. return $this->statusCode;
  36892. }
  36893. }
  36894. <?php
  36895. namespace Symfony\Component\Console\Tester;
  36896. use Symfony\Component\Console\Command\Command;
  36897. use Symfony\Component\Console\Input\ArrayInput;
  36898. use Symfony\Component\Console\Output\StreamOutput;
  36899. use Symfony\Component\Console\Input\InputInterface;
  36900. use Symfony\Component\Console\Output\OutputInterface;
  36901. class CommandTester
  36902. {
  36903. private $command;
  36904. private $input;
  36905. private $output;
  36906. private $statusCode;
  36907. public function __construct(Command $command)
  36908. {
  36909. $this->command = $command;
  36910. }
  36911. public function execute(array $input, array $options = array())
  36912. {
  36913. if (!isset($input['command'])
  36914. && (null !== $application = $this->command->getApplication())
  36915. && $application->getDefinition()->hasArgument('command')
  36916. ) {
  36917. $input = array_merge(array('command' => $this->command->getName()), $input);
  36918. }
  36919. $this->input = new ArrayInput($input);
  36920. if (isset($options['interactive'])) {
  36921. $this->input->setInteractive($options['interactive']);
  36922. }
  36923. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  36924. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  36925. if (isset($options['verbosity'])) {
  36926. $this->output->setVerbosity($options['verbosity']);
  36927. }
  36928. return $this->statusCode = $this->command->run($this->input, $this->output);
  36929. }
  36930. public function getDisplay($normalize = false)
  36931. {
  36932. rewind($this->output->getStream());
  36933. $display = stream_get_contents($this->output->getStream());
  36934. if ($normalize) {
  36935. $display = str_replace(PHP_EOL, "\n", $display);
  36936. }
  36937. return $display;
  36938. }
  36939. public function getInput()
  36940. {
  36941. return $this->input;
  36942. }
  36943. public function getOutput()
  36944. {
  36945. return $this->output;
  36946. }
  36947. public function getStatusCode()
  36948. {
  36949. return $this->statusCode;
  36950. }
  36951. }
  36952. <?php
  36953. namespace Symfony\Component\Debug;
  36954. use Psr\Log\AbstractLogger;
  36955. class BufferingLogger extends AbstractLogger
  36956. {
  36957. private $logs = array();
  36958. public function log($level, $message, array $context = array())
  36959. {
  36960. $this->logs[] = array($level, $message, $context);
  36961. }
  36962. public function cleanLogs()
  36963. {
  36964. $logs = $this->logs;
  36965. $this->logs = array();
  36966. return $logs;
  36967. }
  36968. }
  36969. <?php
  36970. namespace Symfony\Component\Debug;
  36971. class Debug
  36972. {
  36973. private static $enabled = false;
  36974. public static function enable($errorReportingLevel = null, $displayErrors = true)
  36975. {
  36976. if (static::$enabled) {
  36977. return;
  36978. }
  36979. static::$enabled = true;
  36980. if (null !== $errorReportingLevel) {
  36981. error_reporting($errorReportingLevel);
  36982. } else {
  36983. error_reporting(-1);
  36984. }
  36985. if ('cli' !== PHP_SAPI) {
  36986. ini_set('display_errors', 0);
  36987. ExceptionHandler::register();
  36988. } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
  36989. ini_set('display_errors', 1);
  36990. }
  36991. if ($displayErrors) {
  36992. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  36993. } else {
  36994. ErrorHandler::register()->throwAt(0, true);
  36995. }
  36996. DebugClassLoader::enable();
  36997. }
  36998. }
  36999. <?php
  37000. namespace Symfony\Component\Debug;
  37001. class DebugClassLoader
  37002. {
  37003. private $classLoader;
  37004. private $isFinder;
  37005. private $loaded = array();
  37006. private $wasFinder;
  37007. private static $caseCheck;
  37008. private static $deprecated = array();
  37009. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  37010. private static $darwinCache = array('/' => array('/', array()));
  37011. public function __construct($classLoader)
  37012. {
  37013. $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
  37014. if ($this->wasFinder) {
  37015. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  37016. $this->classLoader = array($classLoader, 'loadClass');
  37017. $this->isFinder = true;
  37018. } else {
  37019. $this->classLoader = $classLoader;
  37020. $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  37021. }
  37022. if (!isset(self::$caseCheck)) {
  37023. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
  37024. $i = strrpos($file, DIRECTORY_SEPARATOR);
  37025. $dir = substr($file, 0, 1 + $i);
  37026. $file = substr($file, 1 + $i);
  37027. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  37028. $test = realpath($dir.$test);
  37029. if (false === $test || false === $i) {
  37030. self::$caseCheck = 0;
  37031. } elseif (substr($test, -strlen($file)) === $file) {
  37032. self::$caseCheck = 1;
  37033. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  37034. self::$caseCheck = 2;
  37035. } else {
  37036. self::$caseCheck = 0;
  37037. }
  37038. }
  37039. }
  37040. public function getClassLoader()
  37041. {
  37042. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  37043. }
  37044. public static function enable()
  37045. {
  37046. class_exists('Symfony\Component\Debug\ErrorHandler');
  37047. class_exists('Psr\Log\LogLevel');
  37048. if (!is_array($functions = spl_autoload_functions())) {
  37049. return;
  37050. }
  37051. foreach ($functions as $function) {
  37052. spl_autoload_unregister($function);
  37053. }
  37054. foreach ($functions as $function) {
  37055. if (!is_array($function) || !$function[0] instanceof self) {
  37056. $function = array(new static($function), 'loadClass');
  37057. }
  37058. spl_autoload_register($function);
  37059. }
  37060. }
  37061. public static function disable()
  37062. {
  37063. if (!is_array($functions = spl_autoload_functions())) {
  37064. return;
  37065. }
  37066. foreach ($functions as $function) {
  37067. spl_autoload_unregister($function);
  37068. }
  37069. foreach ($functions as $function) {
  37070. if (is_array($function) && $function[0] instanceof self) {
  37071. $function = $function[0]->getClassLoader();
  37072. }
  37073. spl_autoload_register($function);
  37074. }
  37075. }
  37076. public function findFile($class)
  37077. {
  37078. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  37079. if ($this->wasFinder) {
  37080. return $this->classLoader[0]->findFile($class);
  37081. }
  37082. }
  37083. public function loadClass($class)
  37084. {
  37085. ErrorHandler::stackErrors();
  37086. try {
  37087. if ($this->isFinder && !isset($this->loaded[$class])) {
  37088. $this->loaded[$class] = true;
  37089. if ($file = $this->classLoader[0]->findFile($class)) {
  37090. require $file;
  37091. }
  37092. } else {
  37093. call_user_func($this->classLoader, $class);
  37094. $file = false;
  37095. }
  37096. } catch (\Exception $e) {
  37097. ErrorHandler::unstackErrors();
  37098. throw $e;
  37099. } catch (\Throwable $e) {
  37100. ErrorHandler::unstackErrors();
  37101. throw $e;
  37102. }
  37103. ErrorHandler::unstackErrors();
  37104. $exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  37105. if ($class && '\\' === $class[0]) {
  37106. $class = substr($class, 1);
  37107. }
  37108. if ($exists) {
  37109. $refl = new \ReflectionClass($class);
  37110. $name = $refl->getName();
  37111. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  37112. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  37113. }
  37114. if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  37115. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  37116. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  37117. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  37118. } else {
  37119. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  37120. $len = 0;
  37121. $ns = '';
  37122. } else {
  37123. $ns = substr($name, 0, $len);
  37124. }
  37125. $parent = get_parent_class($class);
  37126. if (!$parent || strncmp($ns, $parent, $len)) {
  37127. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  37128. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  37129. }
  37130. $parentInterfaces = array();
  37131. $deprecatedInterfaces = array();
  37132. if ($parent) {
  37133. foreach (class_implements($parent) as $interface) {
  37134. $parentInterfaces[$interface] = 1;
  37135. }
  37136. }
  37137. foreach ($refl->getInterfaceNames() as $interface) {
  37138. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  37139. $deprecatedInterfaces[] = $interface;
  37140. }
  37141. foreach (class_implements($interface) as $interface) {
  37142. $parentInterfaces[$interface] = 1;
  37143. }
  37144. }
  37145. foreach ($deprecatedInterfaces as $interface) {
  37146. if (!isset($parentInterfaces[$interface])) {
  37147. @trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
  37148. }
  37149. }
  37150. }
  37151. }
  37152. }
  37153. if ($file) {
  37154. if (!$exists) {
  37155. if (false !== strpos($class, '/')) {
  37156. throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
  37157. }
  37158. throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
  37159. }
  37160. if (self::$caseCheck) {
  37161. $real = explode('\\', $class.strrchr($file, '.'));
  37162. $tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file));
  37163. $i = count($tail) - 1;
  37164. $j = count($real) - 1;
  37165. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  37166. --$i;
  37167. --$j;
  37168. }
  37169. array_splice($tail, 0, $i + 1);
  37170. }
  37171. if (self::$caseCheck && $tail) {
  37172. $tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail);
  37173. $tailLen = strlen($tail);
  37174. $real = $refl->getFileName();
  37175. if (2 === self::$caseCheck) {
  37176. $i = 1 + strrpos($real, '/');
  37177. $file = substr($real, $i);
  37178. $real = substr($real, 0, $i);
  37179. if (isset(self::$darwinCache[$real])) {
  37180. $kDir = $real;
  37181. } else {
  37182. $kDir = strtolower($real);
  37183. if (isset(self::$darwinCache[$kDir])) {
  37184. $real = self::$darwinCache[$kDir][0];
  37185. } else {
  37186. $dir = getcwd();
  37187. chdir($real);
  37188. $real = getcwd().'/';
  37189. chdir($dir);
  37190. $dir = $real;
  37191. $k = $kDir;
  37192. $i = strlen($dir) - 1;
  37193. while (!isset(self::$darwinCache[$k])) {
  37194. self::$darwinCache[$k] = array($dir, array());
  37195. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  37196. while ('/' !== $dir[--$i]) {
  37197. }
  37198. $k = substr($k, 0, ++$i);
  37199. $dir = substr($dir, 0, $i--);
  37200. }
  37201. }
  37202. }
  37203. $dirFiles = self::$darwinCache[$kDir][1];
  37204. if (isset($dirFiles[$file])) {
  37205. $kFile = $file;
  37206. } else {
  37207. $kFile = strtolower($file);
  37208. if (!isset($dirFiles[$kFile])) {
  37209. foreach (scandir($real, 2) as $f) {
  37210. if ('.' !== $f[0]) {
  37211. $dirFiles[$f] = $f;
  37212. if ($f === $file) {
  37213. $kFile = $k = $file;
  37214. } elseif ($f !== $k = strtolower($f)) {
  37215. $dirFiles[$k] = $f;
  37216. }
  37217. }
  37218. }
  37219. self::$darwinCache[$kDir][1] = $dirFiles;
  37220. }
  37221. }
  37222. $real .= $dirFiles[$kFile];
  37223. }
  37224. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  37225. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  37226. ) {
  37227. throw new \RuntimeException(sprintf('Case mismatch between class and real file names: %s vs %s in %s', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)));
  37228. }
  37229. }
  37230. return true;
  37231. }
  37232. }
  37233. }
  37234. <?php
  37235. namespace Symfony\Component\Debug;
  37236. use Psr\Log\LogLevel;
  37237. use Psr\Log\LoggerInterface;
  37238. use Symfony\Component\Debug\Exception\ContextErrorException;
  37239. use Symfony\Component\Debug\Exception\FatalErrorException;
  37240. use Symfony\Component\Debug\Exception\FatalThrowableError;
  37241. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  37242. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  37243. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  37244. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  37245. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  37246. class ErrorHandler
  37247. {
  37248. const TYPE_DEPRECATION = -100;
  37249. private $levels = array(
  37250. E_DEPRECATED => 'Deprecated',
  37251. E_USER_DEPRECATED => 'User Deprecated',
  37252. E_NOTICE => 'Notice',
  37253. E_USER_NOTICE => 'User Notice',
  37254. E_STRICT => 'Runtime Notice',
  37255. E_WARNING => 'Warning',
  37256. E_USER_WARNING => 'User Warning',
  37257. E_COMPILE_WARNING => 'Compile Warning',
  37258. E_CORE_WARNING => 'Core Warning',
  37259. E_USER_ERROR => 'User Error',
  37260. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  37261. E_COMPILE_ERROR => 'Compile Error',
  37262. E_PARSE => 'Parse Error',
  37263. E_ERROR => 'Error',
  37264. E_CORE_ERROR => 'Core Error',
  37265. );
  37266. private $loggers = array(
  37267. E_DEPRECATED => array(null, LogLevel::INFO),
  37268. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  37269. E_NOTICE => array(null, LogLevel::WARNING),
  37270. E_USER_NOTICE => array(null, LogLevel::WARNING),
  37271. E_STRICT => array(null, LogLevel::WARNING),
  37272. E_WARNING => array(null, LogLevel::WARNING),
  37273. E_USER_WARNING => array(null, LogLevel::WARNING),
  37274. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  37275. E_CORE_WARNING => array(null, LogLevel::WARNING),
  37276. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  37277. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  37278. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  37279. E_PARSE => array(null, LogLevel::CRITICAL),
  37280. E_ERROR => array(null, LogLevel::CRITICAL),
  37281. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  37282. );
  37283. private $thrownErrors = 0x1FFF;
  37284. private $scopedErrors = 0x1FFF;
  37285. private $tracedErrors = 0x77FB;
  37286. private $screamedErrors = 0x55;
  37287. private $loggedErrors = 0;
  37288. private $loggedTraces = array();
  37289. private $isRecursive = 0;
  37290. private $isRoot = false;
  37291. private $exceptionHandler;
  37292. private $bootstrappingLogger;
  37293. private static $reservedMemory;
  37294. private static $stackedErrors = array();
  37295. private static $stackedErrorLevels = array();
  37296. private static $toStringException = null;
  37297. private static $exitCode = 0;
  37298. private $displayErrors = 0x1FFF;
  37299. public static function register($handler = null, $replace = true)
  37300. {
  37301. if (null === self::$reservedMemory) {
  37302. self::$reservedMemory = str_repeat('x', 10240);
  37303. register_shutdown_function(__CLASS__.'::handleFatalError');
  37304. }
  37305. $levels = -1;
  37306. if ($handlerIsNew = !$handler instanceof self) {
  37307. if (null !== $handler) {
  37308. $levels = $replace ? $handler : 0;
  37309. $replace = true;
  37310. }
  37311. $handler = new static();
  37312. }
  37313. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  37314. restore_error_handler();
  37315. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  37316. $handler->isRoot = true;
  37317. }
  37318. if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) {
  37319. $handler = $prev[0];
  37320. $replace = false;
  37321. }
  37322. if ($replace || !$prev) {
  37323. $handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException')));
  37324. } else {
  37325. restore_error_handler();
  37326. }
  37327. $handler->throwAt($levels & $handler->thrownErrors, true);
  37328. return $handler;
  37329. }
  37330. public function __construct(BufferingLogger $bootstrappingLogger = null)
  37331. {
  37332. if ($bootstrappingLogger) {
  37333. $this->bootstrappingLogger = $bootstrappingLogger;
  37334. $this->setDefaultLogger($bootstrappingLogger);
  37335. }
  37336. }
  37337. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  37338. {
  37339. $loggers = array();
  37340. if (is_array($levels)) {
  37341. foreach ($levels as $type => $logLevel) {
  37342. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  37343. $loggers[$type] = array($logger, $logLevel);
  37344. }
  37345. }
  37346. } else {
  37347. if (null === $levels) {
  37348. $levels = E_ALL | E_STRICT;
  37349. }
  37350. foreach ($this->loggers as $type => $log) {
  37351. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  37352. $log[0] = $logger;
  37353. $loggers[$type] = $log;
  37354. }
  37355. }
  37356. }
  37357. $this->setLoggers($loggers);
  37358. }
  37359. public function setLoggers(array $loggers)
  37360. {
  37361. $prevLogged = $this->loggedErrors;
  37362. $prev = $this->loggers;
  37363. $flush = array();
  37364. foreach ($loggers as $type => $log) {
  37365. if (!isset($prev[$type])) {
  37366. throw new \InvalidArgumentException('Unknown error type: '.$type);
  37367. }
  37368. if (!is_array($log)) {
  37369. $log = array($log);
  37370. } elseif (!array_key_exists(0, $log)) {
  37371. throw new \InvalidArgumentException('No logger provided');
  37372. }
  37373. if (null === $log[0]) {
  37374. $this->loggedErrors &= ~$type;
  37375. } elseif ($log[0] instanceof LoggerInterface) {
  37376. $this->loggedErrors |= $type;
  37377. } else {
  37378. throw new \InvalidArgumentException('Invalid logger provided');
  37379. }
  37380. $this->loggers[$type] = $log + $prev[$type];
  37381. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  37382. $flush[$type] = $type;
  37383. }
  37384. }
  37385. $this->reRegister($prevLogged | $this->thrownErrors);
  37386. if ($flush) {
  37387. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  37388. $type = $log[2]['type'];
  37389. if (!isset($flush[$type])) {
  37390. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  37391. } elseif ($this->loggers[$type][0]) {
  37392. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  37393. }
  37394. }
  37395. }
  37396. return $prev;
  37397. }
  37398. public function setExceptionHandler($handler)
  37399. {
  37400. if (null !== $handler && !is_callable($handler)) {
  37401. throw new \LogicException('The exception handler must be a valid PHP callable.');
  37402. }
  37403. $prev = $this->exceptionHandler;
  37404. $this->exceptionHandler = $handler;
  37405. return $prev;
  37406. }
  37407. public function throwAt($levels, $replace = false)
  37408. {
  37409. $prev = $this->thrownErrors;
  37410. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  37411. if (!$replace) {
  37412. $this->thrownErrors |= $prev;
  37413. }
  37414. $this->reRegister($prev | $this->loggedErrors);
  37415. $this->displayErrors = $this->thrownErrors;
  37416. return $prev;
  37417. }
  37418. public function scopeAt($levels, $replace = false)
  37419. {
  37420. $prev = $this->scopedErrors;
  37421. $this->scopedErrors = (int) $levels;
  37422. if (!$replace) {
  37423. $this->scopedErrors |= $prev;
  37424. }
  37425. return $prev;
  37426. }
  37427. public function traceAt($levels, $replace = false)
  37428. {
  37429. $prev = $this->tracedErrors;
  37430. $this->tracedErrors = (int) $levels;
  37431. if (!$replace) {
  37432. $this->tracedErrors |= $prev;
  37433. }
  37434. return $prev;
  37435. }
  37436. public function screamAt($levels, $replace = false)
  37437. {
  37438. $prev = $this->screamedErrors;
  37439. $this->screamedErrors = (int) $levels;
  37440. if (!$replace) {
  37441. $this->screamedErrors |= $prev;
  37442. }
  37443. return $prev;
  37444. }
  37445. private function reRegister($prev)
  37446. {
  37447. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  37448. $handler = set_error_handler('var_dump');
  37449. $handler = is_array($handler) ? $handler[0] : null;
  37450. restore_error_handler();
  37451. if ($handler === $this) {
  37452. restore_error_handler();
  37453. if ($this->isRoot) {
  37454. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  37455. } else {
  37456. set_error_handler(array($this, 'handleError'));
  37457. }
  37458. }
  37459. }
  37460. }
  37461. public function handleError($type, $message, $file, $line)
  37462. {
  37463. $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  37464. $log = $this->loggedErrors & $type;
  37465. $throw = $this->thrownErrors & $type & $level;
  37466. $type &= $level | $this->screamedErrors;
  37467. if (!$type || (!$log && !$throw)) {
  37468. return $type && $log;
  37469. }
  37470. $scope = $this->scopedErrors & $type;
  37471. if (4 < $numArgs = func_num_args()) {
  37472. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  37473. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  37474. } else {
  37475. $context = array();
  37476. $backtrace = null;
  37477. }
  37478. if (isset($context['GLOBALS']) && $scope) {
  37479. $e = $context;
  37480. unset($e['GLOBALS'], $context);
  37481. $context = $e;
  37482. }
  37483. if (null !== $backtrace && $type & E_ERROR) {
  37484. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  37485. return true;
  37486. }
  37487. if ($throw) {
  37488. if (null !== self::$toStringException) {
  37489. $throw = self::$toStringException;
  37490. self::$toStringException = null;
  37491. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  37492. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  37493. } else {
  37494. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  37495. }
  37496. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  37497. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  37498. }
  37499. if (E_USER_ERROR & $type) {
  37500. $backtrace = $backtrace ?: $throw->getTrace();
  37501. for ($i = 1; isset($backtrace[$i]); ++$i) {
  37502. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  37503. && '__toString' === $backtrace[$i]['function']
  37504. && '->' === $backtrace[$i]['type']
  37505. && !isset($backtrace[$i - 1]['class'])
  37506. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  37507. ) {
  37508. foreach ($context as $e) {
  37509. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  37510. if (1 === $i) {
  37511. $throw = $e;
  37512. break;
  37513. }
  37514. self::$toStringException = $e;
  37515. return true;
  37516. }
  37517. }
  37518. if (1 < $i) {
  37519. $this->handleException($throw);
  37520. return false;
  37521. }
  37522. }
  37523. }
  37524. }
  37525. throw $throw;
  37526. }
  37527. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  37528. $trace = true;
  37529. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  37530. $trace = false;
  37531. } else {
  37532. $this->loggedTraces[$e] = 1;
  37533. }
  37534. $e = compact('type', 'file', 'line', 'level');
  37535. if ($type & $level) {
  37536. if ($scope) {
  37537. $e['scope_vars'] = $context;
  37538. if ($trace) {
  37539. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  37540. }
  37541. } elseif ($trace) {
  37542. if (null === $backtrace) {
  37543. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  37544. } else {
  37545. foreach ($backtrace as &$frame) {
  37546. unset($frame['args'], $frame);
  37547. }
  37548. $e['stack'] = $backtrace;
  37549. }
  37550. }
  37551. }
  37552. if ($this->isRecursive) {
  37553. $log = 0;
  37554. } elseif (self::$stackedErrorLevels) {
  37555. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  37556. } else {
  37557. try {
  37558. $this->isRecursive = true;
  37559. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  37560. $this->isRecursive = false;
  37561. } catch (\Exception $e) {
  37562. $this->isRecursive = false;
  37563. throw $e;
  37564. } catch (\Throwable $e) {
  37565. $this->isRecursive = false;
  37566. throw $e;
  37567. }
  37568. }
  37569. return $type && $log;
  37570. }
  37571. public function handleException($exception, array $error = null)
  37572. {
  37573. if (null === $error) {
  37574. self::$exitCode = 255;
  37575. }
  37576. if (!$exception instanceof \Exception) {
  37577. $exception = new FatalThrowableError($exception);
  37578. }
  37579. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  37580. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  37581. $e = array(
  37582. 'type' => $type,
  37583. 'file' => $exception->getFile(),
  37584. 'line' => $exception->getLine(),
  37585. 'level' => error_reporting(),
  37586. 'stack' => $exception->getTrace(),
  37587. );
  37588. if ($exception instanceof FatalErrorException) {
  37589. if ($exception instanceof FatalThrowableError) {
  37590. $error = array(
  37591. 'type' => $type,
  37592. 'message' => $message = $exception->getMessage(),
  37593. 'file' => $e['file'],
  37594. 'line' => $e['line'],
  37595. );
  37596. } else {
  37597. $message = 'Fatal '.$exception->getMessage();
  37598. }
  37599. } elseif ($exception instanceof \ErrorException) {
  37600. $message = 'Uncaught '.$exception->getMessage();
  37601. if ($exception instanceof ContextErrorException) {
  37602. $e['context'] = $exception->getContext();
  37603. }
  37604. } else {
  37605. $message = 'Uncaught Exception: '.$exception->getMessage();
  37606. }
  37607. }
  37608. if ($this->loggedErrors & $type) {
  37609. try {
  37610. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  37611. } catch (\Exception $handlerException) {
  37612. } catch (\Throwable $handlerException) {
  37613. }
  37614. }
  37615. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  37616. foreach ($this->getFatalErrorHandlers() as $handler) {
  37617. if ($e = $handler->handleError($error, $exception)) {
  37618. $exception = $e;
  37619. break;
  37620. }
  37621. }
  37622. }
  37623. if (empty($this->exceptionHandler)) {
  37624. throw $exception;
  37625. }
  37626. try {
  37627. call_user_func($this->exceptionHandler, $exception);
  37628. } catch (\Exception $handlerException) {
  37629. } catch (\Throwable $handlerException) {
  37630. }
  37631. if (isset($handlerException)) {
  37632. $this->exceptionHandler = null;
  37633. $this->handleException($handlerException);
  37634. }
  37635. }
  37636. public static function handleFatalError(array $error = null)
  37637. {
  37638. if (null === self::$reservedMemory) {
  37639. return;
  37640. }
  37641. self::$reservedMemory = null;
  37642. $handler = set_error_handler('var_dump');
  37643. $handler = is_array($handler) ? $handler[0] : null;
  37644. restore_error_handler();
  37645. if (!$handler instanceof self) {
  37646. return;
  37647. }
  37648. if ($exit = null === $error) {
  37649. $error = error_get_last();
  37650. }
  37651. try {
  37652. while (self::$stackedErrorLevels) {
  37653. static::unstackErrors();
  37654. }
  37655. } catch (\Exception $exception) {
  37656. } catch (\Throwable $exception) {
  37657. }
  37658. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  37659. $handler->throwAt(0, true);
  37660. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  37661. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  37662. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  37663. } else {
  37664. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  37665. }
  37666. }
  37667. try {
  37668. if (isset($exception)) {
  37669. self::$exitCode = 255;
  37670. $handler->handleException($exception, $error);
  37671. }
  37672. } catch (FatalErrorException $e) {
  37673. }
  37674. if ($exit && self::$exitCode) {
  37675. $exitCode = self::$exitCode;
  37676. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  37677. }
  37678. }
  37679. public static function stackErrors()
  37680. {
  37681. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  37682. }
  37683. public static function unstackErrors()
  37684. {
  37685. $level = array_pop(self::$stackedErrorLevels);
  37686. if (null !== $level) {
  37687. $e = error_reporting($level);
  37688. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  37689. error_reporting($e);
  37690. }
  37691. }
  37692. if (empty(self::$stackedErrorLevels)) {
  37693. $errors = self::$stackedErrors;
  37694. self::$stackedErrors = array();
  37695. foreach ($errors as $e) {
  37696. $e[0]->log($e[1], $e[2], $e[3]);
  37697. }
  37698. }
  37699. }
  37700. protected function getFatalErrorHandlers()
  37701. {
  37702. return array(
  37703. new UndefinedFunctionFatalErrorHandler(),
  37704. new UndefinedMethodFatalErrorHandler(),
  37705. new ClassNotFoundFatalErrorHandler(),
  37706. );
  37707. }
  37708. public function setLevel($level)
  37709. {
  37710. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  37711. $level = null === $level ? error_reporting() : $level;
  37712. $this->throwAt($level, true);
  37713. }
  37714. public function setDisplayErrors($displayErrors)
  37715. {
  37716. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  37717. if ($displayErrors) {
  37718. $this->throwAt($this->displayErrors, true);
  37719. } else {
  37720. $displayErrors = $this->displayErrors;
  37721. $this->throwAt(0, true);
  37722. $this->displayErrors = $displayErrors;
  37723. }
  37724. }
  37725. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  37726. {
  37727. @trigger_error('The '.__METHOD__.' static method is deprecated since version 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
  37728. $handler = set_error_handler('var_dump');
  37729. $handler = is_array($handler) ? $handler[0] : null;
  37730. restore_error_handler();
  37731. if (!$handler instanceof self) {
  37732. return;
  37733. }
  37734. if ('deprecation' === $channel) {
  37735. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  37736. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  37737. } elseif ('scream' === $channel) {
  37738. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  37739. $handler->screamAt(E_ALL | E_STRICT);
  37740. } elseif ('emergency' === $channel) {
  37741. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  37742. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  37743. }
  37744. }
  37745. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  37746. {
  37747. $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());
  37748. return $this->handleError($level, $message, $file, $line, (array) $context);
  37749. }
  37750. public function handleFatal()
  37751. {
  37752. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
  37753. static::handleFatalError();
  37754. }
  37755. }
  37756. class ErrorHandlerCanary
  37757. {
  37758. private static $displayErrors = null;
  37759. public function __construct()
  37760. {
  37761. if (null === self::$displayErrors) {
  37762. self::$displayErrors = ini_set('display_errors', 1);
  37763. }
  37764. }
  37765. public function __destruct()
  37766. {
  37767. if (null !== self::$displayErrors) {
  37768. ini_set('display_errors', self::$displayErrors);
  37769. self::$displayErrors = null;
  37770. }
  37771. }
  37772. }
  37773. <?php
  37774. namespace Symfony\Component\Debug\Exception;
  37775. class ClassNotFoundException extends FatalErrorException
  37776. {
  37777. public function __construct($message, \ErrorException $previous)
  37778. {
  37779. parent::__construct(
  37780. $message,
  37781. $previous->getCode(),
  37782. $previous->getSeverity(),
  37783. $previous->getFile(),
  37784. $previous->getLine(),
  37785. $previous->getPrevious()
  37786. );
  37787. $this->setTrace($previous->getTrace());
  37788. }
  37789. }
  37790. <?php
  37791. namespace Symfony\Component\Debug\Exception;
  37792. class ContextErrorException extends \ErrorException
  37793. {
  37794. private $context = array();
  37795. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  37796. {
  37797. parent::__construct($message, $code, $severity, $filename, $lineno);
  37798. $this->context = $context;
  37799. }
  37800. public function getContext()
  37801. {
  37802. return $this->context;
  37803. }
  37804. }
  37805. <?php
  37806. namespace Symfony\Component\Debug\Exception;
  37807. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  37808. class DummyException extends \ErrorException
  37809. {
  37810. }
  37811. <?php
  37812. namespace Symfony\Component\HttpKernel\Exception;
  37813. class FatalErrorException extends \ErrorException
  37814. {
  37815. }
  37816. namespace Symfony\Component\Debug\Exception;
  37817. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  37818. class FatalErrorException extends LegacyFatalErrorException
  37819. {
  37820. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null)
  37821. {
  37822. parent::__construct($message, $code, $severity, $filename, $lineno);
  37823. if (null !== $trace) {
  37824. if (!$traceArgs) {
  37825. foreach ($trace as &$frame) {
  37826. unset($frame['args'], $frame['this'], $frame);
  37827. }
  37828. }
  37829. $this->setTrace($trace);
  37830. } elseif (null !== $traceOffset) {
  37831. if (function_exists('xdebug_get_function_stack')) {
  37832. $trace = xdebug_get_function_stack();
  37833. if (0 < $traceOffset) {
  37834. array_splice($trace, -$traceOffset);
  37835. }
  37836. foreach ($trace as &$frame) {
  37837. if (!isset($frame['type'])) {
  37838. if (isset($frame['class'])) {
  37839. $frame['type'] = '::';
  37840. }
  37841. } elseif ('dynamic' === $frame['type']) {
  37842. $frame['type'] = '->';
  37843. } elseif ('static' === $frame['type']) {
  37844. $frame['type'] = '::';
  37845. }
  37846. if (!$traceArgs) {
  37847. unset($frame['params'], $frame['args']);
  37848. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  37849. $frame['args'] = $frame['params'];
  37850. unset($frame['params']);
  37851. }
  37852. }
  37853. unset($frame);
  37854. $trace = array_reverse($trace);
  37855. } elseif (function_exists('symfony_debug_backtrace')) {
  37856. $trace = symfony_debug_backtrace();
  37857. if (0 < $traceOffset) {
  37858. array_splice($trace, 0, $traceOffset);
  37859. }
  37860. } else {
  37861. $trace = array();
  37862. }
  37863. $this->setTrace($trace);
  37864. }
  37865. }
  37866. protected function setTrace($trace)
  37867. {
  37868. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  37869. $traceReflector->setAccessible(true);
  37870. $traceReflector->setValue($this, $trace);
  37871. }
  37872. }
  37873. <?php
  37874. namespace Symfony\Component\Debug\Exception;
  37875. class FatalThrowableError extends FatalErrorException
  37876. {
  37877. public function __construct(\Throwable $e)
  37878. {
  37879. if ($e instanceof \ParseError) {
  37880. $message = 'Parse error: '.$e->getMessage();
  37881. $severity = E_PARSE;
  37882. } elseif ($e instanceof \TypeError) {
  37883. $message = 'Type error: '.$e->getMessage();
  37884. $severity = E_RECOVERABLE_ERROR;
  37885. } else {
  37886. $message = $e->getMessage();
  37887. $severity = E_ERROR;
  37888. }
  37889. \ErrorException::__construct(
  37890. $message,
  37891. $e->getCode(),
  37892. $severity,
  37893. $e->getFile(),
  37894. $e->getLine()
  37895. );
  37896. $this->setTrace($e->getTrace());
  37897. }
  37898. }
  37899. <?php
  37900. namespace Symfony\Component\HttpKernel\Exception;
  37901. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  37902. class FlattenException
  37903. {
  37904. private $handler;
  37905. public static function __callStatic($method, $args)
  37906. {
  37907. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  37908. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method));
  37909. }
  37910. return call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  37911. }
  37912. public function __call($method, $args)
  37913. {
  37914. if (!isset($this->handler)) {
  37915. $this->handler = new DebugFlattenException();
  37916. }
  37917. if (!method_exists($this->handler, $method)) {
  37918. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method));
  37919. }
  37920. return call_user_func_array(array($this->handler, $method), $args);
  37921. }
  37922. }
  37923. namespace Symfony\Component\Debug\Exception;
  37924. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  37925. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  37926. class FlattenException extends LegacyFlattenException
  37927. {
  37928. private $message;
  37929. private $code;
  37930. private $previous;
  37931. private $trace;
  37932. private $class;
  37933. private $statusCode;
  37934. private $headers;
  37935. private $file;
  37936. private $line;
  37937. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  37938. {
  37939. $e = new static();
  37940. $e->setMessage($exception->getMessage());
  37941. $e->setCode($exception->getCode());
  37942. if ($exception instanceof HttpExceptionInterface) {
  37943. $statusCode = $exception->getStatusCode();
  37944. $headers = array_merge($headers, $exception->getHeaders());
  37945. }
  37946. if (null === $statusCode) {
  37947. $statusCode = 500;
  37948. }
  37949. $e->setStatusCode($statusCode);
  37950. $e->setHeaders($headers);
  37951. $e->setTraceFromException($exception);
  37952. $e->setClass(get_class($exception));
  37953. $e->setFile($exception->getFile());
  37954. $e->setLine($exception->getLine());
  37955. $previous = $exception->getPrevious();
  37956. if ($previous instanceof \Exception) {
  37957. $e->setPrevious(static::create($previous));
  37958. } elseif ($previous instanceof \Throwable) {
  37959. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  37960. }
  37961. return $e;
  37962. }
  37963. public function toArray()
  37964. {
  37965. $exceptions = array();
  37966. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  37967. $exceptions[] = array(
  37968. 'message' => $exception->getMessage(),
  37969. 'class' => $exception->getClass(),
  37970. 'trace' => $exception->getTrace(),
  37971. );
  37972. }
  37973. return $exceptions;
  37974. }
  37975. public function getStatusCode()
  37976. {
  37977. return $this->statusCode;
  37978. }
  37979. public function setStatusCode($code)
  37980. {
  37981. $this->statusCode = $code;
  37982. }
  37983. public function getHeaders()
  37984. {
  37985. return $this->headers;
  37986. }
  37987. public function setHeaders(array $headers)
  37988. {
  37989. $this->headers = $headers;
  37990. }
  37991. public function getClass()
  37992. {
  37993. return $this->class;
  37994. }
  37995. public function setClass($class)
  37996. {
  37997. $this->class = $class;
  37998. }
  37999. public function getFile()
  38000. {
  38001. return $this->file;
  38002. }
  38003. public function setFile($file)
  38004. {
  38005. $this->file = $file;
  38006. }
  38007. public function getLine()
  38008. {
  38009. return $this->line;
  38010. }
  38011. public function setLine($line)
  38012. {
  38013. $this->line = $line;
  38014. }
  38015. public function getMessage()
  38016. {
  38017. return $this->message;
  38018. }
  38019. public function setMessage($message)
  38020. {
  38021. $this->message = $message;
  38022. }
  38023. public function getCode()
  38024. {
  38025. return $this->code;
  38026. }
  38027. public function setCode($code)
  38028. {
  38029. $this->code = $code;
  38030. }
  38031. public function getPrevious()
  38032. {
  38033. return $this->previous;
  38034. }
  38035. public function setPrevious(FlattenException $previous)
  38036. {
  38037. $this->previous = $previous;
  38038. }
  38039. public function getAllPrevious()
  38040. {
  38041. $exceptions = array();
  38042. $e = $this;
  38043. while ($e = $e->getPrevious()) {
  38044. $exceptions[] = $e;
  38045. }
  38046. return $exceptions;
  38047. }
  38048. public function getTrace()
  38049. {
  38050. return $this->trace;
  38051. }
  38052. public function setTraceFromException(\Exception $exception)
  38053. {
  38054. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  38055. }
  38056. public function setTrace($trace, $file, $line)
  38057. {
  38058. $this->trace = array();
  38059. $this->trace[] = array(
  38060. 'namespace' => '',
  38061. 'short_class' => '',
  38062. 'class' => '',
  38063. 'type' => '',
  38064. 'function' => '',
  38065. 'file' => $file,
  38066. 'line' => $line,
  38067. 'args' => array(),
  38068. );
  38069. foreach ($trace as $entry) {
  38070. $class = '';
  38071. $namespace = '';
  38072. if (isset($entry['class'])) {
  38073. $parts = explode('\\', $entry['class']);
  38074. $class = array_pop($parts);
  38075. $namespace = implode('\\', $parts);
  38076. }
  38077. $this->trace[] = array(
  38078. 'namespace' => $namespace,
  38079. 'short_class' => $class,
  38080. 'class' => isset($entry['class']) ? $entry['class'] : '',
  38081. 'type' => isset($entry['type']) ? $entry['type'] : '',
  38082. 'function' => isset($entry['function']) ? $entry['function'] : null,
  38083. 'file' => isset($entry['file']) ? $entry['file'] : null,
  38084. 'line' => isset($entry['line']) ? $entry['line'] : null,
  38085. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  38086. );
  38087. }
  38088. }
  38089. private function flattenArgs($args, $level = 0, &$count = 0)
  38090. {
  38091. $result = array();
  38092. foreach ($args as $key => $value) {
  38093. if (++$count > 1e4) {
  38094. return array('array', '*SKIPPED over 10000 entries*');
  38095. }
  38096. if ($value instanceof \__PHP_Incomplete_Class) {
  38097. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  38098. } elseif (is_object($value)) {
  38099. $result[$key] = array('object', get_class($value));
  38100. } elseif (is_array($value)) {
  38101. if ($level > 10) {
  38102. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  38103. } else {
  38104. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  38105. }
  38106. } elseif (null === $value) {
  38107. $result[$key] = array('null', null);
  38108. } elseif (is_bool($value)) {
  38109. $result[$key] = array('boolean', $value);
  38110. } elseif (is_resource($value)) {
  38111. $result[$key] = array('resource', get_resource_type($value));
  38112. } else {
  38113. $result[$key] = array('string', (string) $value);
  38114. }
  38115. }
  38116. return $result;
  38117. }
  38118. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  38119. {
  38120. $array = new \ArrayObject($value);
  38121. return $array['__PHP_Incomplete_Class_Name'];
  38122. }
  38123. }
  38124. <?php
  38125. namespace Symfony\Component\Debug\Exception;
  38126. class OutOfMemoryException extends FatalErrorException
  38127. {
  38128. }
  38129. <?php
  38130. namespace Symfony\Component\Debug\Exception;
  38131. class UndefinedFunctionException extends FatalErrorException
  38132. {
  38133. public function __construct($message, \ErrorException $previous)
  38134. {
  38135. parent::__construct(
  38136. $message,
  38137. $previous->getCode(),
  38138. $previous->getSeverity(),
  38139. $previous->getFile(),
  38140. $previous->getLine(),
  38141. $previous->getPrevious()
  38142. );
  38143. $this->setTrace($previous->getTrace());
  38144. }
  38145. }
  38146. <?php
  38147. namespace Symfony\Component\Debug\Exception;
  38148. class UndefinedMethodException extends FatalErrorException
  38149. {
  38150. public function __construct($message, \ErrorException $previous)
  38151. {
  38152. parent::__construct(
  38153. $message,
  38154. $previous->getCode(),
  38155. $previous->getSeverity(),
  38156. $previous->getFile(),
  38157. $previous->getLine(),
  38158. $previous->getPrevious()
  38159. );
  38160. $this->setTrace($previous->getTrace());
  38161. }
  38162. }
  38163. <?php
  38164. namespace Symfony\Component\Debug;
  38165. use Symfony\Component\HttpFoundation\Response;
  38166. use Symfony\Component\Debug\Exception\FlattenException;
  38167. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  38168. class ExceptionHandler
  38169. {
  38170. private $debug;
  38171. private $charset;
  38172. private $handler;
  38173. private $caughtBuffer;
  38174. private $caughtLength;
  38175. private $fileLinkFormat;
  38176. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  38177. {
  38178. if (false !== strpos($charset, '%')) {
  38179. @trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since version 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);
  38180. $pivot = $fileLinkFormat;
  38181. $fileLinkFormat = $charset;
  38182. $charset = $pivot;
  38183. }
  38184. $this->debug = $debug;
  38185. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  38186. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  38187. }
  38188. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  38189. {
  38190. $handler = new static($debug, $charset, $fileLinkFormat);
  38191. $prev = set_exception_handler(array($handler, 'handle'));
  38192. if (is_array($prev) && $prev[0] instanceof ErrorHandler) {
  38193. restore_exception_handler();
  38194. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  38195. }
  38196. return $handler;
  38197. }
  38198. public function setHandler($handler)
  38199. {
  38200. if (null !== $handler && !is_callable($handler)) {
  38201. throw new \LogicException('The exception handler must be a valid PHP callable.');
  38202. }
  38203. $old = $this->handler;
  38204. $this->handler = $handler;
  38205. return $old;
  38206. }
  38207. public function setFileLinkFormat($format)
  38208. {
  38209. $old = $this->fileLinkFormat;
  38210. $this->fileLinkFormat = $format;
  38211. return $old;
  38212. }
  38213. public function handle(\Exception $exception)
  38214. {
  38215. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  38216. $this->failSafeHandle($exception);
  38217. return;
  38218. }
  38219. $caughtLength = $this->caughtLength = 0;
  38220. ob_start(array($this, 'catchOutput'));
  38221. $this->failSafeHandle($exception);
  38222. while (null === $this->caughtBuffer && ob_end_flush()) {
  38223. }
  38224. if (isset($this->caughtBuffer[0])) {
  38225. ob_start(array($this, 'cleanOutput'));
  38226. echo $this->caughtBuffer;
  38227. $caughtLength = ob_get_length();
  38228. }
  38229. $this->caughtBuffer = null;
  38230. try {
  38231. call_user_func($this->handler, $exception);
  38232. $this->caughtLength = $caughtLength;
  38233. } catch (\Exception $e) {
  38234. if (!$caughtLength) {
  38235. throw $exception;
  38236. }
  38237. }
  38238. }
  38239. private function failSafeHandle(\Exception $exception)
  38240. {
  38241. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  38242. && __CLASS__ !== get_class($this)
  38243. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  38244. && __CLASS__ !== $reflector->class
  38245. ) {
  38246. $response = $this->createResponse($exception);
  38247. $response->sendHeaders();
  38248. $response->sendContent();
  38249. @trigger_error(sprintf("The %s::createResponse method is deprecated since 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
  38250. return;
  38251. }
  38252. $this->sendPhpResponse($exception);
  38253. }
  38254. public function sendPhpResponse($exception)
  38255. {
  38256. if (!$exception instanceof FlattenException) {
  38257. $exception = FlattenException::create($exception);
  38258. }
  38259. if (!headers_sent()) {
  38260. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  38261. foreach ($exception->getHeaders() as $name => $value) {
  38262. header($name.': '.$value, false);
  38263. }
  38264. header('Content-Type: text/html; charset='.$this->charset);
  38265. }
  38266. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  38267. }
  38268. public function createResponse($exception)
  38269. {
  38270. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  38271. if (!$exception instanceof FlattenException) {
  38272. $exception = FlattenException::create($exception);
  38273. }
  38274. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  38275. }
  38276. public function getHtml($exception)
  38277. {
  38278. if (!$exception instanceof FlattenException) {
  38279. $exception = FlattenException::create($exception);
  38280. }
  38281. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  38282. }
  38283. public function getContent(FlattenException $exception)
  38284. {
  38285. switch ($exception->getStatusCode()) {
  38286. case 404:
  38287. $title = 'Sorry, the page you are looking for could not be found.';
  38288. break;
  38289. default:
  38290. $title = 'Whoops, looks like something went wrong.';
  38291. }
  38292. $content = '';
  38293. if ($this->debug) {
  38294. try {
  38295. $count = count($exception->getAllPrevious());
  38296. $total = $count + 1;
  38297. foreach ($exception->toArray() as $position => $e) {
  38298. $ind = $count - $position + 1;
  38299. $class = $this->formatClass($e['class']);
  38300. $message = nl2br($this->escapeHtml($e['message']));
  38301. $content .= sprintf(<<<'EOF'
  38302. <h2 class="block_exception clear_fix">
  38303. <span class="exception_counter">%d/%d</span>
  38304. <span class="exception_title">%s%s:</span>
  38305. <span class="exception_message">%s</span>
  38306. </h2>
  38307. <div class="block">
  38308. <ol class="traces list_exception">
  38309. EOF
  38310. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  38311. foreach ($e['trace'] as $trace) {
  38312. $content .= ' <li>';
  38313. if ($trace['function']) {
  38314. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  38315. }
  38316. if (isset($trace['file']) && isset($trace['line'])) {
  38317. $content .= $this->formatPath($trace['file'], $trace['line']);
  38318. }
  38319. $content .= "</li>\n";
  38320. }
  38321. $content .= " </ol>\n</div>\n";
  38322. }
  38323. } catch (\Exception $e) {
  38324. if ($this->debug) {
  38325. $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage()));
  38326. } else {
  38327. $title = 'Whoops, looks like something went wrong.';
  38328. }
  38329. }
  38330. }
  38331. return <<<EOF
  38332. <div id="sf-resetcontent" class="sf-reset">
  38333. <h1>$title</h1>
  38334. $content
  38335. </div>
  38336. EOF;
  38337. }
  38338. public function getStylesheet(FlattenException $exception)
  38339. {
  38340. return <<<'EOF'
  38341. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  38342. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  38343. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  38344. .sf-reset .clear_fix { display:inline-block; }
  38345. .sf-reset * html .clear_fix { height:1%; }
  38346. .sf-reset .clear_fix { display:block; }
  38347. .sf-reset, .sf-reset .block { margin: auto }
  38348. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  38349. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  38350. .sf-reset strong { font-weight:bold; }
  38351. .sf-reset a { color:#6c6159; cursor: default; }
  38352. .sf-reset a img { border:none; }
  38353. .sf-reset a:hover { text-decoration:underline; }
  38354. .sf-reset em { font-style:italic; }
  38355. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  38356. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  38357. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  38358. .sf-reset .exception_message { margin-left: 3em; display: block; }
  38359. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  38360. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  38361. -webkit-border-bottom-right-radius: 16px;
  38362. -webkit-border-bottom-left-radius: 16px;
  38363. -moz-border-radius-bottomright: 16px;
  38364. -moz-border-radius-bottomleft: 16px;
  38365. border-bottom-right-radius: 16px;
  38366. border-bottom-left-radius: 16px;
  38367. border-bottom:1px solid #ccc;
  38368. border-right:1px solid #ccc;
  38369. border-left:1px solid #ccc;
  38370. word-wrap: break-word;
  38371. }
  38372. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  38373. -webkit-border-top-left-radius: 16px;
  38374. -webkit-border-top-right-radius: 16px;
  38375. -moz-border-radius-topleft: 16px;
  38376. -moz-border-radius-topright: 16px;
  38377. border-top-left-radius: 16px;
  38378. border-top-right-radius: 16px;
  38379. border-top:1px solid #ccc;
  38380. border-right:1px solid #ccc;
  38381. border-left:1px solid #ccc;
  38382. overflow: hidden;
  38383. word-wrap: break-word;
  38384. }
  38385. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  38386. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  38387. .sf-reset ol { padding: 10px 0; }
  38388. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  38389. -webkit-border-radius: 10px;
  38390. -moz-border-radius: 10px;
  38391. border-radius: 10px;
  38392. border: 1px solid #ccc;
  38393. }
  38394. EOF;
  38395. }
  38396. private function decorate($content, $css)
  38397. {
  38398. return <<<EOF
  38399. <!DOCTYPE html>
  38400. <html>
  38401. <head>
  38402. <meta charset="{$this->charset}" />
  38403. <meta name="robots" content="noindex,nofollow" />
  38404. <style>
  38405. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  38406. html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
  38407. html { background: #eee; padding: 10px }
  38408. img { border: 0; }
  38409. #sf-resetcontent { width:970px; margin:0 auto; }
  38410. $css
  38411. </style>
  38412. </head>
  38413. <body>
  38414. $content
  38415. </body>
  38416. </html>
  38417. EOF;
  38418. }
  38419. private function formatClass($class)
  38420. {
  38421. $parts = explode('\\', $class);
  38422. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  38423. }
  38424. private function formatPath($path, $line)
  38425. {
  38426. $path = $this->escapeHtml($path);
  38427. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  38428. if ($linkFormat = $this->fileLinkFormat) {
  38429. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  38430. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  38431. }
  38432. return sprintf(' in <a title="%s line %3$d" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>', $path, $file, $line);
  38433. }
  38434. private function formatArgs(array $args)
  38435. {
  38436. $result = array();
  38437. foreach ($args as $key => $item) {
  38438. if ('object' === $item[0]) {
  38439. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  38440. } elseif ('array' === $item[0]) {
  38441. $formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  38442. } elseif ('string' === $item[0]) {
  38443. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  38444. } elseif ('null' === $item[0]) {
  38445. $formattedValue = '<em>null</em>';
  38446. } elseif ('boolean' === $item[0]) {
  38447. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  38448. } elseif ('resource' === $item[0]) {
  38449. $formattedValue = '<em>resource</em>';
  38450. } else {
  38451. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  38452. }
  38453. $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  38454. }
  38455. return implode(', ', $result);
  38456. }
  38457. protected static function utf8Htmlize($str)
  38458. {
  38459. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  38460. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  38461. }
  38462. private function escapeHtml($str)
  38463. {
  38464. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  38465. }
  38466. public function catchOutput($buffer)
  38467. {
  38468. $this->caughtBuffer = $buffer;
  38469. return '';
  38470. }
  38471. public function cleanOutput($buffer)
  38472. {
  38473. if ($this->caughtLength) {
  38474. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  38475. if (isset($cleanBuffer[0])) {
  38476. $buffer = $cleanBuffer;
  38477. }
  38478. }
  38479. return $buffer;
  38480. }
  38481. }
  38482. <?php
  38483. namespace Symfony\Component\Debug\FatalErrorHandler;
  38484. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  38485. use Symfony\Component\Debug\Exception\FatalErrorException;
  38486. use Symfony\Component\Debug\DebugClassLoader;
  38487. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  38488. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  38489. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  38490. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  38491. {
  38492. public function handleError(array $error, FatalErrorException $exception)
  38493. {
  38494. $messageLen = strlen($error['message']);
  38495. $notFoundSuffix = '\' not found';
  38496. $notFoundSuffixLen = strlen($notFoundSuffix);
  38497. if ($notFoundSuffixLen > $messageLen) {
  38498. return;
  38499. }
  38500. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  38501. return;
  38502. }
  38503. foreach (array('class', 'interface', 'trait') as $typeName) {
  38504. $prefix = ucfirst($typeName).' \'';
  38505. $prefixLen = strlen($prefix);
  38506. if (0 !== strpos($error['message'], $prefix)) {
  38507. continue;
  38508. }
  38509. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  38510. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  38511. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  38512. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  38513. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  38514. $tail = ' for another namespace?';
  38515. } else {
  38516. $className = $fullyQualifiedClassName;
  38517. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  38518. $tail = '?';
  38519. }
  38520. if ($candidates = $this->getClassCandidates($className)) {
  38521. $tail = array_pop($candidates).'"?';
  38522. if ($candidates) {
  38523. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  38524. } else {
  38525. $tail = ' for "'.$tail;
  38526. }
  38527. }
  38528. $message .= "\nDid you forget a \"use\" statement".$tail;
  38529. return new ClassNotFoundException($message, $exception);
  38530. }
  38531. }
  38532. private function getClassCandidates($class)
  38533. {
  38534. if (!is_array($functions = spl_autoload_functions())) {
  38535. return array();
  38536. }
  38537. $classes = array();
  38538. foreach ($functions as $function) {
  38539. if (!is_array($function)) {
  38540. continue;
  38541. }
  38542. if ($function[0] instanceof DebugClassLoader) {
  38543. $function = $function[0]->getClassLoader();
  38544. if (is_object($function)) {
  38545. $function = array($function);
  38546. }
  38547. if (!is_array($function)) {
  38548. continue;
  38549. }
  38550. }
  38551. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  38552. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  38553. foreach ($paths as $path) {
  38554. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  38555. }
  38556. }
  38557. }
  38558. if ($function[0] instanceof ComposerClassLoader) {
  38559. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  38560. foreach ($paths as $path) {
  38561. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  38562. }
  38563. }
  38564. }
  38565. }
  38566. return array_unique($classes);
  38567. }
  38568. private function findClassInPath($path, $class, $prefix)
  38569. {
  38570. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  38571. return array();
  38572. }
  38573. $classes = array();
  38574. $filename = $class.'.php';
  38575. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  38576. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  38577. $classes[] = $class;
  38578. }
  38579. }
  38580. return $classes;
  38581. }
  38582. private function convertFileToClass($path, $file, $prefix)
  38583. {
  38584. $candidates = array(
  38585. $namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  38586. $prefix.$namespacedClass,
  38587. $prefix.'\\'.$namespacedClass,
  38588. str_replace('\\', '_', $namespacedClass),
  38589. str_replace('\\', '_', $prefix.$namespacedClass),
  38590. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  38591. );
  38592. if ($prefix) {
  38593. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  38594. }
  38595. foreach ($candidates as $candidate) {
  38596. if ($this->classExists($candidate)) {
  38597. return $candidate;
  38598. }
  38599. }
  38600. require_once $file;
  38601. foreach ($candidates as $candidate) {
  38602. if ($this->classExists($candidate)) {
  38603. return $candidate;
  38604. }
  38605. }
  38606. }
  38607. private function classExists($class)
  38608. {
  38609. return class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
  38610. }
  38611. }
  38612. <?php
  38613. namespace Symfony\Component\Debug\FatalErrorHandler;
  38614. use Symfony\Component\Debug\Exception\FatalErrorException;
  38615. interface FatalErrorHandlerInterface
  38616. {
  38617. public function handleError(array $error, FatalErrorException $exception);
  38618. }
  38619. <?php
  38620. namespace Symfony\Component\Debug\FatalErrorHandler;
  38621. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  38622. use Symfony\Component\Debug\Exception\FatalErrorException;
  38623. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  38624. {
  38625. public function handleError(array $error, FatalErrorException $exception)
  38626. {
  38627. $messageLen = strlen($error['message']);
  38628. $notFoundSuffix = '()';
  38629. $notFoundSuffixLen = strlen($notFoundSuffix);
  38630. if ($notFoundSuffixLen > $messageLen) {
  38631. return;
  38632. }
  38633. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  38634. return;
  38635. }
  38636. $prefix = 'Call to undefined function ';
  38637. $prefixLen = strlen($prefix);
  38638. if (0 !== strpos($error['message'], $prefix)) {
  38639. return;
  38640. }
  38641. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  38642. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  38643. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  38644. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  38645. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  38646. } else {
  38647. $functionName = $fullyQualifiedFunctionName;
  38648. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  38649. }
  38650. $candidates = array();
  38651. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  38652. foreach ($definedFunctionNames as $definedFunctionName) {
  38653. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  38654. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  38655. } else {
  38656. $definedFunctionNameBasename = $definedFunctionName;
  38657. }
  38658. if ($definedFunctionNameBasename === $functionName) {
  38659. $candidates[] = '\\'.$definedFunctionName;
  38660. }
  38661. }
  38662. }
  38663. if ($candidates) {
  38664. sort($candidates);
  38665. $last = array_pop($candidates).'"?';
  38666. if ($candidates) {
  38667. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  38668. } else {
  38669. $candidates = '"'.$last;
  38670. }
  38671. $message .= "\nDid you mean to call ".$candidates;
  38672. }
  38673. return new UndefinedFunctionException($message, $exception);
  38674. }
  38675. }
  38676. <?php
  38677. namespace Symfony\Component\Debug\FatalErrorHandler;
  38678. use Symfony\Component\Debug\Exception\FatalErrorException;
  38679. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  38680. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  38681. {
  38682. public function handleError(array $error, FatalErrorException $exception)
  38683. {
  38684. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  38685. if (!$matches) {
  38686. return;
  38687. }
  38688. $className = $matches[1];
  38689. $methodName = $matches[2];
  38690. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  38691. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  38692. return new UndefinedMethodException($message, $exception);
  38693. }
  38694. $candidates = array();
  38695. foreach ($methods as $definedMethodName) {
  38696. $lev = levenshtein($methodName, $definedMethodName);
  38697. if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  38698. $candidates[] = $definedMethodName;
  38699. }
  38700. }
  38701. if ($candidates) {
  38702. sort($candidates);
  38703. $last = array_pop($candidates).'"?';
  38704. if ($candidates) {
  38705. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  38706. } else {
  38707. $candidates = '"'.$last;
  38708. }
  38709. $message .= "\nDid you mean to call ".$candidates;
  38710. }
  38711. return new UndefinedMethodException($message, $exception);
  38712. }
  38713. }
  38714. Copyright (c) 2004-2017 Fabien Potencier
  38715. Permission is hereby granted, free of charge, to any person obtaining a copy
  38716. of this software and associated documentation files (the "Software"), to deal
  38717. in the Software without restriction, including without limitation the rights
  38718. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  38719. copies of the Software, and to permit persons to whom the Software is furnished
  38720. to do so, subject to the following conditions:
  38721. The above copyright notice and this permission notice shall be included in all
  38722. copies or substantial portions of the Software.
  38723. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  38724. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  38725. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  38726. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38727. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  38728. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  38729. THE SOFTWARE.
  38730. <?php
  38731. namespace Symfony\Component\Filesystem\Exception;
  38732. interface ExceptionInterface
  38733. {
  38734. }
  38735. <?php
  38736. namespace Symfony\Component\Filesystem\Exception;
  38737. class FileNotFoundException extends IOException
  38738. {
  38739. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  38740. {
  38741. if (null === $message) {
  38742. if (null === $path) {
  38743. $message = 'File could not be found.';
  38744. } else {
  38745. $message = sprintf('File "%s" could not be found.', $path);
  38746. }
  38747. }
  38748. parent::__construct($message, $code, $previous, $path);
  38749. }
  38750. }
  38751. <?php
  38752. namespace Symfony\Component\Filesystem\Exception;
  38753. class IOException extends \RuntimeException implements IOExceptionInterface
  38754. {
  38755. private $path;
  38756. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  38757. {
  38758. $this->path = $path;
  38759. parent::__construct($message, $code, $previous);
  38760. }
  38761. public function getPath()
  38762. {
  38763. return $this->path;
  38764. }
  38765. }
  38766. <?php
  38767. namespace Symfony\Component\Filesystem\Exception;
  38768. interface IOExceptionInterface extends ExceptionInterface
  38769. {
  38770. public function getPath();
  38771. }
  38772. <?php
  38773. namespace Symfony\Component\Filesystem;
  38774. use Symfony\Component\Filesystem\Exception\IOException;
  38775. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  38776. class Filesystem
  38777. {
  38778. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  38779. {
  38780. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  38781. if ($originIsLocal && !is_file($originFile)) {
  38782. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  38783. }
  38784. $this->mkdir(dirname($targetFile));
  38785. $doCopy = true;
  38786. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  38787. $doCopy = filemtime($originFile) > filemtime($targetFile);
  38788. }
  38789. if ($doCopy) {
  38790. if (false === $source = @fopen($originFile, 'r')) {
  38791. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  38792. }
  38793. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  38794. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  38795. }
  38796. $bytesCopied = stream_copy_to_stream($source, $target);
  38797. fclose($source);
  38798. fclose($target);
  38799. unset($source, $target);
  38800. if (!is_file($targetFile)) {
  38801. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  38802. }
  38803. if ($originIsLocal) {
  38804. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  38805. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  38806. throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
  38807. }
  38808. }
  38809. }
  38810. }
  38811. public function mkdir($dirs, $mode = 0777)
  38812. {
  38813. foreach ($this->toIterator($dirs) as $dir) {
  38814. if (is_dir($dir)) {
  38815. continue;
  38816. }
  38817. if (true !== @mkdir($dir, $mode, true)) {
  38818. $error = error_get_last();
  38819. if (!is_dir($dir)) {
  38820. if ($error) {
  38821. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, $error['message']), 0, null, $dir);
  38822. }
  38823. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  38824. }
  38825. }
  38826. }
  38827. }
  38828. public function exists($files)
  38829. {
  38830. $maxPathLength = PHP_MAXPATHLEN - 2;
  38831. foreach ($this->toIterator($files) as $file) {
  38832. if (strlen($file) > $maxPathLength) {
  38833. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  38834. }
  38835. if (!file_exists($file)) {
  38836. return false;
  38837. }
  38838. }
  38839. return true;
  38840. }
  38841. public function touch($files, $time = null, $atime = null)
  38842. {
  38843. foreach ($this->toIterator($files) as $file) {
  38844. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  38845. if (true !== $touch) {
  38846. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  38847. }
  38848. }
  38849. }
  38850. public function remove($files)
  38851. {
  38852. if ($files instanceof \Traversable) {
  38853. $files = iterator_to_array($files, false);
  38854. } elseif (!is_array($files)) {
  38855. $files = array($files);
  38856. }
  38857. $files = array_reverse($files);
  38858. foreach ($files as $file) {
  38859. if (is_link($file)) {
  38860. if (!@(unlink($file) || '\\' !== DIRECTORY_SEPARATOR || rmdir($file)) && file_exists($file)) {
  38861. $error = error_get_last();
  38862. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, $error['message']));
  38863. }
  38864. } elseif (is_dir($file)) {
  38865. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  38866. if (!@rmdir($file) && file_exists($file)) {
  38867. $error = error_get_last();
  38868. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, $error['message']));
  38869. }
  38870. } elseif (!@unlink($file) && file_exists($file)) {
  38871. $error = error_get_last();
  38872. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, $error['message']));
  38873. }
  38874. }
  38875. }
  38876. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  38877. {
  38878. foreach ($this->toIterator($files) as $file) {
  38879. if (true !== @chmod($file, $mode & ~$umask)) {
  38880. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  38881. }
  38882. if ($recursive && is_dir($file) && !is_link($file)) {
  38883. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  38884. }
  38885. }
  38886. }
  38887. public function chown($files, $user, $recursive = false)
  38888. {
  38889. foreach ($this->toIterator($files) as $file) {
  38890. if ($recursive && is_dir($file) && !is_link($file)) {
  38891. $this->chown(new \FilesystemIterator($file), $user, true);
  38892. }
  38893. if (is_link($file) && function_exists('lchown')) {
  38894. if (true !== @lchown($file, $user)) {
  38895. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  38896. }
  38897. } else {
  38898. if (true !== @chown($file, $user)) {
  38899. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  38900. }
  38901. }
  38902. }
  38903. }
  38904. public function chgrp($files, $group, $recursive = false)
  38905. {
  38906. foreach ($this->toIterator($files) as $file) {
  38907. if ($recursive && is_dir($file) && !is_link($file)) {
  38908. $this->chgrp(new \FilesystemIterator($file), $group, true);
  38909. }
  38910. if (is_link($file) && function_exists('lchgrp')) {
  38911. if (true !== @lchgrp($file, $group) || (defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  38912. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  38913. }
  38914. } else {
  38915. if (true !== @chgrp($file, $group)) {
  38916. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  38917. }
  38918. }
  38919. }
  38920. }
  38921. public function rename($origin, $target, $overwrite = false)
  38922. {
  38923. if (!$overwrite && $this->isReadable($target)) {
  38924. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  38925. }
  38926. if (true !== @rename($origin, $target)) {
  38927. if (is_dir($origin)) {
  38928. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  38929. $this->remove($origin);
  38930. return;
  38931. }
  38932. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  38933. }
  38934. }
  38935. private function isReadable($filename)
  38936. {
  38937. $maxPathLength = PHP_MAXPATHLEN - 2;
  38938. if (strlen($filename) > $maxPathLength) {
  38939. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  38940. }
  38941. return is_readable($filename);
  38942. }
  38943. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  38944. {
  38945. if ('\\' === DIRECTORY_SEPARATOR) {
  38946. $originDir = strtr($originDir, '/', '\\');
  38947. $targetDir = strtr($targetDir, '/', '\\');
  38948. if ($copyOnWindows) {
  38949. $this->mirror($originDir, $targetDir);
  38950. return;
  38951. }
  38952. }
  38953. $this->mkdir(dirname($targetDir));
  38954. $ok = false;
  38955. if (is_link($targetDir)) {
  38956. if (readlink($targetDir) != $originDir) {
  38957. $this->remove($targetDir);
  38958. } else {
  38959. $ok = true;
  38960. }
  38961. }
  38962. if (!$ok && true !== @symlink($originDir, $targetDir)) {
  38963. $report = error_get_last();
  38964. if (is_array($report)) {
  38965. if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) {
  38966. throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir);
  38967. }
  38968. }
  38969. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  38970. }
  38971. }
  38972. public function makePathRelative($endPath, $startPath)
  38973. {
  38974. if ('\\' === DIRECTORY_SEPARATOR) {
  38975. $endPath = str_replace('\\', '/', $endPath);
  38976. $startPath = str_replace('\\', '/', $startPath);
  38977. }
  38978. $stripDriveLetter = function ($path) {
  38979. if (strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  38980. return substr($path, 2);
  38981. }
  38982. return $path;
  38983. };
  38984. $endPath = $stripDriveLetter($endPath);
  38985. $startPath = $stripDriveLetter($startPath);
  38986. $startPathArr = explode('/', trim($startPath, '/'));
  38987. $endPathArr = explode('/', trim($endPath, '/'));
  38988. $normalizePathArray = function ($pathSegments, $absolute) {
  38989. $result = array();
  38990. foreach ($pathSegments as $segment) {
  38991. if ('..' === $segment && ($absolute || count($result))) {
  38992. array_pop($result);
  38993. } elseif ('.' !== $segment) {
  38994. $result[] = $segment;
  38995. }
  38996. }
  38997. return $result;
  38998. };
  38999. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  39000. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  39001. $index = 0;
  39002. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  39003. ++$index;
  39004. }
  39005. if (1 === count($startPathArr) && '' === $startPathArr[0]) {
  39006. $depth = 0;
  39007. } else {
  39008. $depth = count($startPathArr) - $index;
  39009. }
  39010. $traverser = str_repeat('../', $depth);
  39011. $endPathRemainder = implode('/', array_slice($endPathArr, $index));
  39012. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  39013. return '' === $relativePath ? './' : $relativePath;
  39014. }
  39015. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  39016. {
  39017. $targetDir = rtrim($targetDir, '/\\');
  39018. $originDir = rtrim($originDir, '/\\');
  39019. $originDirLen = strlen($originDir);
  39020. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  39021. $deleteIterator = $iterator;
  39022. if (null === $deleteIterator) {
  39023. $flags = \FilesystemIterator::SKIP_DOTS;
  39024. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  39025. }
  39026. $targetDirLen = strlen($targetDir);
  39027. foreach ($deleteIterator as $file) {
  39028. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  39029. if (!$this->exists($origin)) {
  39030. $this->remove($file);
  39031. }
  39032. }
  39033. }
  39034. $copyOnWindows = false;
  39035. if (isset($options['copy_on_windows'])) {
  39036. $copyOnWindows = $options['copy_on_windows'];
  39037. }
  39038. if (null === $iterator) {
  39039. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  39040. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  39041. }
  39042. if ($this->exists($originDir)) {
  39043. $this->mkdir($targetDir);
  39044. }
  39045. foreach ($iterator as $file) {
  39046. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  39047. if ($copyOnWindows) {
  39048. if (is_file($file)) {
  39049. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  39050. } elseif (is_dir($file)) {
  39051. $this->mkdir($target);
  39052. } else {
  39053. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  39054. }
  39055. } else {
  39056. if (is_link($file)) {
  39057. $this->symlink($file->getLinkTarget(), $target);
  39058. } elseif (is_dir($file)) {
  39059. $this->mkdir($target);
  39060. } elseif (is_file($file)) {
  39061. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  39062. } else {
  39063. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  39064. }
  39065. }
  39066. }
  39067. }
  39068. public function isAbsolutePath($file)
  39069. {
  39070. return strspn($file, '/\\', 0, 1)
  39071. || (strlen($file) > 3 && ctype_alpha($file[0])
  39072. && ':' === substr($file, 1, 1)
  39073. && strspn($file, '/\\', 2, 1)
  39074. )
  39075. || null !== parse_url($file, PHP_URL_SCHEME)
  39076. ;
  39077. }
  39078. public function tempnam($dir, $prefix)
  39079. {
  39080. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  39081. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  39082. $tmpFile = @tempnam($hierarchy, $prefix);
  39083. if (false !== $tmpFile) {
  39084. if (null !== $scheme && 'gs' !== $scheme) {
  39085. return $scheme.'://'.$tmpFile;
  39086. }
  39087. return $tmpFile;
  39088. }
  39089. throw new IOException('A temporary file could not be created.');
  39090. }
  39091. for ($i = 0; $i < 10; ++$i) {
  39092. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  39093. $handle = @fopen($tmpFile, 'x+');
  39094. if (false === $handle) {
  39095. continue;
  39096. }
  39097. @fclose($handle);
  39098. return $tmpFile;
  39099. }
  39100. throw new IOException('A temporary file could not be created.');
  39101. }
  39102. public function dumpFile($filename, $content, $mode = 0666)
  39103. {
  39104. $dir = dirname($filename);
  39105. if (!is_dir($dir)) {
  39106. $this->mkdir($dir);
  39107. }
  39108. if (!is_writable($dir)) {
  39109. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  39110. }
  39111. $tmpFile = $this->tempnam($dir, basename($filename));
  39112. if (false === @file_put_contents($tmpFile, $content)) {
  39113. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  39114. }
  39115. if (null !== $mode) {
  39116. if (func_num_args() > 2) {
  39117. @trigger_error('Support for modifying file permissions is deprecated since version 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  39118. }
  39119. $this->chmod($tmpFile, $mode);
  39120. } elseif (file_exists($filename)) {
  39121. @chmod($tmpFile, fileperms($filename));
  39122. }
  39123. $this->rename($tmpFile, $filename, true);
  39124. }
  39125. private function toIterator($files)
  39126. {
  39127. if (!$files instanceof \Traversable) {
  39128. $files = new \ArrayObject(is_array($files) ? $files : array($files));
  39129. }
  39130. return $files;
  39131. }
  39132. private function getSchemeAndHierarchy($filename)
  39133. {
  39134. $components = explode('://', $filename, 2);
  39135. return 2 === count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  39136. }
  39137. }
  39138. Copyright (c) 2004-2017 Fabien Potencier
  39139. Permission is hereby granted, free of charge, to any person obtaining a copy
  39140. of this software and associated documentation files (the "Software"), to deal
  39141. in the Software without restriction, including without limitation the rights
  39142. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  39143. copies of the Software, and to permit persons to whom the Software is furnished
  39144. to do so, subject to the following conditions:
  39145. The above copyright notice and this permission notice shall be included in all
  39146. copies or substantial portions of the Software.
  39147. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39148. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39149. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  39150. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  39151. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  39152. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  39153. THE SOFTWARE.
  39154. <?php
  39155. namespace Symfony\Component\Filesystem;
  39156. use Symfony\Component\Filesystem\Exception\IOException;
  39157. class LockHandler
  39158. {
  39159. private $file;
  39160. private $handle;
  39161. public function __construct($name, $lockPath = null)
  39162. {
  39163. $lockPath = $lockPath ?: sys_get_temp_dir();
  39164. if (!is_dir($lockPath)) {
  39165. $fs = new Filesystem();
  39166. $fs->mkdir($lockPath);
  39167. }
  39168. if (!is_writable($lockPath)) {
  39169. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  39170. }
  39171. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  39172. }
  39173. public function lock($blocking = false)
  39174. {
  39175. if ($this->handle) {
  39176. return true;
  39177. }
  39178. $error = null;
  39179. set_error_handler(function ($errno, $msg) use (&$error) {
  39180. $error = $msg;
  39181. });
  39182. if (!$this->handle = fopen($this->file, 'r')) {
  39183. if ($this->handle = fopen($this->file, 'x')) {
  39184. chmod($this->file, 0444);
  39185. } elseif (!$this->handle = fopen($this->file, 'r')) {
  39186. usleep(100);
  39187. $this->handle = fopen($this->file, 'r');
  39188. }
  39189. }
  39190. restore_error_handler();
  39191. if (!$this->handle) {
  39192. throw new IOException($error, 0, null, $this->file);
  39193. }
  39194. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  39195. fclose($this->handle);
  39196. $this->handle = null;
  39197. return false;
  39198. }
  39199. return true;
  39200. }
  39201. public function release()
  39202. {
  39203. if ($this->handle) {
  39204. flock($this->handle, LOCK_UN | LOCK_NB);
  39205. fclose($this->handle);
  39206. $this->handle = null;
  39207. }
  39208. }
  39209. }
  39210. <?php
  39211. namespace Symfony\Component\Finder\Adapter;
  39212. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39213. abstract class AbstractAdapter implements AdapterInterface
  39214. {
  39215. protected $followLinks = false;
  39216. protected $mode = 0;
  39217. protected $minDepth = 0;
  39218. protected $maxDepth = PHP_INT_MAX;
  39219. protected $exclude = array();
  39220. protected $names = array();
  39221. protected $notNames = array();
  39222. protected $contains = array();
  39223. protected $notContains = array();
  39224. protected $sizes = array();
  39225. protected $dates = array();
  39226. protected $filters = array();
  39227. protected $sort = false;
  39228. protected $paths = array();
  39229. protected $notPaths = array();
  39230. protected $ignoreUnreadableDirs = false;
  39231. private static $areSupported = array();
  39232. public function isSupported()
  39233. {
  39234. $name = $this->getName();
  39235. if (!array_key_exists($name, self::$areSupported)) {
  39236. self::$areSupported[$name] = $this->canBeUsed();
  39237. }
  39238. return self::$areSupported[$name];
  39239. }
  39240. public function setFollowLinks($followLinks)
  39241. {
  39242. $this->followLinks = $followLinks;
  39243. return $this;
  39244. }
  39245. public function setMode($mode)
  39246. {
  39247. $this->mode = $mode;
  39248. return $this;
  39249. }
  39250. public function setDepths(array $depths)
  39251. {
  39252. $this->minDepth = 0;
  39253. $this->maxDepth = PHP_INT_MAX;
  39254. foreach ($depths as $comparator) {
  39255. switch ($comparator->getOperator()) {
  39256. case '>':
  39257. $this->minDepth = $comparator->getTarget() + 1;
  39258. break;
  39259. case '>=':
  39260. $this->minDepth = $comparator->getTarget();
  39261. break;
  39262. case '<':
  39263. $this->maxDepth = $comparator->getTarget() - 1;
  39264. break;
  39265. case '<=':
  39266. $this->maxDepth = $comparator->getTarget();
  39267. break;
  39268. default:
  39269. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  39270. }
  39271. }
  39272. return $this;
  39273. }
  39274. public function setExclude(array $exclude)
  39275. {
  39276. $this->exclude = $exclude;
  39277. return $this;
  39278. }
  39279. public function setNames(array $names)
  39280. {
  39281. $this->names = $names;
  39282. return $this;
  39283. }
  39284. public function setNotNames(array $notNames)
  39285. {
  39286. $this->notNames = $notNames;
  39287. return $this;
  39288. }
  39289. public function setContains(array $contains)
  39290. {
  39291. $this->contains = $contains;
  39292. return $this;
  39293. }
  39294. public function setNotContains(array $notContains)
  39295. {
  39296. $this->notContains = $notContains;
  39297. return $this;
  39298. }
  39299. public function setSizes(array $sizes)
  39300. {
  39301. $this->sizes = $sizes;
  39302. return $this;
  39303. }
  39304. public function setDates(array $dates)
  39305. {
  39306. $this->dates = $dates;
  39307. return $this;
  39308. }
  39309. public function setFilters(array $filters)
  39310. {
  39311. $this->filters = $filters;
  39312. return $this;
  39313. }
  39314. public function setSort($sort)
  39315. {
  39316. $this->sort = $sort;
  39317. return $this;
  39318. }
  39319. public function setPath(array $paths)
  39320. {
  39321. $this->paths = $paths;
  39322. return $this;
  39323. }
  39324. public function setNotPath(array $notPaths)
  39325. {
  39326. $this->notPaths = $notPaths;
  39327. return $this;
  39328. }
  39329. public function ignoreUnreadableDirs($ignore = true)
  39330. {
  39331. $this->ignoreUnreadableDirs = (bool) $ignore;
  39332. return $this;
  39333. }
  39334. abstract protected function canBeUsed();
  39335. }
  39336. <?php
  39337. namespace Symfony\Component\Finder\Adapter;
  39338. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39339. use Symfony\Component\Finder\Exception\AccessDeniedException;
  39340. use Symfony\Component\Finder\Iterator;
  39341. use Symfony\Component\Finder\Shell\Shell;
  39342. use Symfony\Component\Finder\Expression\Expression;
  39343. use Symfony\Component\Finder\Shell\Command;
  39344. use Symfony\Component\Finder\Comparator\NumberComparator;
  39345. use Symfony\Component\Finder\Comparator\DateComparator;
  39346. abstract class AbstractFindAdapter extends AbstractAdapter
  39347. {
  39348. protected $shell;
  39349. public function __construct()
  39350. {
  39351. $this->shell = new Shell();
  39352. }
  39353. public function searchInDirectory($dir)
  39354. {
  39355. $dir = realpath($dir);
  39356. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  39357. return new Iterator\FilePathsIterator(array(), $dir);
  39358. }
  39359. $command = Command::create();
  39360. $find = $this->buildFindCommand($command, $dir);
  39361. if ($this->followLinks) {
  39362. $find->add('-follow');
  39363. }
  39364. $find->add('-mindepth')->add($this->minDepth + 1);
  39365. if (PHP_INT_MAX !== $this->maxDepth) {
  39366. $find->add('-maxdepth')->add($this->maxDepth + 1);
  39367. }
  39368. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  39369. $find->add('-type d');
  39370. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  39371. $find->add('-type f');
  39372. }
  39373. $this->buildNamesFiltering($find, $this->names);
  39374. $this->buildNamesFiltering($find, $this->notNames, true);
  39375. $this->buildPathsFiltering($find, $dir, $this->paths);
  39376. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  39377. $this->buildSizesFiltering($find, $this->sizes);
  39378. $this->buildDatesFiltering($find, $this->dates);
  39379. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  39380. $useSort = is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  39381. if ($useGrep && ($this->contains || $this->notContains)) {
  39382. $grep = $command->ins('grep');
  39383. $this->buildContentFiltering($grep, $this->contains);
  39384. $this->buildContentFiltering($grep, $this->notContains, true);
  39385. }
  39386. if ($useSort) {
  39387. $this->buildSorting($command, $this->sort);
  39388. }
  39389. $command->setErrorHandler(
  39390. $this->ignoreUnreadableDirs
  39391. ? function ($stderr) { }
  39392. : function ($stderr) { throw new AccessDeniedException($stderr); }
  39393. );
  39394. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  39395. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  39396. if ($this->exclude) {
  39397. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  39398. }
  39399. if (!$useGrep && ($this->contains || $this->notContains)) {
  39400. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  39401. }
  39402. if ($this->filters) {
  39403. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  39404. }
  39405. if (!$useSort && $this->sort) {
  39406. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  39407. $iterator = $iteratorAggregate->getIterator();
  39408. }
  39409. return $iterator;
  39410. }
  39411. protected function canBeUsed()
  39412. {
  39413. return $this->shell->testCommand('find');
  39414. }
  39415. protected function buildFindCommand(Command $command, $dir)
  39416. {
  39417. return $command
  39418. ->ins('find')
  39419. ->add('find ')
  39420. ->arg($dir)
  39421. ->add('-noleaf');
  39422. }
  39423. private function buildNamesFiltering(Command $command, array $names, $not = false)
  39424. {
  39425. if (0 === count($names)) {
  39426. return;
  39427. }
  39428. $command->add($not ? '-not' : null)->cmd('(');
  39429. foreach ($names as $i => $name) {
  39430. $expr = Expression::create($name);
  39431. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  39432. $expr = Expression::create($expr->getGlob()->toRegex(false));
  39433. }
  39434. if ($expr->isRegex()) {
  39435. $regex = $expr->getRegex();
  39436. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  39437. ->setStartFlag(false)
  39438. ->setStartJoker(true)
  39439. ->replaceJokers('[^/]');
  39440. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  39441. $regex->setEndJoker(false)->append('[^/]*');
  39442. }
  39443. }
  39444. $command
  39445. ->add($i > 0 ? '-or' : null)
  39446. ->add($expr->isRegex()
  39447. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  39448. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  39449. )
  39450. ->arg($expr->renderPattern());
  39451. }
  39452. $command->cmd(')');
  39453. }
  39454. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  39455. {
  39456. if (0 === count($paths)) {
  39457. return;
  39458. }
  39459. $command->add($not ? '-not' : null)->cmd('(');
  39460. foreach ($paths as $i => $path) {
  39461. $expr = Expression::create($path);
  39462. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  39463. $expr = Expression::create($expr->getGlob()->toRegex(false));
  39464. }
  39465. if ($expr->isRegex()) {
  39466. $regex = $expr->getRegex();
  39467. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  39468. } else {
  39469. $expr->prepend('*')->append('*');
  39470. }
  39471. $command
  39472. ->add($i > 0 ? '-or' : null)
  39473. ->add($expr->isRegex()
  39474. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  39475. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  39476. )
  39477. ->arg($expr->renderPattern());
  39478. }
  39479. $command->cmd(')');
  39480. }
  39481. private function buildSizesFiltering(Command $command, array $sizes)
  39482. {
  39483. foreach ($sizes as $i => $size) {
  39484. $command->add($i > 0 ? '-and' : null);
  39485. switch ($size->getOperator()) {
  39486. case '<=':
  39487. $command->add('-size -'.($size->getTarget() + 1).'c');
  39488. break;
  39489. case '>=':
  39490. $command->add('-size +'.($size->getTarget() - 1).'c');
  39491. break;
  39492. case '>':
  39493. $command->add('-size +'.$size->getTarget().'c');
  39494. break;
  39495. case '!=':
  39496. $command->add('-size -'.$size->getTarget().'c');
  39497. $command->add('-size +'.$size->getTarget().'c');
  39498. break;
  39499. case '<':
  39500. default:
  39501. $command->add('-size -'.$size->getTarget().'c');
  39502. }
  39503. }
  39504. }
  39505. private function buildDatesFiltering(Command $command, array $dates)
  39506. {
  39507. foreach ($dates as $i => $date) {
  39508. $command->add($i > 0 ? '-and' : null);
  39509. $mins = (int) round((time() - $date->getTarget()) / 60);
  39510. if (0 > $mins) {
  39511. $command->add(' -mmin -0');
  39512. return;
  39513. }
  39514. switch ($date->getOperator()) {
  39515. case '<=':
  39516. $command->add('-mmin +'.($mins - 1));
  39517. break;
  39518. case '>=':
  39519. $command->add('-mmin -'.($mins + 1));
  39520. break;
  39521. case '>':
  39522. $command->add('-mmin -'.$mins);
  39523. break;
  39524. case '!=':
  39525. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  39526. break;
  39527. case '<':
  39528. default:
  39529. $command->add('-mmin +'.$mins);
  39530. }
  39531. }
  39532. }
  39533. private function buildSorting(Command $command, $sort)
  39534. {
  39535. $this->buildFormatSorting($command, $sort);
  39536. }
  39537. abstract protected function buildFormatSorting(Command $command, $sort);
  39538. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  39539. }
  39540. <?php
  39541. namespace Symfony\Component\Finder\Adapter;
  39542. interface AdapterInterface
  39543. {
  39544. public function setFollowLinks($followLinks);
  39545. public function setMode($mode);
  39546. public function setExclude(array $exclude);
  39547. public function setDepths(array $depths);
  39548. public function setNames(array $names);
  39549. public function setNotNames(array $notNames);
  39550. public function setContains(array $contains);
  39551. public function setNotContains(array $notContains);
  39552. public function setSizes(array $sizes);
  39553. public function setDates(array $dates);
  39554. public function setFilters(array $filters);
  39555. public function setSort($sort);
  39556. public function setPath(array $paths);
  39557. public function setNotPath(array $notPaths);
  39558. public function ignoreUnreadableDirs($ignore = true);
  39559. public function searchInDirectory($dir);
  39560. public function isSupported();
  39561. public function getName();
  39562. }
  39563. <?php
  39564. namespace Symfony\Component\Finder\Adapter;
  39565. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39566. use Symfony\Component\Finder\Shell\Shell;
  39567. use Symfony\Component\Finder\Shell\Command;
  39568. use Symfony\Component\Finder\Iterator\SortableIterator;
  39569. use Symfony\Component\Finder\Expression\Expression;
  39570. class BsdFindAdapter extends AbstractFindAdapter
  39571. {
  39572. public function getName()
  39573. {
  39574. return 'bsd_find';
  39575. }
  39576. protected function canBeUsed()
  39577. {
  39578. return in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  39579. }
  39580. protected function buildFormatSorting(Command $command, $sort)
  39581. {
  39582. switch ($sort) {
  39583. case SortableIterator::SORT_BY_NAME:
  39584. $command->ins('sort')->add('| sort');
  39585. return;
  39586. case SortableIterator::SORT_BY_TYPE:
  39587. $format = '%HT';
  39588. break;
  39589. case SortableIterator::SORT_BY_ACCESSED_TIME:
  39590. $format = '%a';
  39591. break;
  39592. case SortableIterator::SORT_BY_CHANGED_TIME:
  39593. $format = '%c';
  39594. break;
  39595. case SortableIterator::SORT_BY_MODIFIED_TIME:
  39596. $format = '%m';
  39597. break;
  39598. default:
  39599. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  39600. }
  39601. $command
  39602. ->add('-print0 | xargs -0 stat -f')
  39603. ->arg($format.'%t%N')
  39604. ->add('| sort | cut -f 2');
  39605. }
  39606. protected function buildFindCommand(Command $command, $dir)
  39607. {
  39608. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  39609. return $command;
  39610. }
  39611. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  39612. {
  39613. foreach ($contains as $contain) {
  39614. $expr = Expression::create($contain);
  39615. $command
  39616. ->add('| grep -v \'^$\'')
  39617. ->add('| xargs -I{} grep -I')
  39618. ->add($expr->isCaseSensitive() ? null : '-i')
  39619. ->add($not ? '-L' : '-l')
  39620. ->add('-Ee')->arg($expr->renderPattern())
  39621. ->add('{}')
  39622. ;
  39623. }
  39624. }
  39625. }
  39626. <?php
  39627. namespace Symfony\Component\Finder\Adapter;
  39628. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39629. use Symfony\Component\Finder\Shell\Shell;
  39630. use Symfony\Component\Finder\Shell\Command;
  39631. use Symfony\Component\Finder\Iterator\SortableIterator;
  39632. use Symfony\Component\Finder\Expression\Expression;
  39633. class GnuFindAdapter extends AbstractFindAdapter
  39634. {
  39635. public function getName()
  39636. {
  39637. return 'gnu_find';
  39638. }
  39639. protected function buildFormatSorting(Command $command, $sort)
  39640. {
  39641. switch ($sort) {
  39642. case SortableIterator::SORT_BY_NAME:
  39643. $command->ins('sort')->add('| sort');
  39644. return;
  39645. case SortableIterator::SORT_BY_TYPE:
  39646. $format = '%y';
  39647. break;
  39648. case SortableIterator::SORT_BY_ACCESSED_TIME:
  39649. $format = '%A@';
  39650. break;
  39651. case SortableIterator::SORT_BY_CHANGED_TIME:
  39652. $format = '%C@';
  39653. break;
  39654. case SortableIterator::SORT_BY_MODIFIED_TIME:
  39655. $format = '%T@';
  39656. break;
  39657. default:
  39658. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  39659. }
  39660. $command
  39661. ->get('find')
  39662. ->add('-printf')
  39663. ->arg($format.' %h/%f\\n')
  39664. ->add('| sort | cut')
  39665. ->arg('-d ')
  39666. ->arg('-f2-')
  39667. ;
  39668. }
  39669. protected function canBeUsed()
  39670. {
  39671. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  39672. }
  39673. protected function buildFindCommand(Command $command, $dir)
  39674. {
  39675. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  39676. }
  39677. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  39678. {
  39679. foreach ($contains as $contain) {
  39680. $expr = Expression::create($contain);
  39681. $command
  39682. ->add('| xargs -I{} -r grep -I')
  39683. ->add($expr->isCaseSensitive() ? null : '-i')
  39684. ->add($not ? '-L' : '-l')
  39685. ->add('-Ee')->arg($expr->renderPattern())
  39686. ->add('{}')
  39687. ;
  39688. }
  39689. }
  39690. }
  39691. <?php
  39692. namespace Symfony\Component\Finder\Adapter;
  39693. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since version 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  39694. use Symfony\Component\Finder\Iterator;
  39695. class PhpAdapter extends AbstractAdapter
  39696. {
  39697. public function searchInDirectory($dir)
  39698. {
  39699. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  39700. if ($this->followLinks) {
  39701. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  39702. }
  39703. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  39704. if ($this->exclude) {
  39705. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  39706. }
  39707. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  39708. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  39709. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  39710. }
  39711. if ($this->mode) {
  39712. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  39713. }
  39714. if ($this->names || $this->notNames) {
  39715. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  39716. }
  39717. if ($this->contains || $this->notContains) {
  39718. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  39719. }
  39720. if ($this->sizes) {
  39721. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  39722. }
  39723. if ($this->dates) {
  39724. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  39725. }
  39726. if ($this->filters) {
  39727. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  39728. }
  39729. if ($this->paths || $this->notPaths) {
  39730. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  39731. }
  39732. if ($this->sort) {
  39733. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  39734. $iterator = $iteratorAggregate->getIterator();
  39735. }
  39736. return $iterator;
  39737. }
  39738. public function getName()
  39739. {
  39740. return 'php';
  39741. }
  39742. protected function canBeUsed()
  39743. {
  39744. return true;
  39745. }
  39746. }
  39747. <?php
  39748. namespace Symfony\Component\Finder\Comparator;
  39749. class Comparator
  39750. {
  39751. private $target;
  39752. private $operator = '==';
  39753. public function getTarget()
  39754. {
  39755. return $this->target;
  39756. }
  39757. public function setTarget($target)
  39758. {
  39759. $this->target = $target;
  39760. }
  39761. public function getOperator()
  39762. {
  39763. return $this->operator;
  39764. }
  39765. public function setOperator($operator)
  39766. {
  39767. if (!$operator) {
  39768. $operator = '==';
  39769. }
  39770. if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  39771. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  39772. }
  39773. $this->operator = $operator;
  39774. }
  39775. public function test($test)
  39776. {
  39777. switch ($this->operator) {
  39778. case '>':
  39779. return $test > $this->target;
  39780. case '>=':
  39781. return $test >= $this->target;
  39782. case '<':
  39783. return $test < $this->target;
  39784. case '<=':
  39785. return $test <= $this->target;
  39786. case '!=':
  39787. return $test != $this->target;
  39788. }
  39789. return $test == $this->target;
  39790. }
  39791. }
  39792. <?php
  39793. namespace Symfony\Component\Finder\Comparator;
  39794. class DateComparator extends Comparator
  39795. {
  39796. public function __construct($test)
  39797. {
  39798. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  39799. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  39800. }
  39801. try {
  39802. $date = new \DateTime($matches[2]);
  39803. $target = $date->format('U');
  39804. } catch (\Exception $e) {
  39805. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  39806. }
  39807. $operator = isset($matches[1]) ? $matches[1] : '==';
  39808. if ('since' === $operator || 'after' === $operator) {
  39809. $operator = '>';
  39810. }
  39811. if ('until' === $operator || 'before' === $operator) {
  39812. $operator = '<';
  39813. }
  39814. $this->setOperator($operator);
  39815. $this->setTarget($target);
  39816. }
  39817. }
  39818. <?php
  39819. namespace Symfony\Component\Finder\Comparator;
  39820. class NumberComparator extends Comparator
  39821. {
  39822. public function __construct($test)
  39823. {
  39824. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  39825. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  39826. }
  39827. $target = $matches[2];
  39828. if (!is_numeric($target)) {
  39829. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  39830. }
  39831. if (isset($matches[3])) {
  39832. switch (strtolower($matches[3])) {
  39833. case 'k':
  39834. $target *= 1000;
  39835. break;
  39836. case 'ki':
  39837. $target *= 1024;
  39838. break;
  39839. case 'm':
  39840. $target *= 1000000;
  39841. break;
  39842. case 'mi':
  39843. $target *= 1024 * 1024;
  39844. break;
  39845. case 'g':
  39846. $target *= 1000000000;
  39847. break;
  39848. case 'gi':
  39849. $target *= 1024 * 1024 * 1024;
  39850. break;
  39851. }
  39852. }
  39853. $this->setTarget($target);
  39854. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  39855. }
  39856. }
  39857. <?php
  39858. namespace Symfony\Component\Finder\Exception;
  39859. class AccessDeniedException extends \UnexpectedValueException
  39860. {
  39861. }
  39862. <?php
  39863. namespace Symfony\Component\Finder\Exception;
  39864. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39865. use Symfony\Component\Finder\Adapter\AdapterInterface;
  39866. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  39867. {
  39868. private $adapter;
  39869. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  39870. {
  39871. $this->adapter = $adapter;
  39872. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  39873. }
  39874. public function getAdapter()
  39875. {
  39876. return $this->adapter;
  39877. }
  39878. }
  39879. <?php
  39880. namespace Symfony\Component\Finder\Exception;
  39881. interface ExceptionInterface
  39882. {
  39883. public function getAdapter();
  39884. }
  39885. <?php
  39886. namespace Symfony\Component\Finder\Exception;
  39887. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39888. class OperationNotPermitedException extends AdapterFailureException
  39889. {
  39890. }
  39891. <?php
  39892. namespace Symfony\Component\Finder\Exception;
  39893. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39894. use Symfony\Component\Finder\Adapter\AdapterInterface;
  39895. use Symfony\Component\Finder\Shell\Command;
  39896. class ShellCommandFailureException extends AdapterFailureException
  39897. {
  39898. private $command;
  39899. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  39900. {
  39901. $this->command = $command;
  39902. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  39903. }
  39904. public function getCommand()
  39905. {
  39906. return $this->command;
  39907. }
  39908. }
  39909. <?php
  39910. namespace Symfony\Component\Finder\Expression;
  39911. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39912. class Expression implements ValueInterface
  39913. {
  39914. const TYPE_REGEX = 1;
  39915. const TYPE_GLOB = 2;
  39916. private $value;
  39917. public static function create($expr)
  39918. {
  39919. return new self($expr);
  39920. }
  39921. public function __construct($expr)
  39922. {
  39923. try {
  39924. $this->value = Regex::create($expr);
  39925. } catch (\InvalidArgumentException $e) {
  39926. $this->value = new Glob($expr);
  39927. }
  39928. }
  39929. public function __toString()
  39930. {
  39931. return $this->render();
  39932. }
  39933. public function render()
  39934. {
  39935. return $this->value->render();
  39936. }
  39937. public function renderPattern()
  39938. {
  39939. return $this->value->renderPattern();
  39940. }
  39941. public function isCaseSensitive()
  39942. {
  39943. return $this->value->isCaseSensitive();
  39944. }
  39945. public function getType()
  39946. {
  39947. return $this->value->getType();
  39948. }
  39949. public function prepend($expr)
  39950. {
  39951. $this->value->prepend($expr);
  39952. return $this;
  39953. }
  39954. public function append($expr)
  39955. {
  39956. $this->value->append($expr);
  39957. return $this;
  39958. }
  39959. public function isRegex()
  39960. {
  39961. return self::TYPE_REGEX === $this->value->getType();
  39962. }
  39963. public function isGlob()
  39964. {
  39965. return self::TYPE_GLOB === $this->value->getType();
  39966. }
  39967. public function getGlob()
  39968. {
  39969. if (self::TYPE_GLOB !== $this->value->getType()) {
  39970. throw new \LogicException('Regex can\'t be transformed to glob.');
  39971. }
  39972. return $this->value;
  39973. }
  39974. public function getRegex()
  39975. {
  39976. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  39977. }
  39978. }
  39979. <?php
  39980. namespace Symfony\Component\Finder\Expression;
  39981. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39982. use Symfony\Component\Finder\Glob as FinderGlob;
  39983. class Glob implements ValueInterface
  39984. {
  39985. private $pattern;
  39986. public function __construct($pattern)
  39987. {
  39988. $this->pattern = $pattern;
  39989. }
  39990. public function render()
  39991. {
  39992. return $this->pattern;
  39993. }
  39994. public function renderPattern()
  39995. {
  39996. return $this->pattern;
  39997. }
  39998. public function getType()
  39999. {
  40000. return Expression::TYPE_GLOB;
  40001. }
  40002. public function isCaseSensitive()
  40003. {
  40004. return true;
  40005. }
  40006. public function prepend($expr)
  40007. {
  40008. $this->pattern = $expr.$this->pattern;
  40009. return $this;
  40010. }
  40011. public function append($expr)
  40012. {
  40013. $this->pattern .= $expr;
  40014. return $this;
  40015. }
  40016. public function isExpandable()
  40017. {
  40018. return false !== strpos($this->pattern, '{')
  40019. && false !== strpos($this->pattern, '}');
  40020. }
  40021. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  40022. {
  40023. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  40024. return new Regex($regex);
  40025. }
  40026. }
  40027. <?php
  40028. namespace Symfony\Component\Finder\Expression;
  40029. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40030. class Regex implements ValueInterface
  40031. {
  40032. const START_FLAG = '^';
  40033. const END_FLAG = '$';
  40034. const BOUNDARY = '~';
  40035. const JOKER = '.*';
  40036. const ESCAPING = '\\';
  40037. private $pattern;
  40038. private $options;
  40039. private $startFlag;
  40040. private $endFlag;
  40041. private $startJoker;
  40042. private $endJoker;
  40043. public static function create($expr)
  40044. {
  40045. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  40046. $start = substr($m[1], 0, 1);
  40047. $end = substr($m[1], -1);
  40048. if (
  40049. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  40050. || ('{' === $start && '}' === $end)
  40051. || ('(' === $start && ')' === $end)
  40052. ) {
  40053. return new self(substr($m[1], 1, -1), $m[2], $end);
  40054. }
  40055. }
  40056. throw new \InvalidArgumentException('Given expression is not a regex.');
  40057. }
  40058. public function __construct($pattern, $options = '', $delimiter = null)
  40059. {
  40060. if (null !== $delimiter) {
  40061. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  40062. }
  40063. $this->parsePattern($pattern);
  40064. $this->options = $options;
  40065. }
  40066. public function __toString()
  40067. {
  40068. return $this->render();
  40069. }
  40070. public function render()
  40071. {
  40072. return self::BOUNDARY
  40073. .$this->renderPattern()
  40074. .self::BOUNDARY
  40075. .$this->options;
  40076. }
  40077. public function renderPattern()
  40078. {
  40079. return ($this->startFlag ? self::START_FLAG : '')
  40080. .($this->startJoker ? self::JOKER : '')
  40081. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  40082. .($this->endJoker ? self::JOKER : '')
  40083. .($this->endFlag ? self::END_FLAG : '');
  40084. }
  40085. public function isCaseSensitive()
  40086. {
  40087. return !$this->hasOption('i');
  40088. }
  40089. public function getType()
  40090. {
  40091. return Expression::TYPE_REGEX;
  40092. }
  40093. public function prepend($expr)
  40094. {
  40095. $this->pattern = $expr.$this->pattern;
  40096. return $this;
  40097. }
  40098. public function append($expr)
  40099. {
  40100. $this->pattern .= $expr;
  40101. return $this;
  40102. }
  40103. public function hasOption($option)
  40104. {
  40105. return false !== strpos($this->options, $option);
  40106. }
  40107. public function addOption($option)
  40108. {
  40109. if (!$this->hasOption($option)) {
  40110. $this->options .= $option;
  40111. }
  40112. return $this;
  40113. }
  40114. public function removeOption($option)
  40115. {
  40116. $this->options = str_replace($option, '', $this->options);
  40117. return $this;
  40118. }
  40119. public function setStartFlag($startFlag)
  40120. {
  40121. $this->startFlag = $startFlag;
  40122. return $this;
  40123. }
  40124. public function hasStartFlag()
  40125. {
  40126. return $this->startFlag;
  40127. }
  40128. public function setEndFlag($endFlag)
  40129. {
  40130. $this->endFlag = (bool) $endFlag;
  40131. return $this;
  40132. }
  40133. public function hasEndFlag()
  40134. {
  40135. return $this->endFlag;
  40136. }
  40137. public function setStartJoker($startJoker)
  40138. {
  40139. $this->startJoker = $startJoker;
  40140. return $this;
  40141. }
  40142. public function hasStartJoker()
  40143. {
  40144. return $this->startJoker;
  40145. }
  40146. public function setEndJoker($endJoker)
  40147. {
  40148. $this->endJoker = (bool) $endJoker;
  40149. return $this;
  40150. }
  40151. public function hasEndJoker()
  40152. {
  40153. return $this->endJoker;
  40154. }
  40155. public function replaceJokers($replacement)
  40156. {
  40157. $replace = function ($subject) use ($replacement) {
  40158. $subject = $subject[0];
  40159. $replace = 0 === substr_count($subject, '\\') % 2;
  40160. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  40161. };
  40162. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  40163. return $this;
  40164. }
  40165. private function parsePattern($pattern)
  40166. {
  40167. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  40168. $pattern = substr($pattern, 1);
  40169. }
  40170. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  40171. $pattern = substr($pattern, 2);
  40172. }
  40173. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  40174. $pattern = substr($pattern, 0, -1);
  40175. }
  40176. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  40177. $pattern = substr($pattern, 0, -2);
  40178. }
  40179. $this->pattern = $pattern;
  40180. }
  40181. }
  40182. <?php
  40183. namespace Symfony\Component\Finder\Expression;
  40184. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40185. interface ValueInterface
  40186. {
  40187. public function render();
  40188. public function renderPattern();
  40189. public function isCaseSensitive();
  40190. public function getType();
  40191. public function prepend($expr);
  40192. public function append($expr);
  40193. }
  40194. <?php
  40195. namespace Symfony\Component\Finder;
  40196. use Symfony\Component\Finder\Adapter\AdapterInterface;
  40197. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  40198. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  40199. use Symfony\Component\Finder\Adapter\PhpAdapter;
  40200. use Symfony\Component\Finder\Comparator\DateComparator;
  40201. use Symfony\Component\Finder\Comparator\NumberComparator;
  40202. use Symfony\Component\Finder\Exception\ExceptionInterface;
  40203. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  40204. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  40205. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  40206. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  40207. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  40208. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  40209. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  40210. use Symfony\Component\Finder\Iterator\SortableIterator;
  40211. class Finder implements \IteratorAggregate, \Countable
  40212. {
  40213. const IGNORE_VCS_FILES = 1;
  40214. const IGNORE_DOT_FILES = 2;
  40215. private $mode = 0;
  40216. private $names = array();
  40217. private $notNames = array();
  40218. private $exclude = array();
  40219. private $filters = array();
  40220. private $depths = array();
  40221. private $sizes = array();
  40222. private $followLinks = false;
  40223. private $sort = false;
  40224. private $ignore = 0;
  40225. private $dirs = array();
  40226. private $dates = array();
  40227. private $iterators = array();
  40228. private $contains = array();
  40229. private $notContains = array();
  40230. private $adapters = null;
  40231. private $paths = array();
  40232. private $notPaths = array();
  40233. private $ignoreUnreadableDirs = false;
  40234. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  40235. public function __construct()
  40236. {
  40237. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  40238. }
  40239. public static function create()
  40240. {
  40241. return new static();
  40242. }
  40243. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  40244. {
  40245. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40246. $this->initDefaultAdapters();
  40247. $this->adapters[$adapter->getName()] = array(
  40248. 'adapter' => $adapter,
  40249. 'priority' => $priority,
  40250. 'selected' => false,
  40251. );
  40252. return $this->sortAdapters();
  40253. }
  40254. public function useBestAdapter()
  40255. {
  40256. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40257. $this->initDefaultAdapters();
  40258. $this->resetAdapterSelection();
  40259. return $this->sortAdapters();
  40260. }
  40261. public function setAdapter($name)
  40262. {
  40263. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40264. $this->initDefaultAdapters();
  40265. if (!isset($this->adapters[$name])) {
  40266. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  40267. }
  40268. $this->resetAdapterSelection();
  40269. $this->adapters[$name]['selected'] = true;
  40270. return $this->sortAdapters();
  40271. }
  40272. public function removeAdapters()
  40273. {
  40274. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40275. $this->adapters = array();
  40276. return $this;
  40277. }
  40278. public function getAdapters()
  40279. {
  40280. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40281. $this->initDefaultAdapters();
  40282. return array_values(array_map(function (array $adapter) {
  40283. return $adapter['adapter'];
  40284. }, $this->adapters));
  40285. }
  40286. public function directories()
  40287. {
  40288. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  40289. return $this;
  40290. }
  40291. public function files()
  40292. {
  40293. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  40294. return $this;
  40295. }
  40296. public function depth($level)
  40297. {
  40298. $this->depths[] = new Comparator\NumberComparator($level);
  40299. return $this;
  40300. }
  40301. public function date($date)
  40302. {
  40303. $this->dates[] = new Comparator\DateComparator($date);
  40304. return $this;
  40305. }
  40306. public function name($pattern)
  40307. {
  40308. $this->names[] = $pattern;
  40309. return $this;
  40310. }
  40311. public function notName($pattern)
  40312. {
  40313. $this->notNames[] = $pattern;
  40314. return $this;
  40315. }
  40316. public function contains($pattern)
  40317. {
  40318. $this->contains[] = $pattern;
  40319. return $this;
  40320. }
  40321. public function notContains($pattern)
  40322. {
  40323. $this->notContains[] = $pattern;
  40324. return $this;
  40325. }
  40326. public function path($pattern)
  40327. {
  40328. $this->paths[] = $pattern;
  40329. return $this;
  40330. }
  40331. public function notPath($pattern)
  40332. {
  40333. $this->notPaths[] = $pattern;
  40334. return $this;
  40335. }
  40336. public function size($size)
  40337. {
  40338. $this->sizes[] = new Comparator\NumberComparator($size);
  40339. return $this;
  40340. }
  40341. public function exclude($dirs)
  40342. {
  40343. $this->exclude = array_merge($this->exclude, (array) $dirs);
  40344. return $this;
  40345. }
  40346. public function ignoreDotFiles($ignoreDotFiles)
  40347. {
  40348. if ($ignoreDotFiles) {
  40349. $this->ignore |= static::IGNORE_DOT_FILES;
  40350. } else {
  40351. $this->ignore &= ~static::IGNORE_DOT_FILES;
  40352. }
  40353. return $this;
  40354. }
  40355. public function ignoreVCS($ignoreVCS)
  40356. {
  40357. if ($ignoreVCS) {
  40358. $this->ignore |= static::IGNORE_VCS_FILES;
  40359. } else {
  40360. $this->ignore &= ~static::IGNORE_VCS_FILES;
  40361. }
  40362. return $this;
  40363. }
  40364. public static function addVCSPattern($pattern)
  40365. {
  40366. foreach ((array) $pattern as $p) {
  40367. self::$vcsPatterns[] = $p;
  40368. }
  40369. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  40370. }
  40371. public function sort(\Closure $closure)
  40372. {
  40373. $this->sort = $closure;
  40374. return $this;
  40375. }
  40376. public function sortByName()
  40377. {
  40378. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  40379. return $this;
  40380. }
  40381. public function sortByType()
  40382. {
  40383. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  40384. return $this;
  40385. }
  40386. public function sortByAccessedTime()
  40387. {
  40388. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  40389. return $this;
  40390. }
  40391. public function sortByChangedTime()
  40392. {
  40393. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  40394. return $this;
  40395. }
  40396. public function sortByModifiedTime()
  40397. {
  40398. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  40399. return $this;
  40400. }
  40401. public function filter(\Closure $closure)
  40402. {
  40403. $this->filters[] = $closure;
  40404. return $this;
  40405. }
  40406. public function followLinks()
  40407. {
  40408. $this->followLinks = true;
  40409. return $this;
  40410. }
  40411. public function ignoreUnreadableDirs($ignore = true)
  40412. {
  40413. $this->ignoreUnreadableDirs = (bool) $ignore;
  40414. return $this;
  40415. }
  40416. public function in($dirs)
  40417. {
  40418. $resolvedDirs = array();
  40419. foreach ((array) $dirs as $dir) {
  40420. if (is_dir($dir)) {
  40421. $resolvedDirs[] = $dir;
  40422. } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  40423. $resolvedDirs = array_merge($resolvedDirs, $glob);
  40424. } else {
  40425. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  40426. }
  40427. }
  40428. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  40429. return $this;
  40430. }
  40431. public function getIterator()
  40432. {
  40433. if (0 === count($this->dirs) && 0 === count($this->iterators)) {
  40434. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  40435. }
  40436. if (1 === count($this->dirs) && 0 === count($this->iterators)) {
  40437. return $this->searchInDirectory($this->dirs[0]);
  40438. }
  40439. $iterator = new \AppendIterator();
  40440. foreach ($this->dirs as $dir) {
  40441. $iterator->append($this->searchInDirectory($dir));
  40442. }
  40443. foreach ($this->iterators as $it) {
  40444. $iterator->append($it);
  40445. }
  40446. return $iterator;
  40447. }
  40448. public function append($iterator)
  40449. {
  40450. if ($iterator instanceof \IteratorAggregate) {
  40451. $this->iterators[] = $iterator->getIterator();
  40452. } elseif ($iterator instanceof \Iterator) {
  40453. $this->iterators[] = $iterator;
  40454. } elseif ($iterator instanceof \Traversable || is_array($iterator)) {
  40455. $it = new \ArrayIterator();
  40456. foreach ($iterator as $file) {
  40457. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  40458. }
  40459. $this->iterators[] = $it;
  40460. } else {
  40461. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  40462. }
  40463. return $this;
  40464. }
  40465. public function count()
  40466. {
  40467. return iterator_count($this->getIterator());
  40468. }
  40469. private function sortAdapters()
  40470. {
  40471. uasort($this->adapters, function (array $a, array $b) {
  40472. if ($a['selected'] || $b['selected']) {
  40473. return $a['selected'] ? -1 : 1;
  40474. }
  40475. return $a['priority'] > $b['priority'] ? -1 : 1;
  40476. });
  40477. return $this;
  40478. }
  40479. private function searchInDirectory($dir)
  40480. {
  40481. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  40482. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  40483. }
  40484. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  40485. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  40486. }
  40487. if ($this->adapters) {
  40488. foreach ($this->adapters as $adapter) {
  40489. if ($adapter['adapter']->isSupported()) {
  40490. try {
  40491. return $this
  40492. ->buildAdapter($adapter['adapter'])
  40493. ->searchInDirectory($dir);
  40494. } catch (ExceptionInterface $e) {
  40495. }
  40496. }
  40497. }
  40498. }
  40499. $minDepth = 0;
  40500. $maxDepth = PHP_INT_MAX;
  40501. foreach ($this->depths as $comparator) {
  40502. switch ($comparator->getOperator()) {
  40503. case '>':
  40504. $minDepth = $comparator->getTarget() + 1;
  40505. break;
  40506. case '>=':
  40507. $minDepth = $comparator->getTarget();
  40508. break;
  40509. case '<':
  40510. $maxDepth = $comparator->getTarget() - 1;
  40511. break;
  40512. case '<=':
  40513. $maxDepth = $comparator->getTarget();
  40514. break;
  40515. default:
  40516. $minDepth = $maxDepth = $comparator->getTarget();
  40517. }
  40518. }
  40519. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  40520. if ($this->followLinks) {
  40521. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  40522. }
  40523. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  40524. if ($this->exclude) {
  40525. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  40526. }
  40527. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  40528. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  40529. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  40530. }
  40531. if ($this->mode) {
  40532. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  40533. }
  40534. if ($this->names || $this->notNames) {
  40535. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  40536. }
  40537. if ($this->contains || $this->notContains) {
  40538. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  40539. }
  40540. if ($this->sizes) {
  40541. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  40542. }
  40543. if ($this->dates) {
  40544. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  40545. }
  40546. if ($this->filters) {
  40547. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  40548. }
  40549. if ($this->paths || $this->notPaths) {
  40550. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  40551. }
  40552. if ($this->sort) {
  40553. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  40554. $iterator = $iteratorAggregate->getIterator();
  40555. }
  40556. return $iterator;
  40557. }
  40558. private function buildAdapter(AdapterInterface $adapter)
  40559. {
  40560. return $adapter
  40561. ->setFollowLinks($this->followLinks)
  40562. ->setDepths($this->depths)
  40563. ->setMode($this->mode)
  40564. ->setExclude($this->exclude)
  40565. ->setNames($this->names)
  40566. ->setNotNames($this->notNames)
  40567. ->setContains($this->contains)
  40568. ->setNotContains($this->notContains)
  40569. ->setSizes($this->sizes)
  40570. ->setDates($this->dates)
  40571. ->setFilters($this->filters)
  40572. ->setSort($this->sort)
  40573. ->setPath($this->paths)
  40574. ->setNotPath($this->notPaths)
  40575. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  40576. }
  40577. private function resetAdapterSelection()
  40578. {
  40579. $this->adapters = array_map(function (array $properties) {
  40580. $properties['selected'] = false;
  40581. return $properties;
  40582. }, $this->adapters);
  40583. }
  40584. private function initDefaultAdapters()
  40585. {
  40586. if (null === $this->adapters) {
  40587. $this->adapters = array();
  40588. $this
  40589. ->addAdapter(new GnuFindAdapter())
  40590. ->addAdapter(new BsdFindAdapter())
  40591. ->addAdapter(new PhpAdapter(), -50)
  40592. ->setAdapter('php')
  40593. ;
  40594. }
  40595. }
  40596. }
  40597. <?php
  40598. namespace Symfony\Component\Finder;
  40599. class Glob
  40600. {
  40601. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  40602. {
  40603. $firstByte = true;
  40604. $escaping = false;
  40605. $inCurlies = 0;
  40606. $regex = '';
  40607. $sizeGlob = strlen($glob);
  40608. for ($i = 0; $i < $sizeGlob; ++$i) {
  40609. $car = $glob[$i];
  40610. if ($firstByte) {
  40611. if ($strictLeadingDot && '.' !== $car) {
  40612. $regex .= '(?=[^\.])';
  40613. }
  40614. $firstByte = false;
  40615. }
  40616. if ('/' === $car) {
  40617. $firstByte = true;
  40618. }
  40619. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  40620. $regex .= "\\$car";
  40621. } elseif ('*' === $car) {
  40622. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  40623. } elseif ('?' === $car) {
  40624. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  40625. } elseif ('{' === $car) {
  40626. $regex .= $escaping ? '\\{' : '(';
  40627. if (!$escaping) {
  40628. ++$inCurlies;
  40629. }
  40630. } elseif ('}' === $car && $inCurlies) {
  40631. $regex .= $escaping ? '}' : ')';
  40632. if (!$escaping) {
  40633. --$inCurlies;
  40634. }
  40635. } elseif (',' === $car && $inCurlies) {
  40636. $regex .= $escaping ? ',' : '|';
  40637. } elseif ('\\' === $car) {
  40638. if ($escaping) {
  40639. $regex .= '\\\\';
  40640. $escaping = false;
  40641. } else {
  40642. $escaping = true;
  40643. }
  40644. continue;
  40645. } else {
  40646. $regex .= $car;
  40647. }
  40648. $escaping = false;
  40649. }
  40650. return $delimiter.'^'.$regex.'$'.$delimiter;
  40651. }
  40652. }
  40653. <?php
  40654. namespace Symfony\Component\Finder\Iterator;
  40655. class CustomFilterIterator extends FilterIterator
  40656. {
  40657. private $filters = array();
  40658. public function __construct(\Iterator $iterator, array $filters)
  40659. {
  40660. foreach ($filters as $filter) {
  40661. if (!is_callable($filter)) {
  40662. throw new \InvalidArgumentException('Invalid PHP callback.');
  40663. }
  40664. }
  40665. $this->filters = $filters;
  40666. parent::__construct($iterator);
  40667. }
  40668. public function accept()
  40669. {
  40670. $fileinfo = $this->current();
  40671. foreach ($this->filters as $filter) {
  40672. if (false === call_user_func($filter, $fileinfo)) {
  40673. return false;
  40674. }
  40675. }
  40676. return true;
  40677. }
  40678. }
  40679. <?php
  40680. namespace Symfony\Component\Finder\Iterator;
  40681. use Symfony\Component\Finder\Comparator\DateComparator;
  40682. class DateRangeFilterIterator extends FilterIterator
  40683. {
  40684. private $comparators = array();
  40685. public function __construct(\Iterator $iterator, array $comparators)
  40686. {
  40687. $this->comparators = $comparators;
  40688. parent::__construct($iterator);
  40689. }
  40690. public function accept()
  40691. {
  40692. $fileinfo = $this->current();
  40693. if (!file_exists($fileinfo->getPathname())) {
  40694. return false;
  40695. }
  40696. $filedate = $fileinfo->getMTime();
  40697. foreach ($this->comparators as $compare) {
  40698. if (!$compare->test($filedate)) {
  40699. return false;
  40700. }
  40701. }
  40702. return true;
  40703. }
  40704. }
  40705. <?php
  40706. namespace Symfony\Component\Finder\Iterator;
  40707. class DepthRangeFilterIterator extends FilterIterator
  40708. {
  40709. private $minDepth = 0;
  40710. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  40711. {
  40712. $this->minDepth = $minDepth;
  40713. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  40714. parent::__construct($iterator);
  40715. }
  40716. public function accept()
  40717. {
  40718. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  40719. }
  40720. }
  40721. <?php
  40722. namespace Symfony\Component\Finder\Iterator;
  40723. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  40724. {
  40725. private $iterator;
  40726. private $isRecursive;
  40727. private $excludedDirs = array();
  40728. private $excludedPattern;
  40729. public function __construct(\Iterator $iterator, array $directories)
  40730. {
  40731. $this->iterator = $iterator;
  40732. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  40733. $patterns = array();
  40734. foreach ($directories as $directory) {
  40735. $directory = rtrim($directory, '/');
  40736. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  40737. $patterns[] = preg_quote($directory, '#');
  40738. } else {
  40739. $this->excludedDirs[$directory] = true;
  40740. }
  40741. }
  40742. if ($patterns) {
  40743. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  40744. }
  40745. parent::__construct($iterator);
  40746. }
  40747. public function accept()
  40748. {
  40749. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  40750. return false;
  40751. }
  40752. if ($this->excludedPattern) {
  40753. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  40754. $path = str_replace('\\', '/', $path);
  40755. return !preg_match($this->excludedPattern, $path);
  40756. }
  40757. return true;
  40758. }
  40759. public function hasChildren()
  40760. {
  40761. return $this->isRecursive && $this->iterator->hasChildren();
  40762. }
  40763. public function getChildren()
  40764. {
  40765. $children = new self($this->iterator->getChildren(), array());
  40766. $children->excludedDirs = $this->excludedDirs;
  40767. $children->excludedPattern = $this->excludedPattern;
  40768. return $children;
  40769. }
  40770. }
  40771. <?php
  40772. namespace Symfony\Component\Finder\Iterator;
  40773. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  40774. use Symfony\Component\Finder\SplFileInfo;
  40775. class FilePathsIterator extends \ArrayIterator
  40776. {
  40777. private $baseDir;
  40778. private $baseDirLength;
  40779. private $subPath;
  40780. private $subPathname;
  40781. private $current;
  40782. public function __construct(array $paths, $baseDir)
  40783. {
  40784. $this->baseDir = $baseDir;
  40785. $this->baseDirLength = strlen($baseDir);
  40786. parent::__construct($paths);
  40787. }
  40788. public function __call($name, array $arguments)
  40789. {
  40790. return call_user_func_array(array($this->current(), $name), $arguments);
  40791. }
  40792. public function current()
  40793. {
  40794. return $this->current;
  40795. }
  40796. public function key()
  40797. {
  40798. return $this->current->getPathname();
  40799. }
  40800. public function next()
  40801. {
  40802. parent::next();
  40803. $this->buildProperties();
  40804. }
  40805. public function rewind()
  40806. {
  40807. parent::rewind();
  40808. $this->buildProperties();
  40809. }
  40810. public function getSubPath()
  40811. {
  40812. return $this->subPath;
  40813. }
  40814. public function getSubPathname()
  40815. {
  40816. return $this->subPathname;
  40817. }
  40818. private function buildProperties()
  40819. {
  40820. $absolutePath = parent::current();
  40821. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  40822. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  40823. $dir = dirname($this->subPathname);
  40824. $this->subPath = '.' === $dir ? '' : $dir;
  40825. } else {
  40826. $this->subPath = $this->subPathname = '';
  40827. }
  40828. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  40829. }
  40830. }
  40831. <?php
  40832. namespace Symfony\Component\Finder\Iterator;
  40833. class FileTypeFilterIterator extends FilterIterator
  40834. {
  40835. const ONLY_FILES = 1;
  40836. const ONLY_DIRECTORIES = 2;
  40837. private $mode;
  40838. public function __construct(\Iterator $iterator, $mode)
  40839. {
  40840. $this->mode = $mode;
  40841. parent::__construct($iterator);
  40842. }
  40843. public function accept()
  40844. {
  40845. $fileinfo = $this->current();
  40846. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  40847. return false;
  40848. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  40849. return false;
  40850. }
  40851. return true;
  40852. }
  40853. }
  40854. <?php
  40855. namespace Symfony\Component\Finder\Iterator;
  40856. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  40857. {
  40858. public function accept()
  40859. {
  40860. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  40861. return true;
  40862. }
  40863. $fileinfo = $this->current();
  40864. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  40865. return false;
  40866. }
  40867. $content = $fileinfo->getContents();
  40868. if (!$content) {
  40869. return false;
  40870. }
  40871. return $this->isAccepted($content);
  40872. }
  40873. protected function toRegex($str)
  40874. {
  40875. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  40876. }
  40877. }
  40878. <?php
  40879. namespace Symfony\Component\Finder\Iterator;
  40880. use Symfony\Component\Finder\Glob;
  40881. class FilenameFilterIterator extends MultiplePcreFilterIterator
  40882. {
  40883. public function accept()
  40884. {
  40885. return $this->isAccepted($this->current()->getFilename());
  40886. }
  40887. protected function toRegex($str)
  40888. {
  40889. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  40890. }
  40891. }
  40892. <?php
  40893. namespace Symfony\Component\Finder\Iterator;
  40894. abstract class FilterIterator extends \FilterIterator
  40895. {
  40896. public function rewind()
  40897. {
  40898. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  40899. parent::rewind();
  40900. return;
  40901. }
  40902. $iterator = $this;
  40903. while ($iterator instanceof \OuterIterator) {
  40904. $innerIterator = $iterator->getInnerIterator();
  40905. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  40906. if ($innerIterator->isRewindable()) {
  40907. $innerIterator->next();
  40908. $innerIterator->rewind();
  40909. }
  40910. } elseif ($innerIterator instanceof \FilesystemIterator) {
  40911. $innerIterator->next();
  40912. $innerIterator->rewind();
  40913. }
  40914. $iterator = $innerIterator;
  40915. }
  40916. parent::rewind();
  40917. }
  40918. }
  40919. <?php
  40920. namespace Symfony\Component\Finder\Iterator;
  40921. abstract class MultiplePcreFilterIterator extends FilterIterator
  40922. {
  40923. protected $matchRegexps = array();
  40924. protected $noMatchRegexps = array();
  40925. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  40926. {
  40927. foreach ($matchPatterns as $pattern) {
  40928. $this->matchRegexps[] = $this->toRegex($pattern);
  40929. }
  40930. foreach ($noMatchPatterns as $pattern) {
  40931. $this->noMatchRegexps[] = $this->toRegex($pattern);
  40932. }
  40933. parent::__construct($iterator);
  40934. }
  40935. protected function isAccepted($string)
  40936. {
  40937. foreach ($this->noMatchRegexps as $regex) {
  40938. if (preg_match($regex, $string)) {
  40939. return false;
  40940. }
  40941. }
  40942. if ($this->matchRegexps) {
  40943. foreach ($this->matchRegexps as $regex) {
  40944. if (preg_match($regex, $string)) {
  40945. return true;
  40946. }
  40947. }
  40948. return false;
  40949. }
  40950. return true;
  40951. }
  40952. protected function isRegex($str)
  40953. {
  40954. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  40955. $start = substr($m[1], 0, 1);
  40956. $end = substr($m[1], -1);
  40957. if ($start === $end) {
  40958. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  40959. }
  40960. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  40961. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  40962. return true;
  40963. }
  40964. }
  40965. }
  40966. return false;
  40967. }
  40968. abstract protected function toRegex($str);
  40969. }
  40970. <?php
  40971. namespace Symfony\Component\Finder\Iterator;
  40972. class PathFilterIterator extends MultiplePcreFilterIterator
  40973. {
  40974. public function accept()
  40975. {
  40976. $filename = $this->current()->getRelativePathname();
  40977. if ('\\' === DIRECTORY_SEPARATOR) {
  40978. $filename = str_replace('\\', '/', $filename);
  40979. }
  40980. return $this->isAccepted($filename);
  40981. }
  40982. protected function toRegex($str)
  40983. {
  40984. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  40985. }
  40986. }
  40987. <?php
  40988. namespace Symfony\Component\Finder\Iterator;
  40989. use Symfony\Component\Finder\Exception\AccessDeniedException;
  40990. use Symfony\Component\Finder\SplFileInfo;
  40991. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  40992. {
  40993. private $ignoreUnreadableDirs;
  40994. private $rewindable;
  40995. private $rootPath;
  40996. private $subPath;
  40997. private $directorySeparator = '/';
  40998. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  40999. {
  41000. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  41001. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  41002. }
  41003. parent::__construct($path, $flags);
  41004. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  41005. $this->rootPath = (string) $path;
  41006. if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  41007. $this->directorySeparator = DIRECTORY_SEPARATOR;
  41008. }
  41009. }
  41010. public function current()
  41011. {
  41012. if (null === $subPathname = $this->subPath) {
  41013. $subPathname = $this->subPath = (string) $this->getSubPath();
  41014. }
  41015. if ('' !== $subPathname) {
  41016. $subPathname .= $this->directorySeparator;
  41017. }
  41018. $subPathname .= $this->getFilename();
  41019. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  41020. }
  41021. public function getChildren()
  41022. {
  41023. try {
  41024. $children = parent::getChildren();
  41025. if ($children instanceof self) {
  41026. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  41027. $children->rewindable = &$this->rewindable;
  41028. $children->rootPath = $this->rootPath;
  41029. }
  41030. return $children;
  41031. } catch (\UnexpectedValueException $e) {
  41032. if ($this->ignoreUnreadableDirs) {
  41033. return new \RecursiveArrayIterator(array());
  41034. } else {
  41035. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  41036. }
  41037. }
  41038. }
  41039. public function rewind()
  41040. {
  41041. if (false === $this->isRewindable()) {
  41042. return;
  41043. }
  41044. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  41045. parent::next();
  41046. }
  41047. parent::rewind();
  41048. }
  41049. public function isRewindable()
  41050. {
  41051. if (null !== $this->rewindable) {
  41052. return $this->rewindable;
  41053. }
  41054. if ('' === $this->getPath()) {
  41055. return $this->rewindable = false;
  41056. }
  41057. if (false !== $stream = @opendir($this->getPath())) {
  41058. $infos = stream_get_meta_data($stream);
  41059. closedir($stream);
  41060. if ($infos['seekable']) {
  41061. return $this->rewindable = true;
  41062. }
  41063. }
  41064. return $this->rewindable = false;
  41065. }
  41066. }
  41067. <?php
  41068. namespace Symfony\Component\Finder\Iterator;
  41069. use Symfony\Component\Finder\Comparator\NumberComparator;
  41070. class SizeRangeFilterIterator extends FilterIterator
  41071. {
  41072. private $comparators = array();
  41073. public function __construct(\Iterator $iterator, array $comparators)
  41074. {
  41075. $this->comparators = $comparators;
  41076. parent::__construct($iterator);
  41077. }
  41078. public function accept()
  41079. {
  41080. $fileinfo = $this->current();
  41081. if (!$fileinfo->isFile()) {
  41082. return true;
  41083. }
  41084. $filesize = $fileinfo->getSize();
  41085. foreach ($this->comparators as $compare) {
  41086. if (!$compare->test($filesize)) {
  41087. return false;
  41088. }
  41089. }
  41090. return true;
  41091. }
  41092. }
  41093. <?php
  41094. namespace Symfony\Component\Finder\Iterator;
  41095. class SortableIterator implements \IteratorAggregate
  41096. {
  41097. const SORT_BY_NAME = 1;
  41098. const SORT_BY_TYPE = 2;
  41099. const SORT_BY_ACCESSED_TIME = 3;
  41100. const SORT_BY_CHANGED_TIME = 4;
  41101. const SORT_BY_MODIFIED_TIME = 5;
  41102. private $iterator;
  41103. private $sort;
  41104. public function __construct(\Traversable $iterator, $sort)
  41105. {
  41106. $this->iterator = $iterator;
  41107. if (self::SORT_BY_NAME === $sort) {
  41108. $this->sort = function ($a, $b) {
  41109. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  41110. };
  41111. } elseif (self::SORT_BY_TYPE === $sort) {
  41112. $this->sort = function ($a, $b) {
  41113. if ($a->isDir() && $b->isFile()) {
  41114. return -1;
  41115. } elseif ($a->isFile() && $b->isDir()) {
  41116. return 1;
  41117. }
  41118. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  41119. };
  41120. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  41121. $this->sort = function ($a, $b) {
  41122. return $a->getATime() - $b->getATime();
  41123. };
  41124. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  41125. $this->sort = function ($a, $b) {
  41126. return $a->getCTime() - $b->getCTime();
  41127. };
  41128. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  41129. $this->sort = function ($a, $b) {
  41130. return $a->getMTime() - $b->getMTime();
  41131. };
  41132. } elseif (is_callable($sort)) {
  41133. $this->sort = $sort;
  41134. } else {
  41135. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  41136. }
  41137. }
  41138. public function getIterator()
  41139. {
  41140. $array = iterator_to_array($this->iterator, true);
  41141. uasort($array, $this->sort);
  41142. return new \ArrayIterator($array);
  41143. }
  41144. }
  41145. Copyright (c) 2004-2017 Fabien Potencier
  41146. Permission is hereby granted, free of charge, to any person obtaining a copy
  41147. of this software and associated documentation files (the "Software"), to deal
  41148. in the Software without restriction, including without limitation the rights
  41149. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41150. copies of the Software, and to permit persons to whom the Software is furnished
  41151. to do so, subject to the following conditions:
  41152. The above copyright notice and this permission notice shall be included in all
  41153. copies or substantial portions of the Software.
  41154. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41155. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41156. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41157. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41158. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41159. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41160. THE SOFTWARE.
  41161. <?php
  41162. namespace Symfony\Component\Finder\Shell;
  41163. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41164. class Command
  41165. {
  41166. private $parent;
  41167. private $bits = array();
  41168. private $labels = array();
  41169. private $errorHandler;
  41170. public function __construct(Command $parent = null)
  41171. {
  41172. $this->parent = $parent;
  41173. }
  41174. public function __toString()
  41175. {
  41176. return $this->join();
  41177. }
  41178. public static function create(Command $parent = null)
  41179. {
  41180. return new self($parent);
  41181. }
  41182. public static function escape($input)
  41183. {
  41184. return escapeshellcmd($input);
  41185. }
  41186. public static function quote($input)
  41187. {
  41188. return escapeshellarg($input);
  41189. }
  41190. public function add($bit)
  41191. {
  41192. $this->bits[] = $bit;
  41193. return $this;
  41194. }
  41195. public function top($bit)
  41196. {
  41197. array_unshift($this->bits, $bit);
  41198. foreach ($this->labels as $label => $index) {
  41199. $this->labels[$label] += 1;
  41200. }
  41201. return $this;
  41202. }
  41203. public function arg($arg)
  41204. {
  41205. $this->bits[] = self::quote($arg);
  41206. return $this;
  41207. }
  41208. public function cmd($esc)
  41209. {
  41210. $this->bits[] = self::escape($esc);
  41211. return $this;
  41212. }
  41213. public function ins($label)
  41214. {
  41215. if (isset($this->labels[$label])) {
  41216. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  41217. }
  41218. $this->bits[] = self::create($this);
  41219. $this->labels[$label] = count($this->bits) - 1;
  41220. return $this->bits[$this->labels[$label]];
  41221. }
  41222. public function get($label)
  41223. {
  41224. if (!isset($this->labels[$label])) {
  41225. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  41226. }
  41227. return $this->bits[$this->labels[$label]];
  41228. }
  41229. public function end()
  41230. {
  41231. if (null === $this->parent) {
  41232. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  41233. }
  41234. return $this->parent;
  41235. }
  41236. public function length()
  41237. {
  41238. return count($this->bits);
  41239. }
  41240. public function setErrorHandler(\Closure $errorHandler)
  41241. {
  41242. $this->errorHandler = $errorHandler;
  41243. return $this;
  41244. }
  41245. public function getErrorHandler()
  41246. {
  41247. return $this->errorHandler;
  41248. }
  41249. public function execute()
  41250. {
  41251. if (null === $errorHandler = $this->errorHandler) {
  41252. exec($this->join(), $output);
  41253. } else {
  41254. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  41255. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  41256. if ($error = stream_get_contents($pipes[2])) {
  41257. $errorHandler($error);
  41258. }
  41259. proc_close($process);
  41260. }
  41261. return $output ?: array();
  41262. }
  41263. public function join()
  41264. {
  41265. return implode(' ', array_filter(
  41266. array_map(function ($bit) {
  41267. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  41268. }, $this->bits),
  41269. function ($bit) { return null !== $bit; }
  41270. ));
  41271. }
  41272. public function addAtIndex($bit, $index)
  41273. {
  41274. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  41275. return $this;
  41276. }
  41277. }
  41278. <?php
  41279. namespace Symfony\Component\Finder\Shell;
  41280. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41281. class Shell
  41282. {
  41283. const TYPE_UNIX = 1;
  41284. const TYPE_DARWIN = 2;
  41285. const TYPE_CYGWIN = 3;
  41286. const TYPE_WINDOWS = 4;
  41287. const TYPE_BSD = 5;
  41288. private $type;
  41289. public function getType()
  41290. {
  41291. if (null === $this->type) {
  41292. $this->type = $this->guessType();
  41293. }
  41294. return $this->type;
  41295. }
  41296. public function testCommand($command)
  41297. {
  41298. if (!function_exists('exec')) {
  41299. return false;
  41300. }
  41301. $testCommand = 'which ';
  41302. if (self::TYPE_WINDOWS === $this->type) {
  41303. $testCommand = 'where ';
  41304. }
  41305. $command = escapeshellcmd($command);
  41306. exec($testCommand.$command, $output, $code);
  41307. return 0 === $code && count($output) > 0;
  41308. }
  41309. private function guessType()
  41310. {
  41311. $os = strtolower(PHP_OS);
  41312. if (false !== strpos($os, 'cygwin')) {
  41313. return self::TYPE_CYGWIN;
  41314. }
  41315. if (false !== strpos($os, 'darwin')) {
  41316. return self::TYPE_DARWIN;
  41317. }
  41318. if (false !== strpos($os, 'bsd')) {
  41319. return self::TYPE_BSD;
  41320. }
  41321. if (0 === strpos($os, 'win')) {
  41322. return self::TYPE_WINDOWS;
  41323. }
  41324. return self::TYPE_UNIX;
  41325. }
  41326. }
  41327. <?php
  41328. namespace Symfony\Component\Finder;
  41329. class SplFileInfo extends \SplFileInfo
  41330. {
  41331. private $relativePath;
  41332. private $relativePathname;
  41333. public function __construct($file, $relativePath, $relativePathname)
  41334. {
  41335. parent::__construct($file);
  41336. $this->relativePath = $relativePath;
  41337. $this->relativePathname = $relativePathname;
  41338. }
  41339. public function getRelativePath()
  41340. {
  41341. return $this->relativePath;
  41342. }
  41343. public function getRelativePathname()
  41344. {
  41345. return $this->relativePathname;
  41346. }
  41347. public function getContents()
  41348. {
  41349. $level = error_reporting(0);
  41350. $content = file_get_contents($this->getPathname());
  41351. error_reporting($level);
  41352. if (false === $content) {
  41353. $error = error_get_last();
  41354. throw new \RuntimeException($error['message']);
  41355. }
  41356. return $content;
  41357. }
  41358. }
  41359. Copyright (c) 2014-2016 Fabien Potencier
  41360. Permission is hereby granted, free of charge, to any person obtaining a copy
  41361. of this software and associated documentation files (the "Software"), to deal
  41362. in the Software without restriction, including without limitation the rights
  41363. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41364. copies of the Software, and to permit persons to whom the Software is furnished
  41365. to do so, subject to the following conditions:
  41366. The above copyright notice and this permission notice shall be included in all
  41367. copies or substantial portions of the Software.
  41368. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41369. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41370. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41371. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41372. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41373. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41374. THE SOFTWARE.
  41375. <?php
  41376. namespace Symfony\Polyfill\Mbstring;
  41377. final class Mbstring
  41378. {
  41379. const MB_CASE_FOLD = PHP_INT_MAX;
  41380. private static $encodingList = array('ASCII', 'UTF-8');
  41381. private static $language = 'neutral';
  41382. private static $internalEncoding = 'UTF-8';
  41383. private static $caseFold = array(
  41384. array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"),
  41385. array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1",'ι'),
  41386. );
  41387. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  41388. {
  41389. if (is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  41390. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  41391. } else {
  41392. $fromEncoding = self::getEncoding($fromEncoding);
  41393. }
  41394. $toEncoding = self::getEncoding($toEncoding);
  41395. if ('BASE64' === $fromEncoding) {
  41396. $s = base64_decode($s);
  41397. $fromEncoding = $toEncoding;
  41398. }
  41399. if ('BASE64' === $toEncoding) {
  41400. return base64_encode($s);
  41401. }
  41402. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  41403. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  41404. $fromEncoding = 'Windows-1252';
  41405. }
  41406. if ('UTF-8' !== $fromEncoding) {
  41407. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  41408. }
  41409. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  41410. }
  41411. if ('HTML-ENTITIES' === $fromEncoding) {
  41412. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  41413. $fromEncoding = 'UTF-8';
  41414. }
  41415. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  41416. }
  41417. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  41418. {
  41419. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  41420. $ok = true;
  41421. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  41422. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  41423. $ok = false;
  41424. }
  41425. });
  41426. return $ok ? $fromEncoding : false;
  41427. }
  41428. public static function mb_decode_mimeheader($s)
  41429. {
  41430. return iconv_mime_decode($s, 2, self::$internalEncoding);
  41431. }
  41432. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  41433. {
  41434. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  41435. }
  41436. public static function mb_convert_case($s, $mode, $encoding = null)
  41437. {
  41438. if ('' === $s .= '') {
  41439. return '';
  41440. }
  41441. $encoding = self::getEncoding($encoding);
  41442. if ('UTF-8' === $encoding) {
  41443. $encoding = null;
  41444. if (!preg_match('//u', $s)) {
  41445. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  41446. }
  41447. } else {
  41448. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  41449. }
  41450. if (MB_CASE_TITLE == $mode) {
  41451. $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s);
  41452. $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s);
  41453. } else {
  41454. if (MB_CASE_UPPER == $mode) {
  41455. static $upper = null;
  41456. if (null === $upper) {
  41457. $upper = self::getData('upperCase');
  41458. }
  41459. $map = $upper;
  41460. } else {
  41461. if (self::MB_CASE_FOLD === $mode) {
  41462. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  41463. }
  41464. static $lower = null;
  41465. if (null === $lower) {
  41466. $lower = self::getData('lowerCase');
  41467. }
  41468. $map = $lower;
  41469. }
  41470. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  41471. $i = 0;
  41472. $len = strlen($s);
  41473. while ($i < $len) {
  41474. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  41475. $uchr = substr($s, $i, $ulen);
  41476. $i += $ulen;
  41477. if (isset($map[$uchr])) {
  41478. $uchr = $map[$uchr];
  41479. $nlen = strlen($uchr);
  41480. if ($nlen == $ulen) {
  41481. $nlen = $i;
  41482. do {
  41483. $s[--$nlen] = $uchr[--$ulen];
  41484. } while ($ulen);
  41485. } else {
  41486. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  41487. $len += $nlen - $ulen;
  41488. $i += $nlen - $ulen;
  41489. }
  41490. }
  41491. }
  41492. }
  41493. if (null === $encoding) {
  41494. return $s;
  41495. }
  41496. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  41497. }
  41498. public static function mb_internal_encoding($encoding = null)
  41499. {
  41500. if (null === $encoding) {
  41501. return self::$internalEncoding;
  41502. }
  41503. $encoding = self::getEncoding($encoding);
  41504. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  41505. self::$internalEncoding = $encoding;
  41506. return true;
  41507. }
  41508. return false;
  41509. }
  41510. public static function mb_language($lang = null)
  41511. {
  41512. if (null === $lang) {
  41513. return self::$language;
  41514. }
  41515. switch ($lang = strtolower($lang)) {
  41516. case 'uni':
  41517. case 'neutral':
  41518. self::$language = $lang;
  41519. return true;
  41520. }
  41521. return false;
  41522. }
  41523. public static function mb_list_encodings()
  41524. {
  41525. return array('UTF-8');
  41526. }
  41527. public static function mb_encoding_aliases($encoding)
  41528. {
  41529. switch (strtoupper($encoding)) {
  41530. case 'UTF8':
  41531. case 'UTF-8':
  41532. return array('utf8');
  41533. }
  41534. return false;
  41535. }
  41536. public static function mb_check_encoding($var = null, $encoding = null)
  41537. {
  41538. if (null === $encoding) {
  41539. if (null === $var) {
  41540. return false;
  41541. }
  41542. $encoding = self::$internalEncoding;
  41543. }
  41544. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  41545. }
  41546. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  41547. {
  41548. if (null === $encodingList) {
  41549. $encodingList = self::$encodingList;
  41550. } else {
  41551. if (!is_array($encodingList)) {
  41552. $encodingList = array_map('trim', explode(',', $encodingList));
  41553. }
  41554. $encodingList = array_map('strtoupper', $encodingList);
  41555. }
  41556. foreach ($encodingList as $enc) {
  41557. switch ($enc) {
  41558. case 'ASCII':
  41559. if (!preg_match('/[\x80-\xFF]/', $str)) {
  41560. return $enc;
  41561. }
  41562. break;
  41563. case 'UTF8':
  41564. case 'UTF-8':
  41565. if (preg_match('//u', $str)) {
  41566. return 'UTF-8';
  41567. }
  41568. break;
  41569. default:
  41570. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  41571. return $enc;
  41572. }
  41573. }
  41574. }
  41575. return false;
  41576. }
  41577. public static function mb_detect_order($encodingList = null)
  41578. {
  41579. if (null === $encodingList) {
  41580. return self::$encodingList;
  41581. }
  41582. if (!is_array($encodingList)) {
  41583. $encodingList = array_map('trim', explode(',', $encodingList));
  41584. }
  41585. $encodingList = array_map('strtoupper', $encodingList);
  41586. foreach ($encodingList as $enc) {
  41587. switch ($enc) {
  41588. default:
  41589. if (strncmp($enc, 'ISO-8859-', 9)) {
  41590. return false;
  41591. }
  41592. case 'ASCII':
  41593. case 'UTF8':
  41594. case 'UTF-8':
  41595. }
  41596. }
  41597. self::$encodingList = $encodingList;
  41598. return true;
  41599. }
  41600. public static function mb_strlen($s, $encoding = null)
  41601. {
  41602. $encoding = self::getEncoding($encoding);
  41603. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41604. return strlen($s);
  41605. }
  41606. return @iconv_strlen($s, $encoding);
  41607. }
  41608. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  41609. {
  41610. $encoding = self::getEncoding($encoding);
  41611. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41612. return strpos($haystack, $needle, $offset);
  41613. }
  41614. if ('' === $needle .= '') {
  41615. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  41616. return false;
  41617. }
  41618. return iconv_strpos($haystack, $needle, $offset, $encoding);
  41619. }
  41620. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  41621. {
  41622. $encoding = self::getEncoding($encoding);
  41623. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41624. return strrpos($haystack, $needle, $offset);
  41625. }
  41626. if ($offset != (int) $offset) {
  41627. $offset = 0;
  41628. } elseif ($offset = (int) $offset) {
  41629. if ($offset < 0) {
  41630. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  41631. $offset = 0;
  41632. } else {
  41633. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  41634. }
  41635. }
  41636. $pos = iconv_strrpos($haystack, $needle, $encoding);
  41637. return false !== $pos ? $offset + $pos : false;
  41638. }
  41639. public static function mb_strtolower($s, $encoding = null)
  41640. {
  41641. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  41642. }
  41643. public static function mb_strtoupper($s, $encoding = null)
  41644. {
  41645. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  41646. }
  41647. public static function mb_substitute_character($c = null)
  41648. {
  41649. if (0 === strcasecmp($c, 'none')) {
  41650. return true;
  41651. }
  41652. return null !== $c ? false : 'none';
  41653. }
  41654. public static function mb_substr($s, $start, $length = null, $encoding = null)
  41655. {
  41656. $encoding = self::getEncoding($encoding);
  41657. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41658. return substr($s, $start, null === $length ? 2147483647 : $length);
  41659. }
  41660. if ($start < 0) {
  41661. $start = iconv_strlen($s, $encoding) + $start;
  41662. if ($start < 0) {
  41663. $start = 0;
  41664. }
  41665. }
  41666. if (null === $length) {
  41667. $length = 2147483647;
  41668. } elseif ($length < 0) {
  41669. $length = iconv_strlen($s, $encoding) + $length - $start;
  41670. if ($length < 0) {
  41671. return '';
  41672. }
  41673. }
  41674. return iconv_substr($s, $start, $length, $encoding).'';
  41675. }
  41676. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  41677. {
  41678. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  41679. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  41680. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  41681. }
  41682. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  41683. {
  41684. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  41685. return self::getSubpart($pos, $part, $haystack, $encoding);
  41686. }
  41687. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  41688. {
  41689. $encoding = self::getEncoding($encoding);
  41690. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  41691. return strrchr($haystack, $needle, $part);
  41692. }
  41693. $needle = self::mb_substr($needle, 0, 1, $encoding);
  41694. $pos = iconv_strrpos($haystack, $needle, $encoding);
  41695. return self::getSubpart($pos, $part, $haystack, $encoding);
  41696. }
  41697. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  41698. {
  41699. $needle = self::mb_substr($needle, 0, 1, $encoding);
  41700. $pos = self::mb_strripos($haystack, $needle, $encoding);
  41701. return self::getSubpart($pos, $part, $haystack, $encoding);
  41702. }
  41703. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  41704. {
  41705. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  41706. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  41707. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  41708. }
  41709. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  41710. {
  41711. $pos = strpos($haystack, $needle);
  41712. if (false === $pos) {
  41713. return false;
  41714. }
  41715. if ($part) {
  41716. return substr($haystack, 0, $pos);
  41717. }
  41718. return substr($haystack, $pos);
  41719. }
  41720. public static function mb_get_info($type = 'all')
  41721. {
  41722. $info = array(
  41723. 'internal_encoding' => self::$internalEncoding,
  41724. 'http_output' => 'pass',
  41725. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  41726. 'func_overload' => 0,
  41727. 'func_overload_list' => 'no overload',
  41728. 'mail_charset' => 'UTF-8',
  41729. 'mail_header_encoding' => 'BASE64',
  41730. 'mail_body_encoding' => 'BASE64',
  41731. 'illegal_chars' => 0,
  41732. 'encoding_translation' => 'Off',
  41733. 'language' => self::$language,
  41734. 'detect_order' => self::$encodingList,
  41735. 'substitute_character' => 'none',
  41736. 'strict_detection' => 'Off',
  41737. );
  41738. if ('all' === $type) {
  41739. return $info;
  41740. }
  41741. if (isset($info[$type])) {
  41742. return $info[$type];
  41743. }
  41744. return false;
  41745. }
  41746. public static function mb_http_input($type = '')
  41747. {
  41748. return false;
  41749. }
  41750. public static function mb_http_output($encoding = null)
  41751. {
  41752. return null !== $encoding ? 'pass' === $encoding : 'pass';
  41753. }
  41754. public static function mb_strwidth($s, $encoding = null)
  41755. {
  41756. $encoding = self::getEncoding($encoding);
  41757. if ('UTF-8' !== $encoding) {
  41758. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  41759. }
  41760. $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
  41761. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  41762. }
  41763. public static function mb_substr_count($haystack, $needle, $encoding = null)
  41764. {
  41765. return substr_count($haystack, $needle);
  41766. }
  41767. public static function mb_output_handler($contents, $status)
  41768. {
  41769. return $contents;
  41770. }
  41771. public static function mb_chr($code, $encoding = null)
  41772. {
  41773. if (0x80 > $code %= 0x200000) {
  41774. $s = chr($code);
  41775. } elseif (0x800 > $code) {
  41776. $s = chr(0xC0 | $code >> 6).chr(0x80 | $code & 0x3F);
  41777. } elseif (0x10000 > $code) {
  41778. $s = chr(0xE0 | $code >> 12).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F);
  41779. } else {
  41780. $s = chr(0xF0 | $code >> 18).chr(0x80 | $code >> 12 & 0x3F).chr(0x80 | $code >> 6 & 0x3F).chr(0x80 | $code & 0x3F);
  41781. }
  41782. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  41783. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  41784. }
  41785. return $s;
  41786. }
  41787. public static function mb_ord($s, $encoding = null)
  41788. {
  41789. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  41790. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  41791. }
  41792. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  41793. if (0xF0 <= $code) {
  41794. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  41795. }
  41796. if (0xE0 <= $code) {
  41797. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  41798. }
  41799. if (0xC0 <= $code) {
  41800. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  41801. }
  41802. return $code;
  41803. }
  41804. private static function getSubpart($pos, $part, $haystack, $encoding)
  41805. {
  41806. if (false === $pos) {
  41807. return false;
  41808. }
  41809. if ($part) {
  41810. return self::mb_substr($haystack, 0, $pos, $encoding);
  41811. }
  41812. return self::mb_substr($haystack, $pos, null, $encoding);
  41813. }
  41814. private static function html_encoding_callback($m)
  41815. {
  41816. $i = 1;
  41817. $entities = '';
  41818. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  41819. while (isset($m[$i])) {
  41820. if (0x80 > $m[$i]) {
  41821. $entities .= chr($m[$i++]);
  41822. continue;
  41823. }
  41824. if (0xF0 <= $m[$i]) {
  41825. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  41826. } elseif (0xE0 <= $m[$i]) {
  41827. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  41828. } else {
  41829. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  41830. }
  41831. $entities .= '&#'.$c.';';
  41832. }
  41833. return $entities;
  41834. }
  41835. private static function title_case_lower($s)
  41836. {
  41837. return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8');
  41838. }
  41839. private static function title_case_upper($s)
  41840. {
  41841. return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8');
  41842. }
  41843. private static function getData($file)
  41844. {
  41845. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  41846. return require $file;
  41847. }
  41848. return false;
  41849. }
  41850. private static function getEncoding($encoding)
  41851. {
  41852. if (null === $encoding) {
  41853. return self::$internalEncoding;
  41854. }
  41855. $encoding = strtoupper($encoding);
  41856. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  41857. return 'CP850';
  41858. }
  41859. if ('UTF8' === $encoding) {
  41860. return 'UTF-8';
  41861. }
  41862. return $encoding;
  41863. }
  41864. }
  41865. <?php
  41866. static $data = array (
  41867. 'A' => 'a',
  41868. 'B' => 'b',
  41869. 'C' => 'c',
  41870. 'D' => 'd',
  41871. 'E' => 'e',
  41872. 'F' => 'f',
  41873. 'G' => 'g',
  41874. 'H' => 'h',
  41875. 'I' => 'i',
  41876. 'J' => 'j',
  41877. 'K' => 'k',
  41878. 'L' => 'l',
  41879. 'M' => 'm',
  41880. 'N' => 'n',
  41881. 'O' => 'o',
  41882. 'P' => 'p',
  41883. 'Q' => 'q',
  41884. 'R' => 'r',
  41885. 'S' => 's',
  41886. 'T' => 't',
  41887. 'U' => 'u',
  41888. 'V' => 'v',
  41889. 'W' => 'w',
  41890. 'X' => 'x',
  41891. 'Y' => 'y',
  41892. 'Z' => 'z',
  41893. 'À' => 'à',
  41894. '�' => 'á',
  41895. 'Â' => 'â',
  41896. 'Ã' => 'ã',
  41897. 'Ä' => 'ä',
  41898. 'Ã…' => 'Ã¥',
  41899. 'Æ' => 'æ',
  41900. 'Ç' => 'ç',
  41901. 'È' => 'è',
  41902. 'É' => 'é',
  41903. 'Ê' => 'ê',
  41904. 'Ë' => 'ë',
  41905. 'Ì' => 'ì',
  41906. '�' => 'í',
  41907. 'Î' => 'î',
  41908. '�' => 'ï',
  41909. '�' => 'ð',
  41910. 'Ñ' => 'ñ',
  41911. 'Ò' => 'ò',
  41912. 'Ó' => 'ó',
  41913. 'Ô' => 'ô',
  41914. 'Õ' => 'õ',
  41915. 'Ö' => 'ö',
  41916. 'Ø' => 'ø',
  41917. 'Ù' => 'ù',
  41918. 'Ú' => 'ú',
  41919. 'Û' => 'û',
  41920. 'Ü' => 'ü',
  41921. '�' => 'ý',
  41922. 'Þ' => 'þ',
  41923. 'Ā' => '�',
  41924. 'Ă' => 'ă',
  41925. 'Ä„' => 'Ä…',
  41926. 'Ć' => 'ć',
  41927. 'Ĉ' => 'ĉ',
  41928. 'ÄŠ' => 'Ä‹',
  41929. 'Č' => '�',
  41930. 'Ď' => '�',
  41931. '�' => 'đ',
  41932. 'Ä’' => 'Ä“',
  41933. 'Ä”' => 'Ä•',
  41934. 'Ä–' => 'Ä—',
  41935. 'Ę' => 'ę',
  41936. 'Äš' => 'Ä›',
  41937. 'Ĝ' => '�',
  41938. 'Äž' => 'ÄŸ',
  41939. 'Ä ' => 'Ä¡',
  41940. 'Ä¢' => 'Ä£',
  41941. 'Ĥ' => 'ĥ',
  41942. 'Ħ' => 'ħ',
  41943. 'Ĩ' => 'ĩ',
  41944. 'Ī' => 'ī',
  41945. 'Ĭ' => 'ĭ',
  41946. 'Į' => 'į',
  41947. 'Ä°' => 'i',
  41948. 'IJ' => 'ij',
  41949. 'Ĵ' => 'ĵ',
  41950. 'Ķ' => 'ķ',
  41951. 'Ĺ' => 'ĺ',
  41952. 'Ļ' => 'ļ',
  41953. 'Ľ' => 'ľ',
  41954. 'Ä¿' => 'Å€',
  41955. '�' => 'ł',
  41956. 'Ń' => 'ń',
  41957. 'Ņ' => 'ņ',
  41958. 'Ň' => 'ň',
  41959. 'ÅŠ' => 'Å‹',
  41960. 'Ō' => '�',
  41961. 'Ŏ' => '�',
  41962. '�' => 'ő',
  41963. 'Å’' => 'Å“',
  41964. 'Å”' => 'Å•',
  41965. 'Å–' => 'Å—',
  41966. 'Ř' => 'ř',
  41967. 'Åš' => 'Å›',
  41968. 'Ŝ' => '�',
  41969. 'Åž' => 'ÅŸ',
  41970. 'Å ' => 'Å¡',
  41971. 'Å¢' => 'Å£',
  41972. 'Ť' => 'ť',
  41973. 'Ŧ' => 'ŧ',
  41974. 'Ũ' => 'ũ',
  41975. 'Ū' => 'ū',
  41976. 'Ŭ' => 'ŭ',
  41977. 'Ů' => 'ů',
  41978. 'Ű' => 'ű',
  41979. 'Ų' => 'ų',
  41980. 'Ŵ' => 'ŵ',
  41981. 'Ŷ' => 'ŷ',
  41982. 'Ÿ' => 'ÿ',
  41983. 'Ź' => 'ź',
  41984. 'Ż' => 'ż',
  41985. 'Ž' => 'ž',
  41986. '�' => 'ɓ',
  41987. 'Ƃ' => 'ƃ',
  41988. 'Æ„' => 'Æ…',
  41989. 'Ɔ' => 'ɔ',
  41990. 'Ƈ' => 'ƈ',
  41991. 'Ɖ' => 'ɖ',
  41992. 'ÆŠ' => 'É—',
  41993. 'Ƌ' => 'ƌ',
  41994. 'Ǝ' => '�',
  41995. '�' => 'ə',
  41996. '�' => 'ɛ',
  41997. 'Æ‘' => 'Æ’',
  41998. 'Æ“' => 'É ',
  41999. 'Æ”' => 'É£',
  42000. 'Æ–' => 'É©',
  42001. 'Ɨ' => 'ɨ',
  42002. 'Ƙ' => 'ƙ',
  42003. 'Ɯ' => 'ɯ',
  42004. '�' => 'ɲ',
  42005. 'Ɵ' => 'ɵ',
  42006. 'Æ ' => 'Æ¡',
  42007. 'Æ¢' => 'Æ£',
  42008. 'Ƥ' => 'ƥ',
  42009. 'Ʀ' => 'ʀ',
  42010. 'Ƨ' => 'ƨ',
  42011. 'Ʃ' => 'ʃ',
  42012. 'Ƭ' => 'ƭ',
  42013. 'Ʈ' => 'ʈ',
  42014. 'Ư' => 'ư',
  42015. 'Ʊ' => 'ʊ',
  42016. 'Ʋ' => 'ʋ',
  42017. 'Ƴ' => 'ƴ',
  42018. 'Ƶ' => 'ƶ',
  42019. 'Æ·' => 'Ê’',
  42020. 'Ƹ' => 'ƹ',
  42021. 'Ƽ' => 'ƽ',
  42022. 'DŽ' => 'dž',
  42023. 'Dž' => 'dž',
  42024. 'LJ' => 'lj',
  42025. 'Lj' => 'lj',
  42026. 'NJ' => 'nj',
  42027. 'Nj' => 'nj',
  42028. '�' => 'ǎ',
  42029. '�' => '�',
  42030. 'Ç‘' => 'Ç’',
  42031. 'Ç“' => 'Ç”',
  42032. 'Ç•' => 'Ç–',
  42033. 'Ǘ' => 'ǘ',
  42034. 'Ç™' => 'Çš',
  42035. 'Ǜ' => 'ǜ',
  42036. 'Çž' => 'ÇŸ',
  42037. 'Ç ' => 'Ç¡',
  42038. 'Ç¢' => 'Ç£',
  42039. 'Ǥ' => 'ǥ',
  42040. 'Ǧ' => 'ǧ',
  42041. 'Ǩ' => 'ǩ',
  42042. 'Ǫ' => 'ǫ',
  42043. 'Ǭ' => 'ǭ',
  42044. 'Ǯ' => 'ǯ',
  42045. 'DZ' => 'dz',
  42046. 'Dz' => 'dz',
  42047. 'Ǵ' => 'ǵ',
  42048. 'Ƕ' => 'ƕ',
  42049. 'Ç·' => 'Æ¿',
  42050. 'Ǹ' => 'ǹ',
  42051. 'Ǻ' => 'ǻ',
  42052. 'Ǽ' => 'ǽ',
  42053. 'Ǿ' => 'ǿ',
  42054. 'Ȁ' => '�',
  42055. 'Ȃ' => 'ȃ',
  42056. 'È„' => 'È…',
  42057. 'Ȇ' => 'ȇ',
  42058. 'Ȉ' => 'ȉ',
  42059. 'ÈŠ' => 'È‹',
  42060. 'Ȍ' => '�',
  42061. 'Ȏ' => '�',
  42062. '�' => 'ȑ',
  42063. 'È’' => 'È“',
  42064. 'È”' => 'È•',
  42065. 'È–' => 'È—',
  42066. 'Ș' => 'ș',
  42067. 'Èš' => 'È›',
  42068. 'Ȝ' => '�',
  42069. 'Èž' => 'ÈŸ',
  42070. 'È ' => 'Æž',
  42071. 'È¢' => 'È£',
  42072. 'Ȥ' => 'ȥ',
  42073. 'Ȧ' => 'ȧ',
  42074. 'Ȩ' => 'ȩ',
  42075. 'Ȫ' => 'ȫ',
  42076. 'Ȭ' => 'ȭ',
  42077. 'Ȯ' => 'ȯ',
  42078. 'Ȱ' => 'ȱ',
  42079. 'Ȳ' => 'ȳ',
  42080. 'Ⱥ' => 'ⱥ',
  42081. 'Ȼ' => 'ȼ',
  42082. 'Ƚ' => 'ƚ',
  42083. 'Ⱦ' => 'ⱦ',
  42084. '�' => 'ɂ',
  42085. 'Ƀ' => 'ƀ',
  42086. 'Ʉ' => 'ʉ',
  42087. 'Ʌ' => 'ʌ',
  42088. 'Ɇ' => 'ɇ',
  42089. 'Ɉ' => 'ɉ',
  42090. 'ÉŠ' => 'É‹',
  42091. 'Ɍ' => '�',
  42092. 'Ɏ' => '�',
  42093. 'Ͱ' => 'ͱ',
  42094. 'Ͳ' => 'ͳ',
  42095. 'Ͷ' => 'ͷ',
  42096. 'Ϳ' => 'ϳ',
  42097. 'Ά' => 'ά',
  42098. 'Έ' => 'έ',
  42099. 'Ή' => 'ή',
  42100. 'Ί' => 'ί',
  42101. 'Ό' => 'ό',
  42102. 'Ύ' => '�',
  42103. '�' => 'ώ',
  42104. 'Α' => 'α',
  42105. 'Β' => 'β',
  42106. 'Γ' => 'γ',
  42107. 'Δ' => 'δ',
  42108. 'Ε' => 'ε',
  42109. 'Ζ' => 'ζ',
  42110. 'Η' => 'η',
  42111. 'Θ' => 'θ',
  42112. 'Ι' => 'ι',
  42113. 'Κ' => 'κ',
  42114. 'Λ' => 'λ',
  42115. 'Μ' => 'μ',
  42116. '�' => 'ν',
  42117. 'Ξ' => 'ξ',
  42118. 'Ο' => 'ο',
  42119. 'Π' => 'π',
  42120. 'Ρ' => '�',
  42121. 'Σ' => 'σ',
  42122. 'Τ' => 'τ',
  42123. 'Î¥' => 'Ï…',
  42124. 'Φ' => 'φ',
  42125. 'Χ' => 'χ',
  42126. 'Ψ' => 'ψ',
  42127. 'Ω' => 'ω',
  42128. 'Ϊ' => 'ϊ',
  42129. 'Ϋ' => 'ϋ',
  42130. '�' => 'ϗ',
  42131. 'Ϙ' => 'ϙ',
  42132. 'Ïš' => 'Ï›',
  42133. 'Ϝ' => '�',
  42134. 'Ïž' => 'ÏŸ',
  42135. 'Ï ' => 'Ï¡',
  42136. 'Ï¢' => 'Ï£',
  42137. 'Ϥ' => 'ϥ',
  42138. 'Ϧ' => 'ϧ',
  42139. 'Ϩ' => 'ϩ',
  42140. 'Ϫ' => 'ϫ',
  42141. 'Ϭ' => 'ϭ',
  42142. 'Ϯ' => 'ϯ',
  42143. 'ϴ' => 'θ',
  42144. 'Ϸ' => 'ϸ',
  42145. 'Ϲ' => 'ϲ',
  42146. 'Ϻ' => 'ϻ',
  42147. 'Ͻ' => 'ͻ',
  42148. 'Ͼ' => 'ͼ',
  42149. 'Ͽ' => 'ͽ',
  42150. 'Ѐ' => '�',
  42151. '�' => 'ё',
  42152. 'Ђ' => 'ђ',
  42153. 'Ѓ' => 'ѓ',
  42154. 'Є' => 'є',
  42155. 'Ð…' => 'Ñ•',
  42156. 'І' => 'і',
  42157. 'Ї' => 'ї',
  42158. 'Ј' => 'ј',
  42159. 'Љ' => 'љ',
  42160. 'Њ' => 'њ',
  42161. 'Ћ' => 'ћ',
  42162. 'Ќ' => 'ќ',
  42163. '�' => '�',
  42164. 'ÐŽ' => 'Ñž',
  42165. '�' => 'џ',
  42166. '�' => 'а',
  42167. 'Б' => 'б',
  42168. 'В' => 'в',
  42169. 'Г' => 'г',
  42170. 'Д' => 'д',
  42171. 'Е' => 'е',
  42172. 'Ж' => 'ж',
  42173. 'З' => 'з',
  42174. 'И' => 'и',
  42175. 'Й' => 'й',
  42176. 'К' => 'к',
  42177. 'Л' => 'л',
  42178. 'М' => 'м',
  42179. '�' => 'н',
  42180. 'О' => 'о',
  42181. 'П' => 'п',
  42182. 'Р' => 'р',
  42183. 'С' => '�',
  42184. 'Т' => 'т',
  42185. 'У' => 'у',
  42186. 'Ф' => 'ф',
  42187. 'Ð¥' => 'Ñ…',
  42188. 'Ц' => 'ц',
  42189. 'Ч' => 'ч',
  42190. 'Ш' => 'ш',
  42191. 'Щ' => 'щ',
  42192. 'Ъ' => 'ъ',
  42193. 'Ы' => 'ы',
  42194. 'Ь' => 'ь',
  42195. 'Э' => '�',
  42196. 'Ю' => 'ю',
  42197. 'Я' => '�',
  42198. 'Ñ ' => 'Ñ¡',
  42199. 'Ñ¢' => 'Ñ£',
  42200. 'Ѥ' => 'ѥ',
  42201. 'Ѧ' => 'ѧ',
  42202. 'Ѩ' => 'ѩ',
  42203. 'Ѫ' => 'ѫ',
  42204. 'Ѭ' => 'ѭ',
  42205. 'Ѯ' => 'ѯ',
  42206. 'Ѱ' => 'ѱ',
  42207. 'Ѳ' => 'ѳ',
  42208. 'Ѵ' => 'ѵ',
  42209. 'Ѷ' => 'ѷ',
  42210. 'Ѹ' => 'ѹ',
  42211. 'Ѻ' => 'ѻ',
  42212. 'Ѽ' => 'ѽ',
  42213. 'Ѿ' => 'ѿ',
  42214. 'Ò€' => 'Ò�',
  42215. 'ÒŠ' => 'Ò‹',
  42216. 'Ҍ' => '�',
  42217. 'ÒŽ' => 'Ò�',
  42218. 'Ò�' => 'Ò‘',
  42219. 'Ò’' => 'Ò“',
  42220. 'Ò”' => 'Ò•',
  42221. 'Ò–' => 'Ò—',
  42222. 'Ò˜' => 'Ò™',
  42223. 'Òš' => 'Ò›',
  42224. 'Ҝ' => '�',
  42225. 'Òž' => 'ÒŸ',
  42226. 'Ò ' => 'Ò¡',
  42227. 'Ò¢' => 'Ò£',
  42228. 'Ò¤' => 'Ò¥',
  42229. 'Ò¦' => 'Ò§',
  42230. 'Ò¨' => 'Ò©',
  42231. 'Òª' => 'Ò«',
  42232. 'Ò¬' => 'Ò­',
  42233. 'Ò®' => 'Ò¯',
  42234. 'Ò°' => 'Ò±',
  42235. 'Ò²' => 'Ò³',
  42236. 'Ò´' => 'Òµ',
  42237. 'Ò¶' => 'Ò·',
  42238. 'Ò¸' => 'Ò¹',
  42239. 'Òº' => 'Ò»',
  42240. 'Ò¼' => 'Ò½',
  42241. 'Ò¾' => 'Ò¿',
  42242. 'Ó€' => 'Ó�',
  42243. 'Ó�' => 'Ó‚',
  42244. 'Óƒ' => 'Ó„',
  42245. 'Ó…' => 'Ó†',
  42246. 'Ó‡' => 'Óˆ',
  42247. 'Ó‰' => 'ÓŠ',
  42248. 'Ӌ' => 'ӌ',
  42249. 'Ó�' => 'ÓŽ',
  42250. 'Ó�' => 'Ó‘',
  42251. 'Ó’' => 'Ó“',
  42252. 'Ó”' => 'Ó•',
  42253. 'Ó–' => 'Ó—',
  42254. 'Ó˜' => 'Ó™',
  42255. 'Óš' => 'Ó›',
  42256. 'Ӝ' => '�',
  42257. 'Óž' => 'ÓŸ',
  42258. 'Ó ' => 'Ó¡',
  42259. 'Ó¢' => 'Ó£',
  42260. 'Ó¤' => 'Ó¥',
  42261. 'Ó¦' => 'Ó§',
  42262. 'Ó¨' => 'Ó©',
  42263. 'Óª' => 'Ó«',
  42264. 'Ó¬' => 'Ó­',
  42265. 'Ó®' => 'Ó¯',
  42266. 'Ó°' => 'Ó±',
  42267. 'Ó²' => 'Ó³',
  42268. 'Ó´' => 'Óµ',
  42269. 'Ó¶' => 'Ó·',
  42270. 'Ó¸' => 'Ó¹',
  42271. 'Óº' => 'Ó»',
  42272. 'Ó¼' => 'Ó½',
  42273. 'Ó¾' => 'Ó¿',
  42274. 'Ô€' => 'Ô�',
  42275. 'Ô‚' => 'Ôƒ',
  42276. 'Ô„' => 'Ô…',
  42277. 'Ô†' => 'Ô‡',
  42278. 'Ôˆ' => 'Ô‰',
  42279. 'ÔŠ' => 'Ô‹',
  42280. 'Ԍ' => '�',
  42281. 'ÔŽ' => 'Ô�',
  42282. 'Ô�' => 'Ô‘',
  42283. 'Ô’' => 'Ô“',
  42284. 'Ô”' => 'Ô•',
  42285. 'Ô–' => 'Ô—',
  42286. 'Ô˜' => 'Ô™',
  42287. 'Ôš' => 'Ô›',
  42288. 'Ԝ' => '�',
  42289. 'Ôž' => 'ÔŸ',
  42290. 'Ô ' => 'Ô¡',
  42291. 'Ô¢' => 'Ô£',
  42292. 'Ô¤' => 'Ô¥',
  42293. 'Ô¦' => 'Ô§',
  42294. 'Ô¨' => 'Ô©',
  42295. 'Ôª' => 'Ô«',
  42296. 'Ô¬' => 'Ô­',
  42297. 'Ô®' => 'Ô¯',
  42298. 'Ô±' => 'Õ¡',
  42299. 'Ô²' => 'Õ¢',
  42300. 'Ô³' => 'Õ£',
  42301. 'Ô´' => 'Õ¤',
  42302. 'Ôµ' => 'Õ¥',
  42303. 'Ô¶' => 'Õ¦',
  42304. 'Ô·' => 'Õ§',
  42305. 'Ô¸' => 'Õ¨',
  42306. 'Ô¹' => 'Õ©',
  42307. 'Ôº' => 'Õª',
  42308. 'Ô»' => 'Õ«',
  42309. 'Ô¼' => 'Õ¬',
  42310. 'Ô½' => 'Õ­',
  42311. 'Ô¾' => 'Õ®',
  42312. 'Ô¿' => 'Õ¯',
  42313. 'Õ€' => 'Õ°',
  42314. 'Õ�' => 'Õ±',
  42315. 'Õ‚' => 'Õ²',
  42316. 'Õƒ' => 'Õ³',
  42317. 'Õ„' => 'Õ´',
  42318. 'Õ…' => 'Õµ',
  42319. 'Õ†' => 'Õ¶',
  42320. 'Õ‡' => 'Õ·',
  42321. 'Õˆ' => 'Õ¸',
  42322. 'Õ‰' => 'Õ¹',
  42323. 'ÕŠ' => 'Õº',
  42324. 'Õ‹' => 'Õ»',
  42325. 'Ռ' => 'ռ',
  42326. 'Õ�' => 'Õ½',
  42327. 'ÕŽ' => 'Õ¾',
  42328. 'Õ�' => 'Õ¿',
  42329. 'Õ�' => 'Ö€',
  42330. 'Õ‘' => 'Ö�',
  42331. 'Õ’' => 'Ö‚',
  42332. 'Õ“' => 'Öƒ',
  42333. 'Õ”' => 'Ö„',
  42334. 'Õ•' => 'Ö…',
  42335. 'Õ–' => 'Ö†',
  42336. 'á‚ ' => 'â´€',
  42337. 'á‚¡' => 'â´�',
  42338. 'á‚¢' => 'â´‚',
  42339. 'á‚£' => 'â´ƒ',
  42340. 'Ⴄ' => 'ⴄ',
  42341. 'á‚¥' => 'â´…',
  42342. 'Ⴆ' => 'ⴆ',
  42343. 'Ⴇ' => 'ⴇ',
  42344. 'Ⴈ' => 'ⴈ',
  42345. 'á‚©' => 'â´‰',
  42346. 'Ⴊ' => 'ⴊ',
  42347. 'á‚«' => 'â´‹',
  42348. 'Ⴌ' => 'ⴌ',
  42349. 'á‚­' => 'â´�',
  42350. 'á‚®' => 'â´Ž',
  42351. 'Ⴏ' => '�',
  42352. 'á‚°' => 'â´�',
  42353. 'Ⴑ' => 'ⴑ',
  42354. 'Ⴒ' => 'ⴒ',
  42355. 'Ⴓ' => 'ⴓ',
  42356. 'á‚´' => 'â´”',
  42357. 'Ⴕ' => 'ⴕ',
  42358. 'Ⴖ' => 'ⴖ',
  42359. 'á‚·' => 'â´—',
  42360. 'Ⴘ' => 'ⴘ',
  42361. 'Ⴙ' => 'ⴙ',
  42362. 'Ⴚ' => 'ⴚ',
  42363. 'á‚»' => 'â´›',
  42364. 'Ⴜ' => 'ⴜ',
  42365. 'Ⴝ' => '�',
  42366. 'Ⴞ' => 'ⴞ',
  42367. 'á‚¿' => 'â´Ÿ',
  42368. 'Ⴠ' => 'ⴠ',
  42369. '�' => 'ⴡ',
  42370. 'Ⴢ' => 'ⴢ',
  42371. 'Ⴣ' => 'ⴣ',
  42372. 'Ⴤ' => 'ⴤ',
  42373. 'Ⴥ' => 'ⴥ',
  42374. 'Ⴧ' => 'ⴧ',
  42375. '�' => 'ⴭ',
  42376. 'Ḁ' => '�',
  42377. 'Ḃ' => 'ḃ',
  42378. 'Ḅ' => 'ḅ',
  42379. 'Ḇ' => 'ḇ',
  42380. 'Ḉ' => 'ḉ',
  42381. 'Ḋ' => 'ḋ',
  42382. 'Ḍ' => '�',
  42383. 'Ḏ' => '�',
  42384. '�' => 'ḑ',
  42385. 'Ḓ' => 'ḓ',
  42386. 'Ḕ' => 'ḕ',
  42387. 'Ḗ' => 'ḗ',
  42388. 'Ḙ' => 'ḙ',
  42389. 'Ḛ' => 'ḛ',
  42390. 'Ḝ' => '�',
  42391. 'Ḟ' => 'ḟ',
  42392. 'Ḡ' => 'ḡ',
  42393. 'Ḣ' => 'ḣ',
  42394. 'Ḥ' => 'ḥ',
  42395. 'Ḧ' => 'ḧ',
  42396. 'Ḩ' => 'ḩ',
  42397. 'Ḫ' => 'ḫ',
  42398. 'Ḭ' => 'ḭ',
  42399. 'Ḯ' => 'ḯ',
  42400. 'Ḱ' => 'ḱ',
  42401. 'Ḳ' => 'ḳ',
  42402. 'Ḵ' => 'ḵ',
  42403. 'Ḷ' => 'ḷ',
  42404. 'Ḹ' => 'ḹ',
  42405. 'Ḻ' => 'ḻ',
  42406. 'Ḽ' => 'ḽ',
  42407. 'Ḿ' => 'ḿ',
  42408. 'Ṁ' => '�',
  42409. 'Ṃ' => 'ṃ',
  42410. 'Ṅ' => 'ṅ',
  42411. 'Ṇ' => 'ṇ',
  42412. 'Ṉ' => 'ṉ',
  42413. 'Ṋ' => 'ṋ',
  42414. 'Ṍ' => '�',
  42415. 'Ṏ' => '�',
  42416. '�' => 'ṑ',
  42417. 'Ṓ' => 'ṓ',
  42418. 'Ṕ' => 'ṕ',
  42419. 'á¹–' => 'á¹—',
  42420. 'Ṙ' => 'ṙ',
  42421. 'Ṛ' => 'ṛ',
  42422. 'Ṝ' => '�',
  42423. 'Ṟ' => 'ṟ',
  42424. 'Ṡ' => 'ṡ',
  42425. 'á¹¢' => 'á¹£',
  42426. 'Ṥ' => 'ṥ',
  42427. 'Ṧ' => 'ṧ',
  42428. 'Ṩ' => 'ṩ',
  42429. 'Ṫ' => 'ṫ',
  42430. 'Ṭ' => 'ṭ',
  42431. 'Ṯ' => 'ṯ',
  42432. 'á¹°' => 'á¹±',
  42433. 'á¹²' => 'á¹³',
  42434. 'á¹´' => 'á¹µ',
  42435. 'Ṷ' => 'ṷ',
  42436. 'Ṹ' => 'ṹ',
  42437. 'Ṻ' => 'ṻ',
  42438. 'á¹¼' => 'á¹½',
  42439. 'Ṿ' => 'ṿ',
  42440. 'Ẁ' => '�',
  42441. 'Ẃ' => 'ẃ',
  42442. 'Ẅ' => 'ẅ',
  42443. 'Ẇ' => 'ẇ',
  42444. 'Ẉ' => 'ẉ',
  42445. 'Ẋ' => 'ẋ',
  42446. 'Ẍ' => '�',
  42447. 'Ẏ' => '�',
  42448. '�' => 'ẑ',
  42449. 'Ẓ' => 'ẓ',
  42450. 'Ẕ' => 'ẕ',
  42451. 'ẞ' => 'ß',
  42452. 'Ạ' => 'ạ',
  42453. 'Ả' => 'ả',
  42454. 'Ấ' => 'ấ',
  42455. 'Ầ' => 'ầ',
  42456. 'Ẩ' => 'ẩ',
  42457. 'Ẫ' => 'ẫ',
  42458. 'Ậ' => 'ậ',
  42459. 'Ắ' => 'ắ',
  42460. 'Ằ' => 'ằ',
  42461. 'Ẳ' => 'ẳ',
  42462. 'Ẵ' => 'ẵ',
  42463. 'Ặ' => 'ặ',
  42464. 'Ẹ' => 'ẹ',
  42465. 'Ẻ' => 'ẻ',
  42466. 'Ẽ' => 'ẽ',
  42467. 'Ế' => 'ế',
  42468. 'Ề' => '�',
  42469. 'Ể' => 'ể',
  42470. 'Ễ' => 'ễ',
  42471. 'Ệ' => 'ệ',
  42472. 'Ỉ' => 'ỉ',
  42473. 'Ị' => 'ị',
  42474. 'Ọ' => '�',
  42475. 'Ỏ' => '�',
  42476. '�' => 'ố',
  42477. 'Ồ' => 'ồ',
  42478. 'Ổ' => 'ổ',
  42479. 'á»–' => 'á»—',
  42480. 'Ộ' => 'ộ',
  42481. 'Ớ' => 'ớ',
  42482. 'Ờ' => '�',
  42483. 'Ở' => 'ở',
  42484. 'Ỡ' => 'ỡ',
  42485. 'Ợ' => 'ợ',
  42486. 'Ụ' => 'ụ',
  42487. 'Ủ' => 'ủ',
  42488. 'Ứ' => 'ứ',
  42489. 'Ừ' => 'ừ',
  42490. 'Ử' => 'ử',
  42491. 'Ữ' => 'ữ',
  42492. 'á»°' => 'á»±',
  42493. 'Ỳ' => 'ỳ',
  42494. 'Ỵ' => 'ỵ',
  42495. 'Ỷ' => 'ỷ',
  42496. 'Ỹ' => 'ỹ',
  42497. 'Ỻ' => 'ỻ',
  42498. 'Ỽ' => 'ỽ',
  42499. 'Ỿ' => 'ỿ',
  42500. 'Ἀ' => 'ἀ',
  42501. 'Ἁ' => '�',
  42502. 'Ἂ' => 'ἂ',
  42503. 'Ἃ' => 'ἃ',
  42504. 'Ἄ' => 'ἄ',
  42505. '�' => 'ἅ',
  42506. 'Ἆ' => 'ἆ',
  42507. '�' => 'ἇ',
  42508. 'Ἐ' => '�',
  42509. 'Ἑ' => 'ἑ',
  42510. 'Ἒ' => 'ἒ',
  42511. 'Ἓ' => 'ἓ',
  42512. 'Ἔ' => 'ἔ',
  42513. '�' => 'ἕ',
  42514. 'Ἠ' => 'ἠ',
  42515. 'Ἡ' => 'ἡ',
  42516. 'Ἢ' => 'ἢ',
  42517. 'Ἣ' => 'ἣ',
  42518. 'Ἤ' => 'ἤ',
  42519. 'á¼­' => 'á¼¥',
  42520. 'Ἦ' => 'ἦ',
  42521. 'Ἧ' => 'ἧ',
  42522. 'Ἰ' => 'ἰ',
  42523. 'á¼¹' => 'á¼±',
  42524. 'Ἲ' => 'ἲ',
  42525. 'á¼»' => 'á¼³',
  42526. 'á¼¼' => 'á¼´',
  42527. 'á¼½' => 'á¼µ',
  42528. 'Ἶ' => 'ἶ',
  42529. 'Ἷ' => 'ἷ',
  42530. 'Ὀ' => 'ὀ',
  42531. 'Ὁ' => '�',
  42532. 'Ὂ' => 'ὂ',
  42533. 'Ὃ' => 'ὃ',
  42534. 'Ὄ' => 'ὄ',
  42535. '�' => 'ὅ',
  42536. 'Ὑ' => 'ὑ',
  42537. 'Ὓ' => 'ὓ',
  42538. '�' => 'ὕ',
  42539. 'Ὗ' => 'ὗ',
  42540. 'Ὠ' => 'ὠ',
  42541. 'Ὡ' => 'ὡ',
  42542. 'Ὢ' => 'ὢ',
  42543. 'Ὣ' => 'ὣ',
  42544. 'Ὤ' => 'ὤ',
  42545. 'á½­' => 'á½¥',
  42546. 'Ὦ' => 'ὦ',
  42547. 'Ὧ' => 'ὧ',
  42548. 'ᾈ' => 'ᾀ',
  42549. 'ᾉ' => '�',
  42550. 'ᾊ' => 'ᾂ',
  42551. 'ᾋ' => 'ᾃ',
  42552. 'ᾌ' => 'ᾄ',
  42553. '�' => 'ᾅ',
  42554. 'ᾎ' => 'ᾆ',
  42555. '�' => 'ᾇ',
  42556. 'ᾘ' => '�',
  42557. 'ᾙ' => 'ᾑ',
  42558. 'ᾚ' => 'ᾒ',
  42559. 'ᾛ' => 'ᾓ',
  42560. 'ᾜ' => 'ᾔ',
  42561. '�' => 'ᾕ',
  42562. 'ᾞ' => 'ᾖ',
  42563. 'ᾟ' => 'ᾗ',
  42564. 'ᾨ' => 'ᾠ',
  42565. 'ᾩ' => 'ᾡ',
  42566. 'ᾪ' => 'ᾢ',
  42567. 'ᾫ' => 'ᾣ',
  42568. 'ᾬ' => 'ᾤ',
  42569. 'á¾­' => 'á¾¥',
  42570. 'ᾮ' => 'ᾦ',
  42571. 'ᾯ' => 'ᾧ',
  42572. 'Ᾰ' => 'ᾰ',
  42573. 'á¾¹' => 'á¾±',
  42574. 'Ὰ' => 'ὰ',
  42575. 'á¾»' => 'á½±',
  42576. 'á¾¼' => 'á¾³',
  42577. 'Ὲ' => 'ὲ',
  42578. 'Έ' => 'έ',
  42579. 'á¿Š' => 'á½´',
  42580. 'á¿‹' => 'á½µ',
  42581. 'ῌ' => 'ῃ',
  42582. 'Ῐ' => '�',
  42583. 'á¿™' => 'á¿‘',
  42584. 'Ὶ' => 'ὶ',
  42585. 'á¿›' => 'á½·',
  42586. 'Ῠ' => 'ῠ',
  42587. 'á¿©' => 'á¿¡',
  42588. 'Ὺ' => 'ὺ',
  42589. 'á¿«' => 'á½»',
  42590. 'Ῥ' => 'ῥ',
  42591. 'Ὸ' => 'ὸ',
  42592. 'Ό' => 'ό',
  42593. 'Ὼ' => 'ὼ',
  42594. 'á¿»' => 'á½½',
  42595. 'ῼ' => 'ῳ',
  42596. 'Ω' => 'ω',
  42597. 'K' => 'k',
  42598. 'â„«' => 'Ã¥',
  42599. 'Ⅎ' => 'ⅎ',
  42600. 'â… ' => 'â…°',
  42601. 'â…¡' => 'â…±',
  42602. 'â…¢' => 'â…²',
  42603. 'â…£' => 'â…³',
  42604. 'â…¤' => 'â…´',
  42605. 'â…¥' => 'â…µ',
  42606. 'â…¦' => 'â…¶',
  42607. 'â…§' => 'â…·',
  42608. 'â…¨' => 'â…¸',
  42609. 'â…©' => 'â…¹',
  42610. 'â…ª' => 'â…º',
  42611. 'â…«' => 'â…»',
  42612. 'â…¬' => 'â…¼',
  42613. 'â…­' => 'â…½',
  42614. 'â…®' => 'â…¾',
  42615. 'â…¯' => 'â…¿',
  42616. 'Ↄ' => 'ↄ',
  42617. 'Ⓐ' => '�',
  42618. 'â’·' => 'â“‘',
  42619. 'â’¸' => 'â“’',
  42620. 'â’¹' => 'â““',
  42621. 'â’º' => 'â“”',
  42622. 'â’»' => 'â“•',
  42623. 'â’¼' => 'â“–',
  42624. 'â’½' => 'â“—',
  42625. 'Ⓘ' => 'ⓘ',
  42626. 'â’¿' => 'â“™',
  42627. 'â“€' => 'â“š',
  42628. '�' => 'ⓛ',
  42629. 'Ⓜ' => 'ⓜ',
  42630. 'Ⓝ' => '�',
  42631. 'â“„' => 'â“ž',
  42632. 'â“…' => 'â“Ÿ',
  42633. 'Ⓠ' => 'ⓠ',
  42634. 'Ⓡ' => 'ⓡ',
  42635. 'Ⓢ' => 'ⓢ',
  42636. 'Ⓣ' => 'ⓣ',
  42637. 'Ⓤ' => 'ⓤ',
  42638. 'â“‹' => 'â“¥',
  42639. 'Ⓦ' => 'ⓦ',
  42640. '�' => 'ⓧ',
  42641. 'Ⓨ' => 'ⓨ',
  42642. '�' => 'ⓩ',
  42643. 'â°€' => 'â°°',
  42644. 'â°�' => 'â°±',
  42645. 'â°‚' => 'â°²',
  42646. 'â°ƒ' => 'â°³',
  42647. 'â°„' => 'â°´',
  42648. 'â°…' => 'â°µ',
  42649. 'â°†' => 'â°¶',
  42650. 'â°‡' => 'â°·',
  42651. 'â°ˆ' => 'â°¸',
  42652. 'â°‰' => 'â°¹',
  42653. 'â°Š' => 'â°º',
  42654. 'â°‹' => 'â°»',
  42655. 'Ⰼ' => 'ⰼ',
  42656. 'â°�' => 'â°½',
  42657. 'â°Ž' => 'â°¾',
  42658. 'â°�' => 'â°¿',
  42659. 'â°�' => 'â±€',
  42660. 'Ⱁ' => '�',
  42661. 'Ⱂ' => 'ⱂ',
  42662. 'Ⱃ' => 'ⱃ',
  42663. 'Ⱄ' => 'ⱄ',
  42664. 'â°•' => 'â±…',
  42665. 'Ⱆ' => 'ⱆ',
  42666. 'Ⱇ' => 'ⱇ',
  42667. 'Ⱈ' => 'ⱈ',
  42668. 'Ⱉ' => 'ⱉ',
  42669. 'Ⱊ' => 'ⱊ',
  42670. 'Ⱋ' => 'ⱋ',
  42671. 'Ⱌ' => 'ⱌ',
  42672. '�' => '�',
  42673. 'Ⱎ' => 'ⱎ',
  42674. 'Ⱏ' => '�',
  42675. 'Ⱐ' => '�',
  42676. 'Ⱑ' => 'ⱑ',
  42677. 'â°¢' => 'â±’',
  42678. 'Ⱓ' => 'ⱓ',
  42679. 'â°¤' => 'â±”',
  42680. 'Ⱕ' => 'ⱕ',
  42681. 'â°¦' => 'â±–',
  42682. 'â°§' => 'â±—',
  42683. 'Ⱘ' => 'ⱘ',
  42684. 'â°©' => 'â±™',
  42685. 'Ⱚ' => 'ⱚ',
  42686. 'â°«' => 'â±›',
  42687. 'Ⱜ' => 'ⱜ',
  42688. 'Ⱝ' => '�',
  42689. 'Ⱞ' => 'ⱞ',
  42690. 'Ⱡ' => 'ⱡ',
  42691. 'â±¢' => 'É«',
  42692. 'â±£' => 'áµ½',
  42693. 'Ɽ' => 'ɽ',
  42694. 'Ⱨ' => 'ⱨ',
  42695. 'Ⱪ' => 'ⱪ',
  42696. 'Ⱬ' => 'ⱬ',
  42697. 'â±­' => 'É‘',
  42698. 'Ɱ' => 'ɱ',
  42699. 'Ɐ' => '�',
  42700. 'â±°' => 'É’',
  42701. 'â±²' => 'â±³',
  42702. 'Ⱶ' => 'ⱶ',
  42703. 'â±¾' => 'È¿',
  42704. 'Ɀ' => 'ɀ',
  42705. 'Ⲁ' => '�',
  42706. 'Ⲃ' => 'ⲃ',
  42707. 'Ⲅ' => 'ⲅ',
  42708. 'Ⲇ' => 'ⲇ',
  42709. 'Ⲉ' => 'ⲉ',
  42710. 'Ⲋ' => 'ⲋ',
  42711. 'Ⲍ' => '�',
  42712. 'Ⲏ' => '�',
  42713. '�' => 'ⲑ',
  42714. 'Ⲓ' => 'ⲓ',
  42715. 'Ⲕ' => 'ⲕ',
  42716. 'â²–' => 'â²—',
  42717. 'Ⲙ' => 'ⲙ',
  42718. 'Ⲛ' => 'ⲛ',
  42719. 'Ⲝ' => '�',
  42720. 'Ⲟ' => 'ⲟ',
  42721. 'Ⲡ' => 'ⲡ',
  42722. 'â²¢' => 'â²£',
  42723. 'Ⲥ' => 'ⲥ',
  42724. 'Ⲧ' => 'ⲧ',
  42725. 'Ⲩ' => 'ⲩ',
  42726. 'Ⲫ' => 'ⲫ',
  42727. 'Ⲭ' => 'ⲭ',
  42728. 'Ⲯ' => 'ⲯ',
  42729. 'â²°' => 'â²±',
  42730. 'â²²' => 'â²³',
  42731. 'â²´' => 'â²µ',
  42732. 'Ⲷ' => 'ⲷ',
  42733. 'Ⲹ' => 'ⲹ',
  42734. 'Ⲻ' => 'ⲻ',
  42735. 'â²¼' => 'â²½',
  42736. 'Ⲿ' => 'ⲿ',
  42737. 'Ⳁ' => '�',
  42738. 'Ⳃ' => 'ⳃ',
  42739. 'Ⳅ' => 'ⳅ',
  42740. 'Ⳇ' => 'ⳇ',
  42741. 'Ⳉ' => 'ⳉ',
  42742. 'Ⳋ' => 'ⳋ',
  42743. 'Ⳍ' => '�',
  42744. 'Ⳏ' => '�',
  42745. '�' => 'ⳑ',
  42746. 'Ⳓ' => 'ⳓ',
  42747. 'Ⳕ' => 'ⳕ',
  42748. 'â³–' => 'â³—',
  42749. 'Ⳙ' => 'ⳙ',
  42750. 'Ⳛ' => 'ⳛ',
  42751. 'Ⳝ' => '�',
  42752. 'Ⳟ' => 'ⳟ',
  42753. 'Ⳡ' => 'ⳡ',
  42754. 'â³¢' => 'â³£',
  42755. 'Ⳬ' => 'ⳬ',
  42756. 'â³­' => 'â³®',
  42757. 'â³²' => 'â³³',
  42758. 'Ꙁ' => '�',
  42759. 'Ꙃ' => 'ꙃ',
  42760. 'Ꙅ' => 'ꙅ',
  42761. 'Ꙇ' => 'ꙇ',
  42762. 'Ꙉ' => 'ꙉ',
  42763. 'Ꙋ' => 'ꙋ',
  42764. 'Ꙍ' => '�',
  42765. 'Ꙏ' => '�',
  42766. '�' => 'ꙑ',
  42767. 'Ꙓ' => 'ꙓ',
  42768. 'Ꙕ' => 'ꙕ',
  42769. 'ê™–' => 'ê™—',
  42770. 'Ꙙ' => 'ꙙ',
  42771. 'Ꙛ' => 'ꙛ',
  42772. 'Ꙝ' => '�',
  42773. 'Ꙟ' => 'ꙟ',
  42774. 'Ꙡ' => 'ꙡ',
  42775. 'Ꙣ' => 'ꙣ',
  42776. 'Ꙥ' => 'ꙥ',
  42777. 'Ꙧ' => 'ꙧ',
  42778. 'Ꙩ' => 'ꙩ',
  42779. 'Ꙫ' => 'ꙫ',
  42780. 'Ꙭ' => 'ꙭ',
  42781. 'Ꚁ' => '�',
  42782. 'Ꚃ' => 'ꚃ',
  42783. 'êš„' => 'êš…',
  42784. 'Ꚇ' => 'ꚇ',
  42785. 'Ꚉ' => 'ꚉ',
  42786. 'Ꚋ' => 'ꚋ',
  42787. 'Ꚍ' => '�',
  42788. 'Ꚏ' => '�',
  42789. '�' => 'ꚑ',
  42790. 'êš’' => 'êš“',
  42791. 'êš”' => 'êš•',
  42792. 'êš–' => 'êš—',
  42793. 'Ꚙ' => 'ꚙ',
  42794. 'êšš' => 'êš›',
  42795. 'Ꜣ' => 'ꜣ',
  42796. 'Ꜥ' => 'ꜥ',
  42797. 'Ꜧ' => 'ꜧ',
  42798. 'Ꜩ' => 'ꜩ',
  42799. 'Ꜫ' => 'ꜫ',
  42800. 'Ꜭ' => 'ꜭ',
  42801. 'Ꜯ' => 'ꜯ',
  42802. 'Ꜳ' => 'ꜳ',
  42803. 'Ꜵ' => 'ꜵ',
  42804. 'Ꜷ' => 'ꜷ',
  42805. 'Ꜹ' => 'ꜹ',
  42806. 'Ꜻ' => 'ꜻ',
  42807. 'Ꜽ' => 'ꜽ',
  42808. 'Ꜿ' => 'ꜿ',
  42809. '�' => '�',
  42810. '�' => '�',
  42811. '�' => '�',
  42812. '�' => '�',
  42813. '�' => '�',
  42814. '�' => '�',
  42815. '�' => '�',
  42816. '�' => '�',
  42817. '�' => '�',
  42818. '�' => '�',
  42819. '�' => '�',
  42820. '�' => '�',
  42821. '�' => '�',
  42822. '�' => '�',
  42823. '�' => '�',
  42824. '�' => '�',
  42825. '�' => '�',
  42826. '�' => '�',
  42827. '�' => '�',
  42828. '�' => '�',
  42829. '�' => '�',
  42830. '�' => '�',
  42831. '�' => '�',
  42832. '�' => '�',
  42833. '�' => '�',
  42834. '�' => '�',
  42835. '�' => 'ᵹ',
  42836. '�' => '�',
  42837. 'Ꞁ' => '�',
  42838. 'Ꞃ' => 'ꞃ',
  42839. 'êž„' => 'êž…',
  42840. 'Ꞇ' => 'ꞇ',
  42841. 'Ꞌ' => 'ꞌ',
  42842. '�' => 'ɥ',
  42843. '�' => 'ꞑ',
  42844. 'êž’' => 'êž“',
  42845. 'êž–' => 'êž—',
  42846. 'Ꞙ' => 'ꞙ',
  42847. 'êžš' => 'êž›',
  42848. 'Ꞝ' => '�',
  42849. 'Ꞟ' => 'ꞟ',
  42850. 'êž ' => 'êž¡',
  42851. 'Ꞣ' => 'ꞣ',
  42852. 'Ꞥ' => 'ꞥ',
  42853. 'Ꞧ' => 'ꞧ',
  42854. 'Ꞩ' => 'ꞩ',
  42855. 'Ɦ' => 'ɦ',
  42856. 'Ɜ' => 'ɜ',
  42857. 'Ɡ' => 'ɡ',
  42858. 'Ɬ' => 'ɬ',
  42859. 'êž°' => 'Êž',
  42860. 'Ʇ' => 'ʇ',
  42861. 'A' => '�',
  42862. 'B' => 'b',
  42863. 'C' => 'c',
  42864. 'D' => 'd',
  42865. 'ï¼¥' => 'ï½…',
  42866. 'F' => 'f',
  42867. 'G' => 'g',
  42868. 'H' => 'h',
  42869. 'I' => 'i',
  42870. 'J' => 'j',
  42871. 'K' => 'k',
  42872. 'L' => 'l',
  42873. 'M' => '�',
  42874. 'N' => 'n',
  42875. 'O' => '�',
  42876. 'P' => '�',
  42877. 'Q' => 'q',
  42878. 'ï¼²' => 'ï½’',
  42879. 'S' => 's',
  42880. 'ï¼´' => 'ï½”',
  42881. 'U' => 'u',
  42882. 'V' => 'v',
  42883. 'ï¼·' => 'ï½—',
  42884. 'X' => 'x',
  42885. 'ï¼¹' => 'ï½™',
  42886. 'Z' => 'z',
  42887. '�' => '�',
  42888. '�' => '�',
  42889. '�' => '�',
  42890. '�' => '�',
  42891. '�' => '�',
  42892. '�' => '�',
  42893. '�' => '�',
  42894. '�' => '�',
  42895. '�' => '�',
  42896. '�' => '�',
  42897. '�' => '�',
  42898. '�' => '�',
  42899. '�' => '�',
  42900. '�' => '�',
  42901. '�' => '�',
  42902. '�' => '�',
  42903. '�' => '�',
  42904. '�' => '�',
  42905. '�' => '�',
  42906. '�' => '�',
  42907. '�' => '�',
  42908. '�' => '�',
  42909. '�' => '�',
  42910. '�' => '�',
  42911. '�' => '�',
  42912. '�' => '�',
  42913. '�' => '�',
  42914. '�' => '�',
  42915. '�' => '�',
  42916. '�' => '�',
  42917. '�' => '�',
  42918. '�' => '�',
  42919. '�' => '�',
  42920. '�' => '�',
  42921. '�' => '�',
  42922. '�' => '�',
  42923. '�' => '�',
  42924. '�' => '�',
  42925. '�' => '�',
  42926. '�' => '�',
  42927. 'ð‘¢ ' => 'ð‘£€',
  42928. '𑢡' => '�',
  42929. '𑢢' => '𑣂',
  42930. '𑢣' => '𑣃',
  42931. '𑢤' => '𑣄',
  42932. 'ð‘¢¥' => 'ð‘£…',
  42933. '𑢦' => '𑣆',
  42934. '𑢧' => '𑣇',
  42935. '𑢨' => '𑣈',
  42936. '𑢩' => '𑣉',
  42937. '𑢪' => '𑣊',
  42938. '𑢫' => '𑣋',
  42939. '𑢬' => '𑣌',
  42940. '𑢭' => '�',
  42941. '𑢮' => '𑣎',
  42942. '𑢯' => '�',
  42943. '𑢰' => '�',
  42944. '𑢱' => '𑣑',
  42945. 'ð‘¢²' => 'ð‘£’',
  42946. '𑢳' => '𑣓',
  42947. 'ð‘¢´' => 'ð‘£”',
  42948. '𑢵' => '𑣕',
  42949. '𑢶' => '𑣖',
  42950. 'ð‘¢·' => 'ð‘£—',
  42951. '𑢸' => '𑣘',
  42952. 'ð‘¢¹' => 'ð‘£™',
  42953. '𑢺' => '𑣚',
  42954. 'ð‘¢»' => 'ð‘£›',
  42955. '𑢼' => '𑣜',
  42956. '𑢽' => '�',
  42957. '𑢾' => '𑣞',
  42958. '𑢿' => '𑣟',
  42959. );
  42960. $result =& $data;
  42961. unset($data);
  42962. return $result;
  42963. <?php
  42964. static $data = array (
  42965. 'a' => 'A',
  42966. 'b' => 'B',
  42967. 'c' => 'C',
  42968. 'd' => 'D',
  42969. 'e' => 'E',
  42970. 'f' => 'F',
  42971. 'g' => 'G',
  42972. 'h' => 'H',
  42973. 'i' => 'I',
  42974. 'j' => 'J',
  42975. 'k' => 'K',
  42976. 'l' => 'L',
  42977. 'm' => 'M',
  42978. 'n' => 'N',
  42979. 'o' => 'O',
  42980. 'p' => 'P',
  42981. 'q' => 'Q',
  42982. 'r' => 'R',
  42983. 's' => 'S',
  42984. 't' => 'T',
  42985. 'u' => 'U',
  42986. 'v' => 'V',
  42987. 'w' => 'W',
  42988. 'x' => 'X',
  42989. 'y' => 'Y',
  42990. 'z' => 'Z',
  42991. 'µ' => 'Μ',
  42992. 'à' => 'À',
  42993. 'á' => '�',
  42994. 'â' => 'Â',
  42995. 'ã' => 'Ã',
  42996. 'ä' => 'Ä',
  42997. 'Ã¥' => 'Ã…',
  42998. 'æ' => 'Æ',
  42999. 'ç' => 'Ç',
  43000. 'è' => 'È',
  43001. 'é' => 'É',
  43002. 'ê' => 'Ê',
  43003. 'ë' => 'Ë',
  43004. 'ì' => 'Ì',
  43005. 'í' => '�',
  43006. 'î' => 'Î',
  43007. 'ï' => '�',
  43008. 'ð' => '�',
  43009. 'ñ' => 'Ñ',
  43010. 'ò' => 'Ò',
  43011. 'ó' => 'Ó',
  43012. 'ô' => 'Ô',
  43013. 'õ' => 'Õ',
  43014. 'ö' => 'Ö',
  43015. 'ø' => 'Ø',
  43016. 'ù' => 'Ù',
  43017. 'ú' => 'Ú',
  43018. 'û' => 'Û',
  43019. 'ü' => 'Ü',
  43020. 'ý' => '�',
  43021. 'þ' => 'Þ',
  43022. 'ÿ' => 'Ÿ',
  43023. '�' => 'Ā',
  43024. 'ă' => 'Ă',
  43025. 'Ä…' => 'Ä„',
  43026. 'ć' => 'Ć',
  43027. 'ĉ' => 'Ĉ',
  43028. 'Ä‹' => 'ÄŠ',
  43029. '�' => 'Č',
  43030. '�' => 'Ď',
  43031. 'đ' => '�',
  43032. 'Ä“' => 'Ä’',
  43033. 'Ä•' => 'Ä”',
  43034. 'Ä—' => 'Ä–',
  43035. 'ę' => 'Ę',
  43036. 'Ä›' => 'Äš',
  43037. '�' => 'Ĝ',
  43038. 'ÄŸ' => 'Äž',
  43039. 'Ä¡' => 'Ä ',
  43040. 'Ä£' => 'Ä¢',
  43041. 'ĥ' => 'Ĥ',
  43042. 'ħ' => 'Ħ',
  43043. 'ĩ' => 'Ĩ',
  43044. 'ī' => 'Ī',
  43045. 'ĭ' => 'Ĭ',
  43046. 'į' => 'Į',
  43047. 'ı' => 'I',
  43048. 'ij' => 'IJ',
  43049. 'ĵ' => 'Ĵ',
  43050. 'ķ' => 'Ķ',
  43051. 'ĺ' => 'Ĺ',
  43052. 'ļ' => 'Ļ',
  43053. 'ľ' => 'Ľ',
  43054. 'Å€' => 'Ä¿',
  43055. 'ł' => '�',
  43056. 'ń' => 'Ń',
  43057. 'ņ' => 'Ņ',
  43058. 'ň' => 'Ň',
  43059. 'Å‹' => 'ÅŠ',
  43060. '�' => 'Ō',
  43061. '�' => 'Ŏ',
  43062. 'ő' => '�',
  43063. 'Å“' => 'Å’',
  43064. 'Å•' => 'Å”',
  43065. 'Å—' => 'Å–',
  43066. 'ř' => 'Ř',
  43067. 'Å›' => 'Åš',
  43068. '�' => 'Ŝ',
  43069. 'ÅŸ' => 'Åž',
  43070. 'Å¡' => 'Å ',
  43071. 'Å£' => 'Å¢',
  43072. 'ť' => 'Ť',
  43073. 'ŧ' => 'Ŧ',
  43074. 'ũ' => 'Ũ',
  43075. 'ū' => 'Ū',
  43076. 'ŭ' => 'Ŭ',
  43077. 'ů' => 'Ů',
  43078. 'ű' => 'Ű',
  43079. 'ų' => 'Ų',
  43080. 'ŵ' => 'Ŵ',
  43081. 'ŷ' => 'Ŷ',
  43082. 'ź' => 'Ź',
  43083. 'ż' => 'Ż',
  43084. 'ž' => 'Ž',
  43085. 'Å¿' => 'S',
  43086. 'ƀ' => 'Ƀ',
  43087. 'ƃ' => 'Ƃ',
  43088. 'Æ…' => 'Æ„',
  43089. 'ƈ' => 'Ƈ',
  43090. 'ƌ' => 'Ƌ',
  43091. 'Æ’' => 'Æ‘',
  43092. 'ƕ' => 'Ƕ',
  43093. 'ƙ' => 'Ƙ',
  43094. 'ƚ' => 'Ƚ',
  43095. 'Æž' => 'È ',
  43096. 'Æ¡' => 'Æ ',
  43097. 'Æ£' => 'Æ¢',
  43098. 'ƥ' => 'Ƥ',
  43099. 'ƨ' => 'Ƨ',
  43100. 'ƭ' => 'Ƭ',
  43101. 'ư' => 'Ư',
  43102. 'ƴ' => 'Ƴ',
  43103. 'ƶ' => 'Ƶ',
  43104. 'ƹ' => 'Ƹ',
  43105. 'ƽ' => 'Ƽ',
  43106. 'Æ¿' => 'Ç·',
  43107. 'Ç…' => 'Ç„',
  43108. 'dž' => 'DŽ',
  43109. 'Lj' => 'LJ',
  43110. 'lj' => 'LJ',
  43111. 'Ç‹' => 'ÇŠ',
  43112. 'nj' => 'NJ',
  43113. 'ǎ' => '�',
  43114. '�' => '�',
  43115. 'Ç’' => 'Ç‘',
  43116. 'Ç”' => 'Ç“',
  43117. 'Ç–' => 'Ç•',
  43118. 'ǘ' => 'Ǘ',
  43119. 'Çš' => 'Ç™',
  43120. 'ǜ' => 'Ǜ',
  43121. '�' => 'Ǝ',
  43122. 'ÇŸ' => 'Çž',
  43123. 'Ç¡' => 'Ç ',
  43124. 'Ç£' => 'Ç¢',
  43125. 'ǥ' => 'Ǥ',
  43126. 'ǧ' => 'Ǧ',
  43127. 'ǩ' => 'Ǩ',
  43128. 'ǫ' => 'Ǫ',
  43129. 'ǭ' => 'Ǭ',
  43130. 'ǯ' => 'Ǯ',
  43131. 'Dz' => 'DZ',
  43132. 'dz' => 'DZ',
  43133. 'ǵ' => 'Ǵ',
  43134. 'ǹ' => 'Ǹ',
  43135. 'ǻ' => 'Ǻ',
  43136. 'ǽ' => 'Ǽ',
  43137. 'ǿ' => 'Ǿ',
  43138. '�' => 'Ȁ',
  43139. 'ȃ' => 'Ȃ',
  43140. 'È…' => 'È„',
  43141. 'ȇ' => 'Ȇ',
  43142. 'ȉ' => 'Ȉ',
  43143. 'È‹' => 'ÈŠ',
  43144. '�' => 'Ȍ',
  43145. '�' => 'Ȏ',
  43146. 'ȑ' => '�',
  43147. 'È“' => 'È’',
  43148. 'È•' => 'È”',
  43149. 'È—' => 'È–',
  43150. 'ș' => 'Ș',
  43151. 'È›' => 'Èš',
  43152. '�' => 'Ȝ',
  43153. 'ÈŸ' => 'Èž',
  43154. 'È£' => 'È¢',
  43155. 'ȥ' => 'Ȥ',
  43156. 'ȧ' => 'Ȧ',
  43157. 'ȩ' => 'Ȩ',
  43158. 'ȫ' => 'Ȫ',
  43159. 'ȭ' => 'Ȭ',
  43160. 'ȯ' => 'Ȯ',
  43161. 'ȱ' => 'Ȱ',
  43162. 'ȳ' => 'Ȳ',
  43163. 'ȼ' => 'Ȼ',
  43164. 'È¿' => 'â±¾',
  43165. 'ɀ' => 'Ɀ',
  43166. 'ɂ' => '�',
  43167. 'ɇ' => 'Ɇ',
  43168. 'ɉ' => 'Ɉ',
  43169. 'É‹' => 'ÉŠ',
  43170. '�' => 'Ɍ',
  43171. '�' => 'Ɏ',
  43172. '�' => 'Ɐ',
  43173. 'É‘' => 'â±­',
  43174. 'É’' => 'â±°',
  43175. 'ɓ' => '�',
  43176. 'ɔ' => 'Ɔ',
  43177. 'ɖ' => 'Ɖ',
  43178. 'É—' => 'ÆŠ',
  43179. 'ə' => '�',
  43180. 'ɛ' => '�',
  43181. 'ɜ' => 'Ɜ',
  43182. 'É ' => 'Æ“',
  43183. 'ɡ' => 'Ɡ',
  43184. 'É£' => 'Æ”',
  43185. 'ɥ' => '�',
  43186. 'ɦ' => 'Ɦ',
  43187. 'ɨ' => 'Ɨ',
  43188. 'É©' => 'Æ–',
  43189. 'É«' => 'â±¢',
  43190. 'ɬ' => 'Ɬ',
  43191. 'ɯ' => 'Ɯ',
  43192. 'ɱ' => 'Ɱ',
  43193. 'ɲ' => '�',
  43194. 'ɵ' => 'Ɵ',
  43195. 'ɽ' => 'Ɽ',
  43196. 'ʀ' => 'Ʀ',
  43197. 'ʃ' => 'Ʃ',
  43198. 'ʇ' => 'Ʇ',
  43199. 'ʈ' => 'Ʈ',
  43200. 'ʉ' => 'Ʉ',
  43201. 'ʊ' => 'Ʊ',
  43202. 'ʋ' => 'Ʋ',
  43203. 'ʌ' => 'Ʌ',
  43204. 'Ê’' => 'Æ·',
  43205. 'Êž' => 'êž°',
  43206. 'ͅ' => 'Ι',
  43207. 'ͱ' => 'Ͱ',
  43208. 'ͳ' => 'Ͳ',
  43209. 'ͷ' => 'Ͷ',
  43210. 'ͻ' => 'Ͻ',
  43211. 'ͼ' => 'Ͼ',
  43212. 'ͽ' => 'Ͽ',
  43213. 'ά' => 'Ά',
  43214. 'έ' => 'Έ',
  43215. 'ή' => 'Ή',
  43216. 'ί' => 'Ί',
  43217. 'α' => 'Α',
  43218. 'β' => 'Β',
  43219. 'γ' => 'Γ',
  43220. 'δ' => 'Δ',
  43221. 'ε' => 'Ε',
  43222. 'ζ' => 'Ζ',
  43223. 'η' => 'Η',
  43224. 'θ' => 'Θ',
  43225. 'ι' => 'Ι',
  43226. 'κ' => 'Κ',
  43227. 'λ' => 'Λ',
  43228. 'μ' => 'Μ',
  43229. 'ν' => '�',
  43230. 'ξ' => 'Ξ',
  43231. 'ο' => 'Ο',
  43232. 'π' => 'Π',
  43233. '�' => 'Ρ',
  43234. 'ς' => 'Σ',
  43235. 'σ' => 'Σ',
  43236. 'τ' => 'Τ',
  43237. 'Ï…' => 'Î¥',
  43238. 'φ' => 'Φ',
  43239. 'χ' => 'Χ',
  43240. 'ψ' => 'Ψ',
  43241. 'ω' => 'Ω',
  43242. 'ϊ' => 'Ϊ',
  43243. 'ϋ' => 'Ϋ',
  43244. 'ό' => 'Ό',
  43245. '�' => 'Ύ',
  43246. 'ώ' => '�',
  43247. '�' => 'Β',
  43248. 'ϑ' => 'Θ',
  43249. 'ϕ' => 'Φ',
  43250. 'ϖ' => 'Π',
  43251. 'ϗ' => '�',
  43252. 'ϙ' => 'Ϙ',
  43253. 'Ï›' => 'Ïš',
  43254. '�' => 'Ϝ',
  43255. 'ÏŸ' => 'Ïž',
  43256. 'Ï¡' => 'Ï ',
  43257. 'Ï£' => 'Ï¢',
  43258. 'ϥ' => 'Ϥ',
  43259. 'ϧ' => 'Ϧ',
  43260. 'ϩ' => 'Ϩ',
  43261. 'ϫ' => 'Ϫ',
  43262. 'ϭ' => 'Ϭ',
  43263. 'ϯ' => 'Ϯ',
  43264. 'ϰ' => 'Κ',
  43265. 'ϱ' => 'Ρ',
  43266. 'ϲ' => 'Ϲ',
  43267. 'ϳ' => 'Ϳ',
  43268. 'ϵ' => 'Ε',
  43269. 'ϸ' => 'Ϸ',
  43270. 'ϻ' => 'Ϻ',
  43271. 'а' => '�',
  43272. 'б' => 'Б',
  43273. 'в' => 'В',
  43274. 'г' => 'Г',
  43275. 'д' => 'Д',
  43276. 'е' => 'Е',
  43277. 'ж' => 'Ж',
  43278. 'з' => 'З',
  43279. 'и' => 'И',
  43280. 'й' => 'Й',
  43281. 'к' => 'К',
  43282. 'л' => 'Л',
  43283. 'м' => 'М',
  43284. 'н' => '�',
  43285. 'о' => 'О',
  43286. 'п' => 'П',
  43287. 'р' => 'Р',
  43288. '�' => 'С',
  43289. 'т' => 'Т',
  43290. 'у' => 'У',
  43291. 'ф' => 'Ф',
  43292. 'Ñ…' => 'Ð¥',
  43293. 'ц' => 'Ц',
  43294. 'ч' => 'Ч',
  43295. 'ш' => 'Ш',
  43296. 'щ' => 'Щ',
  43297. 'ъ' => 'Ъ',
  43298. 'ы' => 'Ы',
  43299. 'ь' => 'Ь',
  43300. '�' => 'Э',
  43301. 'ю' => 'Ю',
  43302. '�' => 'Я',
  43303. '�' => 'Ѐ',
  43304. 'ё' => '�',
  43305. 'ђ' => 'Ђ',
  43306. 'ѓ' => 'Ѓ',
  43307. 'є' => 'Є',
  43308. 'Ñ•' => 'Ð…',
  43309. 'і' => 'І',
  43310. 'ї' => 'Ї',
  43311. 'ј' => 'Ј',
  43312. 'љ' => 'Љ',
  43313. 'њ' => 'Њ',
  43314. 'ћ' => 'Ћ',
  43315. 'ќ' => 'Ќ',
  43316. '�' => '�',
  43317. 'Ñž' => 'ÐŽ',
  43318. 'џ' => '�',
  43319. 'Ñ¡' => 'Ñ ',
  43320. 'Ñ£' => 'Ñ¢',
  43321. 'ѥ' => 'Ѥ',
  43322. 'ѧ' => 'Ѧ',
  43323. 'ѩ' => 'Ѩ',
  43324. 'ѫ' => 'Ѫ',
  43325. 'ѭ' => 'Ѭ',
  43326. 'ѯ' => 'Ѯ',
  43327. 'ѱ' => 'Ѱ',
  43328. 'ѳ' => 'Ѳ',
  43329. 'ѵ' => 'Ѵ',
  43330. 'ѷ' => 'Ѷ',
  43331. 'ѹ' => 'Ѹ',
  43332. 'ѻ' => 'Ѻ',
  43333. 'ѽ' => 'Ѽ',
  43334. 'ѿ' => 'Ѿ',
  43335. 'Ò�' => 'Ò€',
  43336. 'Ò‹' => 'ÒŠ',
  43337. '�' => 'Ҍ',
  43338. 'Ò�' => 'ÒŽ',
  43339. 'Ò‘' => 'Ò�',
  43340. 'Ò“' => 'Ò’',
  43341. 'Ò•' => 'Ò”',
  43342. 'Ò—' => 'Ò–',
  43343. 'Ò™' => 'Ò˜',
  43344. 'Ò›' => 'Òš',
  43345. '�' => 'Ҝ',
  43346. 'ÒŸ' => 'Òž',
  43347. 'Ò¡' => 'Ò ',
  43348. 'Ò£' => 'Ò¢',
  43349. 'Ò¥' => 'Ò¤',
  43350. 'Ò§' => 'Ò¦',
  43351. 'Ò©' => 'Ò¨',
  43352. 'Ò«' => 'Òª',
  43353. 'Ò­' => 'Ò¬',
  43354. 'Ò¯' => 'Ò®',
  43355. 'Ò±' => 'Ò°',
  43356. 'Ò³' => 'Ò²',
  43357. 'Òµ' => 'Ò´',
  43358. 'Ò·' => 'Ò¶',
  43359. 'Ò¹' => 'Ò¸',
  43360. 'Ò»' => 'Òº',
  43361. 'Ò½' => 'Ò¼',
  43362. 'Ò¿' => 'Ò¾',
  43363. 'Ó‚' => 'Ó�',
  43364. 'Ó„' => 'Óƒ',
  43365. 'Ó†' => 'Ó…',
  43366. 'Óˆ' => 'Ó‡',
  43367. 'ÓŠ' => 'Ó‰',
  43368. 'ӌ' => 'Ӌ',
  43369. 'ÓŽ' => 'Ó�',
  43370. 'Ó�' => 'Ó€',
  43371. 'Ó‘' => 'Ó�',
  43372. 'Ó“' => 'Ó’',
  43373. 'Ó•' => 'Ó”',
  43374. 'Ó—' => 'Ó–',
  43375. 'Ó™' => 'Ó˜',
  43376. 'Ó›' => 'Óš',
  43377. '�' => 'Ӝ',
  43378. 'ÓŸ' => 'Óž',
  43379. 'Ó¡' => 'Ó ',
  43380. 'Ó£' => 'Ó¢',
  43381. 'Ó¥' => 'Ó¤',
  43382. 'Ó§' => 'Ó¦',
  43383. 'Ó©' => 'Ó¨',
  43384. 'Ó«' => 'Óª',
  43385. 'Ó­' => 'Ó¬',
  43386. 'Ó¯' => 'Ó®',
  43387. 'Ó±' => 'Ó°',
  43388. 'Ó³' => 'Ó²',
  43389. 'Óµ' => 'Ó´',
  43390. 'Ó·' => 'Ó¶',
  43391. 'Ó¹' => 'Ó¸',
  43392. 'Ó»' => 'Óº',
  43393. 'Ó½' => 'Ó¼',
  43394. 'Ó¿' => 'Ó¾',
  43395. 'Ô�' => 'Ô€',
  43396. 'Ôƒ' => 'Ô‚',
  43397. 'Ô…' => 'Ô„',
  43398. 'Ô‡' => 'Ô†',
  43399. 'Ô‰' => 'Ôˆ',
  43400. 'Ô‹' => 'ÔŠ',
  43401. '�' => 'Ԍ',
  43402. 'Ô�' => 'ÔŽ',
  43403. 'Ô‘' => 'Ô�',
  43404. 'Ô“' => 'Ô’',
  43405. 'Ô•' => 'Ô”',
  43406. 'Ô—' => 'Ô–',
  43407. 'Ô™' => 'Ô˜',
  43408. 'Ô›' => 'Ôš',
  43409. '�' => 'Ԝ',
  43410. 'ÔŸ' => 'Ôž',
  43411. 'Ô¡' => 'Ô ',
  43412. 'Ô£' => 'Ô¢',
  43413. 'Ô¥' => 'Ô¤',
  43414. 'Ô§' => 'Ô¦',
  43415. 'Ô©' => 'Ô¨',
  43416. 'Ô«' => 'Ôª',
  43417. 'Ô­' => 'Ô¬',
  43418. 'Ô¯' => 'Ô®',
  43419. 'Õ¡' => 'Ô±',
  43420. 'Õ¢' => 'Ô²',
  43421. 'Õ£' => 'Ô³',
  43422. 'Õ¤' => 'Ô´',
  43423. 'Õ¥' => 'Ôµ',
  43424. 'Õ¦' => 'Ô¶',
  43425. 'Õ§' => 'Ô·',
  43426. 'Õ¨' => 'Ô¸',
  43427. 'Õ©' => 'Ô¹',
  43428. 'Õª' => 'Ôº',
  43429. 'Õ«' => 'Ô»',
  43430. 'Õ¬' => 'Ô¼',
  43431. 'Õ­' => 'Ô½',
  43432. 'Õ®' => 'Ô¾',
  43433. 'Õ¯' => 'Ô¿',
  43434. 'Õ°' => 'Õ€',
  43435. 'Õ±' => 'Õ�',
  43436. 'Õ²' => 'Õ‚',
  43437. 'Õ³' => 'Õƒ',
  43438. 'Õ´' => 'Õ„',
  43439. 'Õµ' => 'Õ…',
  43440. 'Õ¶' => 'Õ†',
  43441. 'Õ·' => 'Õ‡',
  43442. 'Õ¸' => 'Õˆ',
  43443. 'Õ¹' => 'Õ‰',
  43444. 'Õº' => 'ÕŠ',
  43445. 'Õ»' => 'Õ‹',
  43446. 'ռ' => 'Ռ',
  43447. 'Õ½' => 'Õ�',
  43448. 'Õ¾' => 'ÕŽ',
  43449. 'Õ¿' => 'Õ�',
  43450. 'Ö€' => 'Õ�',
  43451. 'Ö�' => 'Õ‘',
  43452. 'Ö‚' => 'Õ’',
  43453. 'Öƒ' => 'Õ“',
  43454. 'Ö„' => 'Õ”',
  43455. 'Ö…' => 'Õ•',
  43456. 'Ö†' => 'Õ–',
  43457. 'ᵹ' => '�',
  43458. 'áµ½' => 'â±£',
  43459. '�' => 'Ḁ',
  43460. 'ḃ' => 'Ḃ',
  43461. 'ḅ' => 'Ḅ',
  43462. 'ḇ' => 'Ḇ',
  43463. 'ḉ' => 'Ḉ',
  43464. 'ḋ' => 'Ḋ',
  43465. '�' => 'Ḍ',
  43466. '�' => 'Ḏ',
  43467. 'ḑ' => '�',
  43468. 'ḓ' => 'Ḓ',
  43469. 'ḕ' => 'Ḕ',
  43470. 'ḗ' => 'Ḗ',
  43471. 'ḙ' => 'Ḙ',
  43472. 'ḛ' => 'Ḛ',
  43473. '�' => 'Ḝ',
  43474. 'ḟ' => 'Ḟ',
  43475. 'ḡ' => 'Ḡ',
  43476. 'ḣ' => 'Ḣ',
  43477. 'ḥ' => 'Ḥ',
  43478. 'ḧ' => 'Ḧ',
  43479. 'ḩ' => 'Ḩ',
  43480. 'ḫ' => 'Ḫ',
  43481. 'ḭ' => 'Ḭ',
  43482. 'ḯ' => 'Ḯ',
  43483. 'ḱ' => 'Ḱ',
  43484. 'ḳ' => 'Ḳ',
  43485. 'ḵ' => 'Ḵ',
  43486. 'ḷ' => 'Ḷ',
  43487. 'ḹ' => 'Ḹ',
  43488. 'ḻ' => 'Ḻ',
  43489. 'ḽ' => 'Ḽ',
  43490. 'ḿ' => 'Ḿ',
  43491. '�' => 'Ṁ',
  43492. 'ṃ' => 'Ṃ',
  43493. 'ṅ' => 'Ṅ',
  43494. 'ṇ' => 'Ṇ',
  43495. 'ṉ' => 'Ṉ',
  43496. 'ṋ' => 'Ṋ',
  43497. '�' => 'Ṍ',
  43498. '�' => 'Ṏ',
  43499. 'ṑ' => '�',
  43500. 'ṓ' => 'Ṓ',
  43501. 'ṕ' => 'Ṕ',
  43502. 'á¹—' => 'á¹–',
  43503. 'ṙ' => 'Ṙ',
  43504. 'ṛ' => 'Ṛ',
  43505. '�' => 'Ṝ',
  43506. 'ṟ' => 'Ṟ',
  43507. 'ṡ' => 'Ṡ',
  43508. 'á¹£' => 'á¹¢',
  43509. 'ṥ' => 'Ṥ',
  43510. 'ṧ' => 'Ṧ',
  43511. 'ṩ' => 'Ṩ',
  43512. 'ṫ' => 'Ṫ',
  43513. 'ṭ' => 'Ṭ',
  43514. 'ṯ' => 'Ṯ',
  43515. 'á¹±' => 'á¹°',
  43516. 'á¹³' => 'á¹²',
  43517. 'á¹µ' => 'á¹´',
  43518. 'ṷ' => 'Ṷ',
  43519. 'ṹ' => 'Ṹ',
  43520. 'ṻ' => 'Ṻ',
  43521. 'á¹½' => 'á¹¼',
  43522. 'ṿ' => 'Ṿ',
  43523. '�' => 'Ẁ',
  43524. 'ẃ' => 'Ẃ',
  43525. 'ẅ' => 'Ẅ',
  43526. 'ẇ' => 'Ẇ',
  43527. 'ẉ' => 'Ẉ',
  43528. 'ẋ' => 'Ẋ',
  43529. '�' => 'Ẍ',
  43530. '�' => 'Ẏ',
  43531. 'ẑ' => '�',
  43532. 'ẓ' => 'Ẓ',
  43533. 'ẕ' => 'Ẕ',
  43534. 'ẛ' => 'Ṡ',
  43535. 'ạ' => 'Ạ',
  43536. 'ả' => 'Ả',
  43537. 'ấ' => 'Ấ',
  43538. 'ầ' => 'Ầ',
  43539. 'ẩ' => 'Ẩ',
  43540. 'ẫ' => 'Ẫ',
  43541. 'ậ' => 'Ậ',
  43542. 'ắ' => 'Ắ',
  43543. 'ằ' => 'Ằ',
  43544. 'ẳ' => 'Ẳ',
  43545. 'ẵ' => 'Ẵ',
  43546. 'ặ' => 'Ặ',
  43547. 'ẹ' => 'Ẹ',
  43548. 'ẻ' => 'Ẻ',
  43549. 'ẽ' => 'Ẽ',
  43550. 'ế' => 'Ế',
  43551. '�' => 'Ề',
  43552. 'ể' => 'Ể',
  43553. 'ễ' => 'Ễ',
  43554. 'ệ' => 'Ệ',
  43555. 'ỉ' => 'Ỉ',
  43556. 'ị' => 'Ị',
  43557. '�' => 'Ọ',
  43558. '�' => 'Ỏ',
  43559. 'ố' => '�',
  43560. 'ồ' => 'Ồ',
  43561. 'ổ' => 'Ổ',
  43562. 'á»—' => 'á»–',
  43563. 'ộ' => 'Ộ',
  43564. 'ớ' => 'Ớ',
  43565. '�' => 'Ờ',
  43566. 'ở' => 'Ở',
  43567. 'ỡ' => 'Ỡ',
  43568. 'ợ' => 'Ợ',
  43569. 'ụ' => 'Ụ',
  43570. 'ủ' => 'Ủ',
  43571. 'ứ' => 'Ứ',
  43572. 'ừ' => 'Ừ',
  43573. 'ử' => 'Ử',
  43574. 'ữ' => 'Ữ',
  43575. 'á»±' => 'á»°',
  43576. 'ỳ' => 'Ỳ',
  43577. 'ỵ' => 'Ỵ',
  43578. 'ỷ' => 'Ỷ',
  43579. 'ỹ' => 'Ỹ',
  43580. 'ỻ' => 'Ỻ',
  43581. 'ỽ' => 'Ỽ',
  43582. 'ỿ' => 'Ỿ',
  43583. 'ἀ' => 'Ἀ',
  43584. '�' => 'Ἁ',
  43585. 'ἂ' => 'Ἂ',
  43586. 'ἃ' => 'Ἃ',
  43587. 'ἄ' => 'Ἄ',
  43588. 'ἅ' => '�',
  43589. 'ἆ' => 'Ἆ',
  43590. 'ἇ' => '�',
  43591. '�' => 'Ἐ',
  43592. 'ἑ' => 'Ἑ',
  43593. 'ἒ' => 'Ἒ',
  43594. 'ἓ' => 'Ἓ',
  43595. 'ἔ' => 'Ἔ',
  43596. 'ἕ' => '�',
  43597. 'ἠ' => 'Ἠ',
  43598. 'ἡ' => 'Ἡ',
  43599. 'ἢ' => 'Ἢ',
  43600. 'ἣ' => 'Ἣ',
  43601. 'ἤ' => 'Ἤ',
  43602. 'á¼¥' => 'á¼­',
  43603. 'ἦ' => 'Ἦ',
  43604. 'ἧ' => 'Ἧ',
  43605. 'ἰ' => 'Ἰ',
  43606. 'á¼±' => 'á¼¹',
  43607. 'ἲ' => 'Ἲ',
  43608. 'á¼³' => 'á¼»',
  43609. 'á¼´' => 'á¼¼',
  43610. 'á¼µ' => 'á¼½',
  43611. 'ἶ' => 'Ἶ',
  43612. 'ἷ' => 'Ἷ',
  43613. 'ὀ' => 'Ὀ',
  43614. '�' => 'Ὁ',
  43615. 'ὂ' => 'Ὂ',
  43616. 'ὃ' => 'Ὃ',
  43617. 'ὄ' => 'Ὄ',
  43618. 'ὅ' => '�',
  43619. 'ὑ' => 'Ὑ',
  43620. 'ὓ' => 'Ὓ',
  43621. 'ὕ' => '�',
  43622. 'ὗ' => 'Ὗ',
  43623. 'ὠ' => 'Ὠ',
  43624. 'ὡ' => 'Ὡ',
  43625. 'ὢ' => 'Ὢ',
  43626. 'ὣ' => 'Ὣ',
  43627. 'ὤ' => 'Ὤ',
  43628. 'á½¥' => 'á½­',
  43629. 'ὦ' => 'Ὦ',
  43630. 'ὧ' => 'Ὧ',
  43631. 'ὰ' => 'Ὰ',
  43632. 'á½±' => 'á¾»',
  43633. 'ὲ' => 'Ὲ',
  43634. 'έ' => 'Έ',
  43635. 'á½´' => 'á¿Š',
  43636. 'á½µ' => 'á¿‹',
  43637. 'ὶ' => 'Ὶ',
  43638. 'á½·' => 'á¿›',
  43639. 'ὸ' => 'Ὸ',
  43640. 'ό' => 'Ό',
  43641. 'ὺ' => 'Ὺ',
  43642. 'á½»' => 'á¿«',
  43643. 'ὼ' => 'Ὼ',
  43644. 'á½½' => 'á¿»',
  43645. 'ᾀ' => 'ᾈ',
  43646. '�' => 'ᾉ',
  43647. 'ᾂ' => 'ᾊ',
  43648. 'ᾃ' => 'ᾋ',
  43649. 'ᾄ' => 'ᾌ',
  43650. 'ᾅ' => '�',
  43651. 'ᾆ' => 'ᾎ',
  43652. 'ᾇ' => '�',
  43653. '�' => 'ᾘ',
  43654. 'ᾑ' => 'ᾙ',
  43655. 'ᾒ' => 'ᾚ',
  43656. 'ᾓ' => 'ᾛ',
  43657. 'ᾔ' => 'ᾜ',
  43658. 'ᾕ' => '�',
  43659. 'ᾖ' => 'ᾞ',
  43660. 'ᾗ' => 'ᾟ',
  43661. 'ᾠ' => 'ᾨ',
  43662. 'ᾡ' => 'ᾩ',
  43663. 'ᾢ' => 'ᾪ',
  43664. 'ᾣ' => 'ᾫ',
  43665. 'ᾤ' => 'ᾬ',
  43666. 'á¾¥' => 'á¾­',
  43667. 'ᾦ' => 'ᾮ',
  43668. 'ᾧ' => 'ᾯ',
  43669. 'ᾰ' => 'Ᾰ',
  43670. 'á¾±' => 'á¾¹',
  43671. 'á¾³' => 'á¾¼',
  43672. 'ι' => 'Ι',
  43673. 'ῃ' => 'ῌ',
  43674. '�' => 'Ῐ',
  43675. 'á¿‘' => 'á¿™',
  43676. 'ῠ' => 'Ῠ',
  43677. 'á¿¡' => 'á¿©',
  43678. 'ῥ' => 'Ῥ',
  43679. 'ῳ' => 'ῼ',
  43680. 'ⅎ' => 'Ⅎ',
  43681. 'â…°' => 'â… ',
  43682. 'â…±' => 'â…¡',
  43683. 'â…²' => 'â…¢',
  43684. 'â…³' => 'â…£',
  43685. 'â…´' => 'â…¤',
  43686. 'â…µ' => 'â…¥',
  43687. 'â…¶' => 'â…¦',
  43688. 'â…·' => 'â…§',
  43689. 'â…¸' => 'â…¨',
  43690. 'â…¹' => 'â…©',
  43691. 'â…º' => 'â…ª',
  43692. 'â…»' => 'â…«',
  43693. 'â…¼' => 'â…¬',
  43694. 'â…½' => 'â…­',
  43695. 'â…¾' => 'â…®',
  43696. 'â…¿' => 'â…¯',
  43697. 'ↄ' => 'Ↄ',
  43698. '�' => 'Ⓐ',
  43699. 'â“‘' => 'â’·',
  43700. 'â“’' => 'â’¸',
  43701. 'â““' => 'â’¹',
  43702. 'â“”' => 'â’º',
  43703. 'â“•' => 'â’»',
  43704. 'â“–' => 'â’¼',
  43705. 'â“—' => 'â’½',
  43706. 'ⓘ' => 'Ⓘ',
  43707. 'â“™' => 'â’¿',
  43708. 'â“š' => 'â“€',
  43709. 'ⓛ' => '�',
  43710. 'ⓜ' => 'Ⓜ',
  43711. '�' => 'Ⓝ',
  43712. 'â“ž' => 'â“„',
  43713. 'â“Ÿ' => 'â“…',
  43714. 'ⓠ' => 'Ⓠ',
  43715. 'ⓡ' => 'Ⓡ',
  43716. 'ⓢ' => 'Ⓢ',
  43717. 'ⓣ' => 'Ⓣ',
  43718. 'ⓤ' => 'Ⓤ',
  43719. 'â“¥' => 'â“‹',
  43720. 'ⓦ' => 'Ⓦ',
  43721. 'ⓧ' => '�',
  43722. 'ⓨ' => 'Ⓨ',
  43723. 'ⓩ' => '�',
  43724. 'â°°' => 'â°€',
  43725. 'â°±' => 'â°�',
  43726. 'â°²' => 'â°‚',
  43727. 'â°³' => 'â°ƒ',
  43728. 'â°´' => 'â°„',
  43729. 'â°µ' => 'â°…',
  43730. 'â°¶' => 'â°†',
  43731. 'â°·' => 'â°‡',
  43732. 'â°¸' => 'â°ˆ',
  43733. 'â°¹' => 'â°‰',
  43734. 'â°º' => 'â°Š',
  43735. 'â°»' => 'â°‹',
  43736. 'ⰼ' => 'Ⰼ',
  43737. 'â°½' => 'â°�',
  43738. 'â°¾' => 'â°Ž',
  43739. 'â°¿' => 'â°�',
  43740. 'â±€' => 'â°�',
  43741. '�' => 'Ⱁ',
  43742. 'ⱂ' => 'Ⱂ',
  43743. 'ⱃ' => 'Ⱃ',
  43744. 'ⱄ' => 'Ⱄ',
  43745. 'â±…' => 'â°•',
  43746. 'ⱆ' => 'Ⱆ',
  43747. 'ⱇ' => 'Ⱇ',
  43748. 'ⱈ' => 'Ⱈ',
  43749. 'ⱉ' => 'Ⱉ',
  43750. 'ⱊ' => 'Ⱊ',
  43751. 'ⱋ' => 'Ⱋ',
  43752. 'ⱌ' => 'Ⱌ',
  43753. '�' => '�',
  43754. 'ⱎ' => 'Ⱎ',
  43755. '�' => 'Ⱏ',
  43756. '�' => 'Ⱐ',
  43757. 'ⱑ' => 'Ⱑ',
  43758. 'â±’' => 'â°¢',
  43759. 'ⱓ' => 'Ⱓ',
  43760. 'â±”' => 'â°¤',
  43761. 'ⱕ' => 'Ⱕ',
  43762. 'â±–' => 'â°¦',
  43763. 'â±—' => 'â°§',
  43764. 'ⱘ' => 'Ⱘ',
  43765. 'â±™' => 'â°©',
  43766. 'ⱚ' => 'Ⱚ',
  43767. 'â±›' => 'â°«',
  43768. 'ⱜ' => 'Ⱜ',
  43769. '�' => 'Ⱝ',
  43770. 'ⱞ' => 'Ⱞ',
  43771. 'ⱡ' => 'Ⱡ',
  43772. 'ⱥ' => 'Ⱥ',
  43773. 'ⱦ' => 'Ⱦ',
  43774. 'ⱨ' => 'Ⱨ',
  43775. 'ⱪ' => 'Ⱪ',
  43776. 'ⱬ' => 'Ⱬ',
  43777. 'â±³' => 'â±²',
  43778. 'ⱶ' => 'Ⱶ',
  43779. '�' => 'Ⲁ',
  43780. 'ⲃ' => 'Ⲃ',
  43781. 'ⲅ' => 'Ⲅ',
  43782. 'ⲇ' => 'Ⲇ',
  43783. 'ⲉ' => 'Ⲉ',
  43784. 'ⲋ' => 'Ⲋ',
  43785. '�' => 'Ⲍ',
  43786. '�' => 'Ⲏ',
  43787. 'ⲑ' => '�',
  43788. 'ⲓ' => 'Ⲓ',
  43789. 'ⲕ' => 'Ⲕ',
  43790. 'â²—' => 'â²–',
  43791. 'ⲙ' => 'Ⲙ',
  43792. 'ⲛ' => 'Ⲛ',
  43793. '�' => 'Ⲝ',
  43794. 'ⲟ' => 'Ⲟ',
  43795. 'ⲡ' => 'Ⲡ',
  43796. 'â²£' => 'â²¢',
  43797. 'ⲥ' => 'Ⲥ',
  43798. 'ⲧ' => 'Ⲧ',
  43799. 'ⲩ' => 'Ⲩ',
  43800. 'ⲫ' => 'Ⲫ',
  43801. 'ⲭ' => 'Ⲭ',
  43802. 'ⲯ' => 'Ⲯ',
  43803. 'â²±' => 'â²°',
  43804. 'â²³' => 'â²²',
  43805. 'â²µ' => 'â²´',
  43806. 'ⲷ' => 'Ⲷ',
  43807. 'ⲹ' => 'Ⲹ',
  43808. 'ⲻ' => 'Ⲻ',
  43809. 'â²½' => 'â²¼',
  43810. 'ⲿ' => 'Ⲿ',
  43811. '�' => 'Ⳁ',
  43812. 'ⳃ' => 'Ⳃ',
  43813. 'ⳅ' => 'Ⳅ',
  43814. 'ⳇ' => 'Ⳇ',
  43815. 'ⳉ' => 'Ⳉ',
  43816. 'ⳋ' => 'Ⳋ',
  43817. '�' => 'Ⳍ',
  43818. '�' => 'Ⳏ',
  43819. 'ⳑ' => '�',
  43820. 'ⳓ' => 'Ⳓ',
  43821. 'ⳕ' => 'Ⳕ',
  43822. 'â³—' => 'â³–',
  43823. 'ⳙ' => 'Ⳙ',
  43824. 'ⳛ' => 'Ⳛ',
  43825. '�' => 'Ⳝ',
  43826. 'ⳟ' => 'Ⳟ',
  43827. 'ⳡ' => 'Ⳡ',
  43828. 'â³£' => 'â³¢',
  43829. 'ⳬ' => 'Ⳬ',
  43830. 'â³®' => 'â³­',
  43831. 'â³³' => 'â³²',
  43832. 'â´€' => 'á‚ ',
  43833. 'â´�' => 'á‚¡',
  43834. 'â´‚' => 'á‚¢',
  43835. 'â´ƒ' => 'á‚£',
  43836. 'ⴄ' => 'Ⴄ',
  43837. 'â´…' => 'á‚¥',
  43838. 'ⴆ' => 'Ⴆ',
  43839. 'ⴇ' => 'Ⴇ',
  43840. 'ⴈ' => 'Ⴈ',
  43841. 'â´‰' => 'á‚©',
  43842. 'ⴊ' => 'Ⴊ',
  43843. 'â´‹' => 'á‚«',
  43844. 'ⴌ' => 'Ⴌ',
  43845. 'â´�' => 'á‚­',
  43846. 'â´Ž' => 'á‚®',
  43847. '�' => 'Ⴏ',
  43848. 'â´�' => 'á‚°',
  43849. 'ⴑ' => 'Ⴑ',
  43850. 'ⴒ' => 'Ⴒ',
  43851. 'ⴓ' => 'Ⴓ',
  43852. 'â´”' => 'á‚´',
  43853. 'ⴕ' => 'Ⴕ',
  43854. 'ⴖ' => 'Ⴖ',
  43855. 'â´—' => 'á‚·',
  43856. 'ⴘ' => 'Ⴘ',
  43857. 'ⴙ' => 'Ⴙ',
  43858. 'ⴚ' => 'Ⴚ',
  43859. 'â´›' => 'á‚»',
  43860. 'ⴜ' => 'Ⴜ',
  43861. '�' => 'Ⴝ',
  43862. 'ⴞ' => 'Ⴞ',
  43863. 'â´Ÿ' => 'á‚¿',
  43864. 'ⴠ' => 'Ⴠ',
  43865. 'ⴡ' => '�',
  43866. 'ⴢ' => 'Ⴢ',
  43867. 'ⴣ' => 'Ⴣ',
  43868. 'ⴤ' => 'Ⴤ',
  43869. 'ⴥ' => 'Ⴥ',
  43870. 'ⴧ' => 'Ⴧ',
  43871. 'ⴭ' => '�',
  43872. '�' => 'Ꙁ',
  43873. 'ꙃ' => 'Ꙃ',
  43874. 'ꙅ' => 'Ꙅ',
  43875. 'ꙇ' => 'Ꙇ',
  43876. 'ꙉ' => 'Ꙉ',
  43877. 'ꙋ' => 'Ꙋ',
  43878. '�' => 'Ꙍ',
  43879. '�' => 'Ꙏ',
  43880. 'ꙑ' => '�',
  43881. 'ꙓ' => 'Ꙓ',
  43882. 'ꙕ' => 'Ꙕ',
  43883. 'ê™—' => 'ê™–',
  43884. 'ꙙ' => 'Ꙙ',
  43885. 'ꙛ' => 'Ꙛ',
  43886. '�' => 'Ꙝ',
  43887. 'ꙟ' => 'Ꙟ',
  43888. 'ꙡ' => 'Ꙡ',
  43889. 'ꙣ' => 'Ꙣ',
  43890. 'ꙥ' => 'Ꙥ',
  43891. 'ꙧ' => 'Ꙧ',
  43892. 'ꙩ' => 'Ꙩ',
  43893. 'ꙫ' => 'Ꙫ',
  43894. 'ꙭ' => 'Ꙭ',
  43895. '�' => 'Ꚁ',
  43896. 'ꚃ' => 'Ꚃ',
  43897. 'êš…' => 'êš„',
  43898. 'ꚇ' => 'Ꚇ',
  43899. 'ꚉ' => 'Ꚉ',
  43900. 'ꚋ' => 'Ꚋ',
  43901. '�' => 'Ꚍ',
  43902. '�' => 'Ꚏ',
  43903. 'ꚑ' => '�',
  43904. 'êš“' => 'êš’',
  43905. 'êš•' => 'êš”',
  43906. 'êš—' => 'êš–',
  43907. 'ꚙ' => 'Ꚙ',
  43908. 'êš›' => 'êšš',
  43909. 'ꜣ' => 'Ꜣ',
  43910. 'ꜥ' => 'Ꜥ',
  43911. 'ꜧ' => 'Ꜧ',
  43912. 'ꜩ' => 'Ꜩ',
  43913. 'ꜫ' => 'Ꜫ',
  43914. 'ꜭ' => 'Ꜭ',
  43915. 'ꜯ' => 'Ꜯ',
  43916. 'ꜳ' => 'Ꜳ',
  43917. 'ꜵ' => 'Ꜵ',
  43918. 'ꜷ' => 'Ꜷ',
  43919. 'ꜹ' => 'Ꜹ',
  43920. 'ꜻ' => 'Ꜻ',
  43921. 'ꜽ' => 'Ꜽ',
  43922. 'ꜿ' => 'Ꜿ',
  43923. '�' => '�',
  43924. '�' => '�',
  43925. '�' => '�',
  43926. '�' => '�',
  43927. '�' => '�',
  43928. '�' => '�',
  43929. '�' => '�',
  43930. '�' => '�',
  43931. '�' => '�',
  43932. '�' => '�',
  43933. '�' => '�',
  43934. '�' => '�',
  43935. '�' => '�',
  43936. '�' => '�',
  43937. '�' => '�',
  43938. '�' => '�',
  43939. '�' => '�',
  43940. '�' => '�',
  43941. '�' => '�',
  43942. '�' => '�',
  43943. '�' => '�',
  43944. '�' => '�',
  43945. '�' => '�',
  43946. '�' => '�',
  43947. '�' => '�',
  43948. '�' => '�',
  43949. '�' => '�',
  43950. '�' => 'Ꞁ',
  43951. 'ꞃ' => 'Ꞃ',
  43952. 'êž…' => 'êž„',
  43953. 'ꞇ' => 'Ꞇ',
  43954. 'ꞌ' => 'Ꞌ',
  43955. 'ꞑ' => '�',
  43956. 'êž“' => 'êž’',
  43957. 'êž—' => 'êž–',
  43958. 'ꞙ' => 'Ꞙ',
  43959. 'êž›' => 'êžš',
  43960. '�' => 'Ꞝ',
  43961. 'ꞟ' => 'Ꞟ',
  43962. 'êž¡' => 'êž ',
  43963. 'ꞣ' => 'Ꞣ',
  43964. 'ꞥ' => 'Ꞥ',
  43965. 'ꞧ' => 'Ꞧ',
  43966. 'ꞩ' => 'Ꞩ',
  43967. '�' => 'A',
  43968. 'b' => 'B',
  43969. 'c' => 'C',
  43970. 'd' => 'D',
  43971. 'ï½…' => 'ï¼¥',
  43972. 'f' => 'F',
  43973. 'g' => 'G',
  43974. 'h' => 'H',
  43975. 'i' => 'I',
  43976. 'j' => 'J',
  43977. 'k' => 'K',
  43978. 'l' => 'L',
  43979. '�' => 'M',
  43980. 'n' => 'N',
  43981. '�' => 'O',
  43982. '�' => 'P',
  43983. 'q' => 'Q',
  43984. 'ï½’' => 'ï¼²',
  43985. 's' => 'S',
  43986. 'ï½”' => 'ï¼´',
  43987. 'u' => 'U',
  43988. 'v' => 'V',
  43989. 'ï½—' => 'ï¼·',
  43990. 'x' => 'X',
  43991. 'ï½™' => 'ï¼¹',
  43992. 'z' => 'Z',
  43993. '�' => '�',
  43994. '�' => '�',
  43995. '�' => '�',
  43996. '�' => '�',
  43997. '�' => '�',
  43998. '�' => '�',
  43999. '�' => '�',
  44000. '�' => '�',
  44001. '�' => '�',
  44002. '�' => '�',
  44003. '�' => '�',
  44004. '�' => '�',
  44005. '�' => '�',
  44006. '�' => '�',
  44007. '�' => '�',
  44008. '�' => '�',
  44009. '�' => '�',
  44010. '�' => '�',
  44011. '�' => '�',
  44012. '�' => '�',
  44013. '�' => '�',
  44014. '�' => '�',
  44015. '�' => '�',
  44016. '�' => '�',
  44017. '�' => '�',
  44018. '�' => '�',
  44019. '�' => '�',
  44020. '�' => '�',
  44021. '�' => '�',
  44022. '�' => '�',
  44023. '�' => '�',
  44024. '�' => '�',
  44025. '�' => '�',
  44026. '�' => '�',
  44027. '�' => '�',
  44028. '�' => '�',
  44029. '�' => '�',
  44030. '�' => '�',
  44031. '�' => '�',
  44032. '�' => '�',
  44033. 'ð‘£€' => 'ð‘¢ ',
  44034. '�' => '𑢡',
  44035. '𑣂' => '𑢢',
  44036. '𑣃' => '𑢣',
  44037. '𑣄' => '𑢤',
  44038. 'ð‘£…' => 'ð‘¢¥',
  44039. '𑣆' => '𑢦',
  44040. '𑣇' => '𑢧',
  44041. '𑣈' => '𑢨',
  44042. '𑣉' => '𑢩',
  44043. '𑣊' => '𑢪',
  44044. '𑣋' => '𑢫',
  44045. '𑣌' => '𑢬',
  44046. '�' => '𑢭',
  44047. '𑣎' => '𑢮',
  44048. '�' => '𑢯',
  44049. '�' => '𑢰',
  44050. '𑣑' => '𑢱',
  44051. 'ð‘£’' => 'ð‘¢²',
  44052. '𑣓' => '𑢳',
  44053. 'ð‘£”' => 'ð‘¢´',
  44054. '𑣕' => '𑢵',
  44055. '𑣖' => '𑢶',
  44056. 'ð‘£—' => 'ð‘¢·',
  44057. '𑣘' => '𑢸',
  44058. 'ð‘£™' => 'ð‘¢¹',
  44059. '𑣚' => '𑢺',
  44060. 'ð‘£›' => 'ð‘¢»',
  44061. '𑣜' => '𑢼',
  44062. '�' => '𑢽',
  44063. '𑣞' => '𑢾',
  44064. '𑣟' => '𑢿',
  44065. );
  44066. $result =& $data;
  44067. unset($data);
  44068. return $result;
  44069. <?php
  44070. use Symfony\Polyfill\Mbstring as p;
  44071. if (!function_exists('mb_strlen')) {
  44072. define('MB_CASE_UPPER', 0);
  44073. define('MB_CASE_LOWER', 1);
  44074. define('MB_CASE_TITLE', 2);
  44075. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  44076. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  44077. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  44078. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  44079. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  44080. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  44081. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  44082. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  44083. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  44084. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  44085. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  44086. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  44087. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  44088. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  44089. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  44090. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  44091. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  44092. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  44093. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  44094. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  44095. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  44096. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  44097. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  44098. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  44099. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  44100. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  44101. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  44102. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  44103. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  44104. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  44105. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  44106. function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
  44107. }
  44108. if (!function_exists('mb_chr')) {
  44109. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  44110. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  44111. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  44112. }
  44113. <?php
  44114. namespace Symfony\Component\Process\Exception;
  44115. interface ExceptionInterface
  44116. {
  44117. }
  44118. <?php
  44119. namespace Symfony\Component\Process\Exception;
  44120. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  44121. {
  44122. }
  44123. <?php
  44124. namespace Symfony\Component\Process\Exception;
  44125. class LogicException extends \LogicException implements ExceptionInterface
  44126. {
  44127. }
  44128. <?php
  44129. namespace Symfony\Component\Process\Exception;
  44130. use Symfony\Component\Process\Process;
  44131. class ProcessFailedException extends RuntimeException
  44132. {
  44133. private $process;
  44134. public function __construct(Process $process)
  44135. {
  44136. if ($process->isSuccessful()) {
  44137. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  44138. }
  44139. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  44140. $process->getCommandLine(),
  44141. $process->getExitCode(),
  44142. $process->getExitCodeText(),
  44143. $process->getWorkingDirectory()
  44144. );
  44145. if (!$process->isOutputDisabled()) {
  44146. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  44147. $process->getOutput(),
  44148. $process->getErrorOutput()
  44149. );
  44150. }
  44151. parent::__construct($error);
  44152. $this->process = $process;
  44153. }
  44154. public function getProcess()
  44155. {
  44156. return $this->process;
  44157. }
  44158. }
  44159. <?php
  44160. namespace Symfony\Component\Process\Exception;
  44161. use Symfony\Component\Process\Process;
  44162. class ProcessTimedOutException extends RuntimeException
  44163. {
  44164. const TYPE_GENERAL = 1;
  44165. const TYPE_IDLE = 2;
  44166. private $process;
  44167. private $timeoutType;
  44168. public function __construct(Process $process, $timeoutType)
  44169. {
  44170. $this->process = $process;
  44171. $this->timeoutType = $timeoutType;
  44172. parent::__construct(sprintf(
  44173. 'The process "%s" exceeded the timeout of %s seconds.',
  44174. $process->getCommandLine(),
  44175. $this->getExceededTimeout()
  44176. ));
  44177. }
  44178. public function getProcess()
  44179. {
  44180. return $this->process;
  44181. }
  44182. public function isGeneralTimeout()
  44183. {
  44184. return self::TYPE_GENERAL === $this->timeoutType;
  44185. }
  44186. public function isIdleTimeout()
  44187. {
  44188. return self::TYPE_IDLE === $this->timeoutType;
  44189. }
  44190. public function getExceededTimeout()
  44191. {
  44192. switch ($this->timeoutType) {
  44193. case self::TYPE_GENERAL:
  44194. return $this->process->getTimeout();
  44195. case self::TYPE_IDLE:
  44196. return $this->process->getIdleTimeout();
  44197. default:
  44198. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  44199. }
  44200. }
  44201. }
  44202. <?php
  44203. namespace Symfony\Component\Process\Exception;
  44204. class RuntimeException extends \RuntimeException implements ExceptionInterface
  44205. {
  44206. }
  44207. <?php
  44208. namespace Symfony\Component\Process;
  44209. class ExecutableFinder
  44210. {
  44211. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  44212. public function setSuffixes(array $suffixes)
  44213. {
  44214. $this->suffixes = $suffixes;
  44215. }
  44216. public function addSuffix($suffix)
  44217. {
  44218. $this->suffixes[] = $suffix;
  44219. }
  44220. public function find($name, $default = null, array $extraDirs = array())
  44221. {
  44222. if (ini_get('open_basedir')) {
  44223. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  44224. $dirs = array();
  44225. foreach ($searchPath as $path) {
  44226. if (@is_dir($path)) {
  44227. $dirs[] = $path;
  44228. } else {
  44229. if (basename($path) == $name && @is_executable($path)) {
  44230. return $path;
  44231. }
  44232. }
  44233. }
  44234. } else {
  44235. $dirs = array_merge(
  44236. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  44237. $extraDirs
  44238. );
  44239. }
  44240. $suffixes = array('');
  44241. if ('\\' === DIRECTORY_SEPARATOR) {
  44242. $pathExt = getenv('PATHEXT');
  44243. $suffixes = array_merge($suffixes, $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes);
  44244. }
  44245. foreach ($suffixes as $suffix) {
  44246. foreach ($dirs as $dir) {
  44247. if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
  44248. return $file;
  44249. }
  44250. }
  44251. }
  44252. return $default;
  44253. }
  44254. }
  44255. Copyright (c) 2004-2017 Fabien Potencier
  44256. Permission is hereby granted, free of charge, to any person obtaining a copy
  44257. of this software and associated documentation files (the "Software"), to deal
  44258. in the Software without restriction, including without limitation the rights
  44259. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44260. copies of the Software, and to permit persons to whom the Software is furnished
  44261. to do so, subject to the following conditions:
  44262. The above copyright notice and this permission notice shall be included in all
  44263. copies or substantial portions of the Software.
  44264. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44265. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44266. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44267. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44268. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44269. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44270. THE SOFTWARE.
  44271. <?php
  44272. namespace Symfony\Component\Process;
  44273. class PhpExecutableFinder
  44274. {
  44275. private $executableFinder;
  44276. public function __construct()
  44277. {
  44278. $this->executableFinder = new ExecutableFinder();
  44279. }
  44280. public function find($includeArgs = true)
  44281. {
  44282. $args = $this->findArguments();
  44283. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  44284. if (defined('HHVM_VERSION')) {
  44285. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  44286. }
  44287. if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) && is_file(PHP_BINARY)) {
  44288. return PHP_BINARY.$args;
  44289. }
  44290. if ($php = getenv('PHP_PATH')) {
  44291. if (!is_executable($php)) {
  44292. return false;
  44293. }
  44294. return $php;
  44295. }
  44296. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  44297. if (is_executable($php)) {
  44298. return $php;
  44299. }
  44300. }
  44301. $dirs = array(PHP_BINDIR);
  44302. if ('\\' === DIRECTORY_SEPARATOR) {
  44303. $dirs[] = 'C:\xampp\php\\';
  44304. }
  44305. return $this->executableFinder->find('php', false, $dirs);
  44306. }
  44307. public function findArguments()
  44308. {
  44309. $arguments = array();
  44310. if (defined('HHVM_VERSION')) {
  44311. $arguments[] = '--php';
  44312. } elseif ('phpdbg' === PHP_SAPI) {
  44313. $arguments[] = '-qrr';
  44314. }
  44315. return $arguments;
  44316. }
  44317. }
  44318. <?php
  44319. namespace Symfony\Component\Process;
  44320. use Symfony\Component\Process\Exception\RuntimeException;
  44321. class PhpProcess extends Process
  44322. {
  44323. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  44324. {
  44325. $executableFinder = new PhpExecutableFinder();
  44326. if (false === $php = $executableFinder->find()) {
  44327. $php = null;
  44328. }
  44329. if ('phpdbg' === PHP_SAPI) {
  44330. $file = tempnam(sys_get_temp_dir(), 'dbg');
  44331. file_put_contents($file, $script);
  44332. register_shutdown_function('unlink', $file);
  44333. $php .= ' '.ProcessUtils::escapeArgument($file);
  44334. $script = null;
  44335. }
  44336. if ('\\' !== DIRECTORY_SEPARATOR && null !== $php) {
  44337. $php = 'exec '.$php;
  44338. }
  44339. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  44340. }
  44341. public function setPhpBinary($php)
  44342. {
  44343. $this->setCommandLine($php);
  44344. }
  44345. public function start($callback = null)
  44346. {
  44347. if (null === $this->getCommandLine()) {
  44348. throw new RuntimeException('Unable to find the PHP executable.');
  44349. }
  44350. parent::start($callback);
  44351. }
  44352. }
  44353. <?php
  44354. namespace Symfony\Component\Process\Pipes;
  44355. abstract class AbstractPipes implements PipesInterface
  44356. {
  44357. public $pipes = array();
  44358. private $inputBuffer = '';
  44359. private $input;
  44360. private $blocked = true;
  44361. public function __construct($input)
  44362. {
  44363. if (is_resource($input)) {
  44364. $this->input = $input;
  44365. } elseif (is_string($input)) {
  44366. $this->inputBuffer = $input;
  44367. } else {
  44368. $this->inputBuffer = (string) $input;
  44369. }
  44370. }
  44371. public function close()
  44372. {
  44373. foreach ($this->pipes as $pipe) {
  44374. fclose($pipe);
  44375. }
  44376. $this->pipes = array();
  44377. }
  44378. protected function hasSystemCallBeenInterrupted()
  44379. {
  44380. $lastError = error_get_last();
  44381. return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
  44382. }
  44383. protected function unblock()
  44384. {
  44385. if (!$this->blocked) {
  44386. return;
  44387. }
  44388. foreach ($this->pipes as $pipe) {
  44389. stream_set_blocking($pipe, 0);
  44390. }
  44391. if (null !== $this->input) {
  44392. stream_set_blocking($this->input, 0);
  44393. }
  44394. $this->blocked = false;
  44395. }
  44396. protected function write()
  44397. {
  44398. if (!isset($this->pipes[0])) {
  44399. return;
  44400. }
  44401. $input = $this->input;
  44402. $r = $e = array();
  44403. $w = array($this->pipes[0]);
  44404. if (false === $n = @stream_select($r, $w, $e, 0, 0)) {
  44405. return;
  44406. }
  44407. foreach ($w as $stdin) {
  44408. if (isset($this->inputBuffer[0])) {
  44409. $written = fwrite($stdin, $this->inputBuffer);
  44410. $this->inputBuffer = substr($this->inputBuffer, $written);
  44411. if (isset($this->inputBuffer[0])) {
  44412. return array($this->pipes[0]);
  44413. }
  44414. }
  44415. if ($input) {
  44416. for (;;) {
  44417. $data = fread($input, self::CHUNK_SIZE);
  44418. if (!isset($data[0])) {
  44419. break;
  44420. }
  44421. $written = fwrite($stdin, $data);
  44422. $data = substr($data, $written);
  44423. if (isset($data[0])) {
  44424. $this->inputBuffer = $data;
  44425. return array($this->pipes[0]);
  44426. }
  44427. }
  44428. if (feof($input)) {
  44429. $this->input = null;
  44430. }
  44431. }
  44432. }
  44433. if (null === $this->input && !isset($this->inputBuffer[0])) {
  44434. fclose($this->pipes[0]);
  44435. unset($this->pipes[0]);
  44436. } elseif (!$w) {
  44437. return array($this->pipes[0]);
  44438. }
  44439. }
  44440. }
  44441. <?php
  44442. namespace Symfony\Component\Process\Pipes;
  44443. interface PipesInterface
  44444. {
  44445. const CHUNK_SIZE = 16384;
  44446. public function getDescriptors();
  44447. public function getFiles();
  44448. public function readAndWrite($blocking, $close = false);
  44449. public function areOpen();
  44450. public function close();
  44451. }
  44452. <?php
  44453. namespace Symfony\Component\Process\Pipes;
  44454. use Symfony\Component\Process\Process;
  44455. class UnixPipes extends AbstractPipes
  44456. {
  44457. private $ttyMode;
  44458. private $ptyMode;
  44459. private $disableOutput;
  44460. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  44461. {
  44462. $this->ttyMode = (bool) $ttyMode;
  44463. $this->ptyMode = (bool) $ptyMode;
  44464. $this->disableOutput = (bool) $disableOutput;
  44465. parent::__construct($input);
  44466. }
  44467. public function __destruct()
  44468. {
  44469. $this->close();
  44470. }
  44471. public function getDescriptors()
  44472. {
  44473. if ($this->disableOutput) {
  44474. $nullstream = fopen('/dev/null', 'c');
  44475. return array(
  44476. array('pipe', 'r'),
  44477. $nullstream,
  44478. $nullstream,
  44479. );
  44480. }
  44481. if ($this->ttyMode) {
  44482. return array(
  44483. array('file', '/dev/tty', 'r'),
  44484. array('file', '/dev/tty', 'w'),
  44485. array('file', '/dev/tty', 'w'),
  44486. );
  44487. }
  44488. if ($this->ptyMode && Process::isPtySupported()) {
  44489. return array(
  44490. array('pty'),
  44491. array('pty'),
  44492. array('pty'),
  44493. );
  44494. }
  44495. return array(
  44496. array('pipe', 'r'),
  44497. array('pipe', 'w'),
  44498. array('pipe', 'w'),
  44499. );
  44500. }
  44501. public function getFiles()
  44502. {
  44503. return array();
  44504. }
  44505. public function readAndWrite($blocking, $close = false)
  44506. {
  44507. $this->unblock();
  44508. $w = $this->write();
  44509. $read = $e = array();
  44510. $r = $this->pipes;
  44511. unset($r[0]);
  44512. if (($r || $w) && false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  44513. if (!$this->hasSystemCallBeenInterrupted()) {
  44514. $this->pipes = array();
  44515. }
  44516. return $read;
  44517. }
  44518. foreach ($r as $pipe) {
  44519. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  44520. do {
  44521. $data = fread($pipe, self::CHUNK_SIZE);
  44522. $read[$type] .= $data;
  44523. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  44524. if (!isset($read[$type][0])) {
  44525. unset($read[$type]);
  44526. }
  44527. if ($close && feof($pipe)) {
  44528. fclose($pipe);
  44529. unset($this->pipes[$type]);
  44530. }
  44531. }
  44532. return $read;
  44533. }
  44534. public function areOpen()
  44535. {
  44536. return (bool) $this->pipes;
  44537. }
  44538. public static function create(Process $process, $input)
  44539. {
  44540. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  44541. }
  44542. }
  44543. <?php
  44544. namespace Symfony\Component\Process\Pipes;
  44545. use Symfony\Component\Process\Process;
  44546. use Symfony\Component\Process\Exception\RuntimeException;
  44547. class WindowsPipes extends AbstractPipes
  44548. {
  44549. private $files = array();
  44550. private $fileHandles = array();
  44551. private $readBytes = array(
  44552. Process::STDOUT => 0,
  44553. Process::STDERR => 0,
  44554. );
  44555. private $disableOutput;
  44556. public function __construct($disableOutput, $input)
  44557. {
  44558. $this->disableOutput = (bool) $disableOutput;
  44559. if (!$this->disableOutput) {
  44560. $pipes = array(
  44561. Process::STDOUT => Process::OUT,
  44562. Process::STDERR => Process::ERR,
  44563. );
  44564. $tmpCheck = false;
  44565. $tmpDir = sys_get_temp_dir();
  44566. $lastError = 'unknown reason';
  44567. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  44568. for ($i = 0;; ++$i) {
  44569. foreach ($pipes as $pipe => $name) {
  44570. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  44571. if (file_exists($file) && !unlink($file)) {
  44572. continue 2;
  44573. }
  44574. $h = fopen($file, 'xb');
  44575. if (!$h) {
  44576. $error = $lastError;
  44577. if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) {
  44578. continue;
  44579. }
  44580. restore_error_handler();
  44581. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error));
  44582. }
  44583. if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) {
  44584. continue 2;
  44585. }
  44586. if (isset($this->files[$pipe])) {
  44587. unlink($this->files[$pipe]);
  44588. }
  44589. $this->files[$pipe] = $file;
  44590. }
  44591. break;
  44592. }
  44593. restore_error_handler();
  44594. }
  44595. parent::__construct($input);
  44596. }
  44597. public function __destruct()
  44598. {
  44599. $this->close();
  44600. $this->removeFiles();
  44601. }
  44602. public function getDescriptors()
  44603. {
  44604. if ($this->disableOutput) {
  44605. $nullstream = fopen('NUL', 'c');
  44606. return array(
  44607. array('pipe', 'r'),
  44608. $nullstream,
  44609. $nullstream,
  44610. );
  44611. }
  44612. return array(
  44613. array('pipe', 'r'),
  44614. array('file', 'NUL', 'w'),
  44615. array('file', 'NUL', 'w'),
  44616. );
  44617. }
  44618. public function getFiles()
  44619. {
  44620. return $this->files;
  44621. }
  44622. public function readAndWrite($blocking, $close = false)
  44623. {
  44624. $this->unblock();
  44625. $w = $this->write();
  44626. $read = $r = $e = array();
  44627. if ($blocking) {
  44628. if ($w) {
  44629. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  44630. } elseif ($this->fileHandles) {
  44631. usleep(Process::TIMEOUT_PRECISION * 1E6);
  44632. }
  44633. }
  44634. foreach ($this->fileHandles as $type => $fileHandle) {
  44635. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  44636. if (isset($data[0])) {
  44637. $this->readBytes[$type] += strlen($data);
  44638. $read[$type] = $data;
  44639. }
  44640. if ($close) {
  44641. fclose($fileHandle);
  44642. unset($this->fileHandles[$type]);
  44643. }
  44644. }
  44645. return $read;
  44646. }
  44647. public function areOpen()
  44648. {
  44649. return $this->pipes && $this->fileHandles;
  44650. }
  44651. public function close()
  44652. {
  44653. parent::close();
  44654. foreach ($this->fileHandles as $handle) {
  44655. fclose($handle);
  44656. }
  44657. $this->fileHandles = array();
  44658. }
  44659. public static function create(Process $process, $input)
  44660. {
  44661. return new static($process->isOutputDisabled(), $input);
  44662. }
  44663. private function removeFiles()
  44664. {
  44665. foreach ($this->files as $filename) {
  44666. if (file_exists($filename)) {
  44667. @unlink($filename);
  44668. }
  44669. }
  44670. $this->files = array();
  44671. }
  44672. }
  44673. <?php
  44674. namespace Symfony\Component\Process;
  44675. use Symfony\Component\Process\Exception\InvalidArgumentException;
  44676. use Symfony\Component\Process\Exception\LogicException;
  44677. use Symfony\Component\Process\Exception\ProcessFailedException;
  44678. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  44679. use Symfony\Component\Process\Exception\RuntimeException;
  44680. use Symfony\Component\Process\Pipes\PipesInterface;
  44681. use Symfony\Component\Process\Pipes\UnixPipes;
  44682. use Symfony\Component\Process\Pipes\WindowsPipes;
  44683. class Process
  44684. {
  44685. const ERR = 'err';
  44686. const OUT = 'out';
  44687. const STATUS_READY = 'ready';
  44688. const STATUS_STARTED = 'started';
  44689. const STATUS_TERMINATED = 'terminated';
  44690. const STDIN = 0;
  44691. const STDOUT = 1;
  44692. const STDERR = 2;
  44693. const TIMEOUT_PRECISION = 0.2;
  44694. private $callback;
  44695. private $commandline;
  44696. private $cwd;
  44697. private $env;
  44698. private $input;
  44699. private $starttime;
  44700. private $lastOutputTime;
  44701. private $timeout;
  44702. private $idleTimeout;
  44703. private $options;
  44704. private $exitcode;
  44705. private $fallbackStatus = array();
  44706. private $processInformation;
  44707. private $outputDisabled = false;
  44708. private $stdout;
  44709. private $stderr;
  44710. private $enhanceWindowsCompatibility = true;
  44711. private $enhanceSigchildCompatibility;
  44712. private $process;
  44713. private $status = self::STATUS_READY;
  44714. private $incrementalOutputOffset = 0;
  44715. private $incrementalErrorOutputOffset = 0;
  44716. private $tty;
  44717. private $pty;
  44718. private $useFileHandles = false;
  44719. private $processPipes;
  44720. private $latestSignal;
  44721. private static $sigchild;
  44722. public static $exitCodes = array(
  44723. 0 => 'OK',
  44724. 1 => 'General error',
  44725. 2 => 'Misuse of shell builtins',
  44726. 126 => 'Invoked command cannot execute',
  44727. 127 => 'Command not found',
  44728. 128 => 'Invalid exit argument',
  44729. 129 => 'Hangup',
  44730. 130 => 'Interrupt',
  44731. 131 => 'Quit and dump core',
  44732. 132 => 'Illegal instruction',
  44733. 133 => 'Trace/breakpoint trap',
  44734. 134 => 'Process aborted',
  44735. 135 => 'Bus error: "access to undefined portion of memory object"',
  44736. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  44737. 137 => 'Kill (terminate immediately)',
  44738. 138 => 'User-defined 1',
  44739. 139 => 'Segmentation violation',
  44740. 140 => 'User-defined 2',
  44741. 141 => 'Write to pipe with no one reading',
  44742. 142 => 'Signal raised by alarm',
  44743. 143 => 'Termination (request to terminate)',
  44744. 145 => 'Child process terminated, stopped (or continued*)',
  44745. 146 => 'Continue if stopped',
  44746. 147 => 'Stop executing temporarily',
  44747. 148 => 'Terminal stop signal',
  44748. 149 => 'Background process attempting to read from tty ("in")',
  44749. 150 => 'Background process attempting to write to tty ("out")',
  44750. 151 => 'Urgent data available on socket',
  44751. 152 => 'CPU time limit exceeded',
  44752. 153 => 'File size limit exceeded',
  44753. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  44754. 155 => 'Profiling timer expired',
  44755. 157 => 'Pollable event',
  44756. 159 => 'Bad syscall',
  44757. );
  44758. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  44759. {
  44760. if (!function_exists('proc_open')) {
  44761. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  44762. }
  44763. $this->commandline = $commandline;
  44764. $this->cwd = $cwd;
  44765. if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
  44766. $this->cwd = getcwd();
  44767. }
  44768. if (null !== $env) {
  44769. $this->setEnv($env);
  44770. }
  44771. $this->setInput($input);
  44772. $this->setTimeout($timeout);
  44773. $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
  44774. $this->pty = false;
  44775. $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  44776. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  44777. }
  44778. public function __destruct()
  44779. {
  44780. $this->stop(0);
  44781. }
  44782. public function __clone()
  44783. {
  44784. $this->resetProcessData();
  44785. }
  44786. public function run($callback = null)
  44787. {
  44788. $this->start($callback);
  44789. return $this->wait();
  44790. }
  44791. public function mustRun($callback = null)
  44792. {
  44793. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  44794. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  44795. }
  44796. if (0 !== $this->run($callback)) {
  44797. throw new ProcessFailedException($this);
  44798. }
  44799. return $this;
  44800. }
  44801. public function start($callback = null)
  44802. {
  44803. if ($this->isRunning()) {
  44804. throw new RuntimeException('Process is already running');
  44805. }
  44806. if ($this->outputDisabled && null !== $callback) {
  44807. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  44808. }
  44809. $this->resetProcessData();
  44810. $this->starttime = $this->lastOutputTime = microtime(true);
  44811. $this->callback = $this->buildCallback($callback);
  44812. $descriptors = $this->getDescriptors();
  44813. $commandline = $this->commandline;
  44814. if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  44815. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  44816. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  44817. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  44818. }
  44819. $commandline .= '"';
  44820. if (!isset($this->options['bypass_shell'])) {
  44821. $this->options['bypass_shell'] = true;
  44822. }
  44823. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  44824. $descriptors[3] = array('pipe', 'w');
  44825. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  44826. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  44827. $ptsWorkaround = fopen(__FILE__, 'r');
  44828. }
  44829. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  44830. if (!is_resource($this->process)) {
  44831. throw new RuntimeException('Unable to launch a new process.');
  44832. }
  44833. $this->status = self::STATUS_STARTED;
  44834. if (isset($descriptors[3])) {
  44835. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  44836. }
  44837. if ($this->tty) {
  44838. return;
  44839. }
  44840. $this->updateStatus(false);
  44841. $this->checkTimeout();
  44842. }
  44843. public function restart($callback = null)
  44844. {
  44845. if ($this->isRunning()) {
  44846. throw new RuntimeException('Process is already running');
  44847. }
  44848. $process = clone $this;
  44849. $process->start($callback);
  44850. return $process;
  44851. }
  44852. public function wait($callback = null)
  44853. {
  44854. $this->requireProcessIsStarted(__FUNCTION__);
  44855. $this->updateStatus(false);
  44856. if (null !== $callback) {
  44857. $this->callback = $this->buildCallback($callback);
  44858. }
  44859. do {
  44860. $this->checkTimeout();
  44861. $running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  44862. $this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
  44863. } while ($running);
  44864. while ($this->isRunning()) {
  44865. usleep(1000);
  44866. }
  44867. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  44868. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  44869. }
  44870. return $this->exitcode;
  44871. }
  44872. public function getPid()
  44873. {
  44874. return $this->isRunning() ? $this->processInformation['pid'] : null;
  44875. }
  44876. public function signal($signal)
  44877. {
  44878. $this->doSignal($signal, true);
  44879. return $this;
  44880. }
  44881. public function disableOutput()
  44882. {
  44883. if ($this->isRunning()) {
  44884. throw new RuntimeException('Disabling output while the process is running is not possible.');
  44885. }
  44886. if (null !== $this->idleTimeout) {
  44887. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  44888. }
  44889. $this->outputDisabled = true;
  44890. return $this;
  44891. }
  44892. public function enableOutput()
  44893. {
  44894. if ($this->isRunning()) {
  44895. throw new RuntimeException('Enabling output while the process is running is not possible.');
  44896. }
  44897. $this->outputDisabled = false;
  44898. return $this;
  44899. }
  44900. public function isOutputDisabled()
  44901. {
  44902. return $this->outputDisabled;
  44903. }
  44904. public function getOutput()
  44905. {
  44906. $this->readPipesForOutput(__FUNCTION__);
  44907. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  44908. return '';
  44909. }
  44910. return $ret;
  44911. }
  44912. public function getIncrementalOutput()
  44913. {
  44914. $this->readPipesForOutput(__FUNCTION__);
  44915. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  44916. $this->incrementalOutputOffset = ftell($this->stdout);
  44917. if (false === $latest) {
  44918. return '';
  44919. }
  44920. return $latest;
  44921. }
  44922. public function clearOutput()
  44923. {
  44924. ftruncate($this->stdout, 0);
  44925. fseek($this->stdout, 0);
  44926. $this->incrementalOutputOffset = 0;
  44927. return $this;
  44928. }
  44929. public function getErrorOutput()
  44930. {
  44931. $this->readPipesForOutput(__FUNCTION__);
  44932. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  44933. return '';
  44934. }
  44935. return $ret;
  44936. }
  44937. public function getIncrementalErrorOutput()
  44938. {
  44939. $this->readPipesForOutput(__FUNCTION__);
  44940. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  44941. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  44942. if (false === $latest) {
  44943. return '';
  44944. }
  44945. return $latest;
  44946. }
  44947. public function clearErrorOutput()
  44948. {
  44949. ftruncate($this->stderr, 0);
  44950. fseek($this->stderr, 0);
  44951. $this->incrementalErrorOutputOffset = 0;
  44952. return $this;
  44953. }
  44954. public function getExitCode()
  44955. {
  44956. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  44957. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  44958. }
  44959. $this->updateStatus(false);
  44960. return $this->exitcode;
  44961. }
  44962. public function getExitCodeText()
  44963. {
  44964. if (null === $exitcode = $this->getExitCode()) {
  44965. return;
  44966. }
  44967. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  44968. }
  44969. public function isSuccessful()
  44970. {
  44971. return 0 === $this->getExitCode();
  44972. }
  44973. public function hasBeenSignaled()
  44974. {
  44975. $this->requireProcessIsTerminated(__FUNCTION__);
  44976. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  44977. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  44978. }
  44979. return $this->processInformation['signaled'];
  44980. }
  44981. public function getTermSignal()
  44982. {
  44983. $this->requireProcessIsTerminated(__FUNCTION__);
  44984. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  44985. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  44986. }
  44987. return $this->processInformation['termsig'];
  44988. }
  44989. public function hasBeenStopped()
  44990. {
  44991. $this->requireProcessIsTerminated(__FUNCTION__);
  44992. return $this->processInformation['stopped'];
  44993. }
  44994. public function getStopSignal()
  44995. {
  44996. $this->requireProcessIsTerminated(__FUNCTION__);
  44997. return $this->processInformation['stopsig'];
  44998. }
  44999. public function isRunning()
  45000. {
  45001. if (self::STATUS_STARTED !== $this->status) {
  45002. return false;
  45003. }
  45004. $this->updateStatus(false);
  45005. return $this->processInformation['running'];
  45006. }
  45007. public function isStarted()
  45008. {
  45009. return self::STATUS_READY != $this->status;
  45010. }
  45011. public function isTerminated()
  45012. {
  45013. $this->updateStatus(false);
  45014. return self::STATUS_TERMINATED == $this->status;
  45015. }
  45016. public function getStatus()
  45017. {
  45018. $this->updateStatus(false);
  45019. return $this->status;
  45020. }
  45021. public function stop($timeout = 10, $signal = null)
  45022. {
  45023. $timeoutMicro = microtime(true) + $timeout;
  45024. if ($this->isRunning()) {
  45025. $this->doSignal(15, false);
  45026. do {
  45027. usleep(1000);
  45028. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  45029. if ($this->isRunning()) {
  45030. $this->doSignal($signal ?: 9, false);
  45031. }
  45032. }
  45033. if ($this->isRunning()) {
  45034. if (isset($this->fallbackStatus['pid'])) {
  45035. unset($this->fallbackStatus['pid']);
  45036. return $this->stop(0, $signal);
  45037. }
  45038. $this->close();
  45039. }
  45040. return $this->exitcode;
  45041. }
  45042. public function addOutput($line)
  45043. {
  45044. $this->lastOutputTime = microtime(true);
  45045. fseek($this->stdout, 0, SEEK_END);
  45046. fwrite($this->stdout, $line);
  45047. fseek($this->stdout, $this->incrementalOutputOffset);
  45048. }
  45049. public function addErrorOutput($line)
  45050. {
  45051. $this->lastOutputTime = microtime(true);
  45052. fseek($this->stderr, 0, SEEK_END);
  45053. fwrite($this->stderr, $line);
  45054. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  45055. }
  45056. public function getCommandLine()
  45057. {
  45058. return $this->commandline;
  45059. }
  45060. public function setCommandLine($commandline)
  45061. {
  45062. $this->commandline = $commandline;
  45063. return $this;
  45064. }
  45065. public function getTimeout()
  45066. {
  45067. return $this->timeout;
  45068. }
  45069. public function getIdleTimeout()
  45070. {
  45071. return $this->idleTimeout;
  45072. }
  45073. public function setTimeout($timeout)
  45074. {
  45075. $this->timeout = $this->validateTimeout($timeout);
  45076. return $this;
  45077. }
  45078. public function setIdleTimeout($timeout)
  45079. {
  45080. if (null !== $timeout && $this->outputDisabled) {
  45081. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  45082. }
  45083. $this->idleTimeout = $this->validateTimeout($timeout);
  45084. return $this;
  45085. }
  45086. public function setTty($tty)
  45087. {
  45088. if ('\\' === DIRECTORY_SEPARATOR && $tty) {
  45089. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  45090. }
  45091. if ($tty) {
  45092. static $isTtySupported;
  45093. if (null === $isTtySupported) {
  45094. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);
  45095. }
  45096. if (!$isTtySupported) {
  45097. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  45098. }
  45099. }
  45100. $this->tty = (bool) $tty;
  45101. return $this;
  45102. }
  45103. public function isTty()
  45104. {
  45105. return $this->tty;
  45106. }
  45107. public function setPty($bool)
  45108. {
  45109. $this->pty = (bool) $bool;
  45110. return $this;
  45111. }
  45112. public function isPty()
  45113. {
  45114. return $this->pty;
  45115. }
  45116. public function getWorkingDirectory()
  45117. {
  45118. if (null === $this->cwd) {
  45119. return getcwd() ?: null;
  45120. }
  45121. return $this->cwd;
  45122. }
  45123. public function setWorkingDirectory($cwd)
  45124. {
  45125. $this->cwd = $cwd;
  45126. return $this;
  45127. }
  45128. public function getEnv()
  45129. {
  45130. return $this->env;
  45131. }
  45132. public function setEnv(array $env)
  45133. {
  45134. $env = array_filter($env, function ($value) {
  45135. return !is_array($value);
  45136. });
  45137. $this->env = array();
  45138. foreach ($env as $key => $value) {
  45139. $this->env[$key] = (string) $value;
  45140. }
  45141. return $this;
  45142. }
  45143. public function getStdin()
  45144. {
  45145. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  45146. return $this->getInput();
  45147. }
  45148. public function getInput()
  45149. {
  45150. return $this->input;
  45151. }
  45152. public function setStdin($stdin)
  45153. {
  45154. @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  45155. return $this->setInput($stdin);
  45156. }
  45157. public function setInput($input)
  45158. {
  45159. if ($this->isRunning()) {
  45160. throw new LogicException('Input can not be set while the process is running.');
  45161. }
  45162. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  45163. return $this;
  45164. }
  45165. public function getOptions()
  45166. {
  45167. return $this->options;
  45168. }
  45169. public function setOptions(array $options)
  45170. {
  45171. $this->options = $options;
  45172. return $this;
  45173. }
  45174. public function getEnhanceWindowsCompatibility()
  45175. {
  45176. return $this->enhanceWindowsCompatibility;
  45177. }
  45178. public function setEnhanceWindowsCompatibility($enhance)
  45179. {
  45180. $this->enhanceWindowsCompatibility = (bool) $enhance;
  45181. return $this;
  45182. }
  45183. public function getEnhanceSigchildCompatibility()
  45184. {
  45185. return $this->enhanceSigchildCompatibility;
  45186. }
  45187. public function setEnhanceSigchildCompatibility($enhance)
  45188. {
  45189. $this->enhanceSigchildCompatibility = (bool) $enhance;
  45190. return $this;
  45191. }
  45192. public function checkTimeout()
  45193. {
  45194. if (self::STATUS_STARTED !== $this->status) {
  45195. return;
  45196. }
  45197. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  45198. $this->stop(0);
  45199. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  45200. }
  45201. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  45202. $this->stop(0);
  45203. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  45204. }
  45205. }
  45206. public static function isPtySupported()
  45207. {
  45208. static $result;
  45209. if (null !== $result) {
  45210. return $result;
  45211. }
  45212. if ('\\' === DIRECTORY_SEPARATOR) {
  45213. return $result = false;
  45214. }
  45215. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  45216. }
  45217. private function getDescriptors()
  45218. {
  45219. if ('\\' === DIRECTORY_SEPARATOR) {
  45220. $this->processPipes = WindowsPipes::create($this, $this->input);
  45221. } else {
  45222. $this->processPipes = UnixPipes::create($this, $this->input);
  45223. }
  45224. return $this->processPipes->getDescriptors();
  45225. }
  45226. protected function buildCallback($callback)
  45227. {
  45228. $that = $this;
  45229. $out = self::OUT;
  45230. $callback = function ($type, $data) use ($that, $callback, $out) {
  45231. if ($out == $type) {
  45232. $that->addOutput($data);
  45233. } else {
  45234. $that->addErrorOutput($data);
  45235. }
  45236. if (null !== $callback) {
  45237. call_user_func($callback, $type, $data);
  45238. }
  45239. };
  45240. return $callback;
  45241. }
  45242. protected function updateStatus($blocking)
  45243. {
  45244. if (self::STATUS_STARTED !== $this->status) {
  45245. return;
  45246. }
  45247. $this->processInformation = proc_get_status($this->process);
  45248. $running = $this->processInformation['running'];
  45249. $this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
  45250. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45251. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  45252. }
  45253. if (!$running) {
  45254. $this->close();
  45255. }
  45256. }
  45257. protected function isSigchildEnabled()
  45258. {
  45259. if (null !== self::$sigchild) {
  45260. return self::$sigchild;
  45261. }
  45262. if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
  45263. return self::$sigchild = false;
  45264. }
  45265. ob_start();
  45266. phpinfo(INFO_GENERAL);
  45267. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  45268. }
  45269. private function readPipesForOutput($caller)
  45270. {
  45271. if ($this->outputDisabled) {
  45272. throw new LogicException('Output has been disabled.');
  45273. }
  45274. $this->requireProcessIsStarted($caller);
  45275. $this->updateStatus(false);
  45276. }
  45277. private function validateTimeout($timeout)
  45278. {
  45279. $timeout = (float) $timeout;
  45280. if (0.0 === $timeout) {
  45281. $timeout = null;
  45282. } elseif ($timeout < 0) {
  45283. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  45284. }
  45285. return $timeout;
  45286. }
  45287. private function readPipes($blocking, $close)
  45288. {
  45289. $result = $this->processPipes->readAndWrite($blocking, $close);
  45290. $callback = $this->callback;
  45291. foreach ($result as $type => $data) {
  45292. if (3 !== $type) {
  45293. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  45294. } elseif (!isset($this->fallbackStatus['signaled'])) {
  45295. $this->fallbackStatus['exitcode'] = (int) $data;
  45296. }
  45297. }
  45298. }
  45299. private function close()
  45300. {
  45301. $this->processPipes->close();
  45302. if (is_resource($this->process)) {
  45303. proc_close($this->process);
  45304. }
  45305. $this->exitcode = $this->processInformation['exitcode'];
  45306. $this->status = self::STATUS_TERMINATED;
  45307. if (-1 === $this->exitcode) {
  45308. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  45309. $this->exitcode = 128 + $this->processInformation['termsig'];
  45310. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  45311. $this->processInformation['signaled'] = true;
  45312. $this->processInformation['termsig'] = -1;
  45313. }
  45314. }
  45315. $this->callback = null;
  45316. return $this->exitcode;
  45317. }
  45318. private function resetProcessData()
  45319. {
  45320. $this->starttime = null;
  45321. $this->callback = null;
  45322. $this->exitcode = null;
  45323. $this->fallbackStatus = array();
  45324. $this->processInformation = null;
  45325. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  45326. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+');
  45327. $this->process = null;
  45328. $this->latestSignal = null;
  45329. $this->status = self::STATUS_READY;
  45330. $this->incrementalOutputOffset = 0;
  45331. $this->incrementalErrorOutputOffset = 0;
  45332. }
  45333. private function doSignal($signal, $throwException)
  45334. {
  45335. if (null === $pid = $this->getPid()) {
  45336. if ($throwException) {
  45337. throw new LogicException('Can not send signal on a non running process.');
  45338. }
  45339. return false;
  45340. }
  45341. if ('\\' === DIRECTORY_SEPARATOR) {
  45342. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  45343. if ($exitCode && $this->isRunning()) {
  45344. if ($throwException) {
  45345. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  45346. }
  45347. return false;
  45348. }
  45349. } else {
  45350. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  45351. $ok = @proc_terminate($this->process, $signal);
  45352. } elseif (function_exists('posix_kill')) {
  45353. $ok = @posix_kill($pid, $signal);
  45354. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  45355. $ok = false === fgets($pipes[2]);
  45356. }
  45357. if (!$ok) {
  45358. if ($throwException) {
  45359. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  45360. }
  45361. return false;
  45362. }
  45363. }
  45364. $this->latestSignal = (int) $signal;
  45365. $this->fallbackStatus['signaled'] = true;
  45366. $this->fallbackStatus['exitcode'] = -1;
  45367. $this->fallbackStatus['termsig'] = $this->latestSignal;
  45368. return true;
  45369. }
  45370. private function requireProcessIsStarted($functionName)
  45371. {
  45372. if (!$this->isStarted()) {
  45373. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  45374. }
  45375. }
  45376. private function requireProcessIsTerminated($functionName)
  45377. {
  45378. if (!$this->isTerminated()) {
  45379. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  45380. }
  45381. }
  45382. }
  45383. <?php
  45384. namespace Symfony\Component\Process;
  45385. use Symfony\Component\Process\Exception\InvalidArgumentException;
  45386. use Symfony\Component\Process\Exception\LogicException;
  45387. class ProcessBuilder
  45388. {
  45389. private $arguments;
  45390. private $cwd;
  45391. private $env = array();
  45392. private $input;
  45393. private $timeout = 60;
  45394. private $options = array();
  45395. private $inheritEnv = true;
  45396. private $prefix = array();
  45397. private $outputDisabled = false;
  45398. public function __construct(array $arguments = array())
  45399. {
  45400. $this->arguments = $arguments;
  45401. }
  45402. public static function create(array $arguments = array())
  45403. {
  45404. return new static($arguments);
  45405. }
  45406. public function add($argument)
  45407. {
  45408. $this->arguments[] = $argument;
  45409. return $this;
  45410. }
  45411. public function setPrefix($prefix)
  45412. {
  45413. $this->prefix = is_array($prefix) ? $prefix : array($prefix);
  45414. return $this;
  45415. }
  45416. public function setArguments(array $arguments)
  45417. {
  45418. $this->arguments = $arguments;
  45419. return $this;
  45420. }
  45421. public function setWorkingDirectory($cwd)
  45422. {
  45423. $this->cwd = $cwd;
  45424. return $this;
  45425. }
  45426. public function inheritEnvironmentVariables($inheritEnv = true)
  45427. {
  45428. $this->inheritEnv = $inheritEnv;
  45429. return $this;
  45430. }
  45431. public function setEnv($name, $value)
  45432. {
  45433. $this->env[$name] = $value;
  45434. return $this;
  45435. }
  45436. public function addEnvironmentVariables(array $variables)
  45437. {
  45438. $this->env = array_replace($this->env, $variables);
  45439. return $this;
  45440. }
  45441. public function setInput($input)
  45442. {
  45443. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  45444. return $this;
  45445. }
  45446. public function setTimeout($timeout)
  45447. {
  45448. if (null === $timeout) {
  45449. $this->timeout = null;
  45450. return $this;
  45451. }
  45452. $timeout = (float) $timeout;
  45453. if ($timeout < 0) {
  45454. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  45455. }
  45456. $this->timeout = $timeout;
  45457. return $this;
  45458. }
  45459. public function setOption($name, $value)
  45460. {
  45461. $this->options[$name] = $value;
  45462. return $this;
  45463. }
  45464. public function disableOutput()
  45465. {
  45466. $this->outputDisabled = true;
  45467. return $this;
  45468. }
  45469. public function enableOutput()
  45470. {
  45471. $this->outputDisabled = false;
  45472. return $this;
  45473. }
  45474. public function getProcess()
  45475. {
  45476. if (0 === count($this->prefix) && 0 === count($this->arguments)) {
  45477. throw new LogicException('You must add() command arguments before calling getProcess().');
  45478. }
  45479. $options = $this->options;
  45480. $arguments = array_merge($this->prefix, $this->arguments);
  45481. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  45482. if ($this->inheritEnv) {
  45483. $env = array_replace($_ENV, $_SERVER, $this->env);
  45484. } else {
  45485. $env = $this->env;
  45486. }
  45487. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  45488. if ($this->outputDisabled) {
  45489. $process->disableOutput();
  45490. }
  45491. return $process;
  45492. }
  45493. }
  45494. <?php
  45495. namespace Symfony\Component\Process;
  45496. use Symfony\Component\Process\Exception\InvalidArgumentException;
  45497. class ProcessUtils
  45498. {
  45499. private function __construct()
  45500. {
  45501. }
  45502. public static function escapeArgument($argument)
  45503. {
  45504. if ('\\' === DIRECTORY_SEPARATOR) {
  45505. if ('' === $argument) {
  45506. return escapeshellarg($argument);
  45507. }
  45508. $escapedArgument = '';
  45509. $quote = false;
  45510. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  45511. if ('"' === $part) {
  45512. $escapedArgument .= '\\"';
  45513. } elseif (self::isSurroundedBy($part, '%')) {
  45514. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  45515. } else {
  45516. if ('\\' === substr($part, -1)) {
  45517. $part .= '\\';
  45518. }
  45519. $quote = true;
  45520. $escapedArgument .= $part;
  45521. }
  45522. }
  45523. if ($quote) {
  45524. $escapedArgument = '"'.$escapedArgument.'"';
  45525. }
  45526. return $escapedArgument;
  45527. }
  45528. return "'".str_replace("'", "'\\''", $argument)."'";
  45529. }
  45530. public static function validateInput($caller, $input)
  45531. {
  45532. if (null !== $input) {
  45533. if (is_resource($input)) {
  45534. return $input;
  45535. }
  45536. if (is_string($input)) {
  45537. return $input;
  45538. }
  45539. if (is_scalar($input)) {
  45540. return (string) $input;
  45541. }
  45542. if (is_object($input) && method_exists($input, '__toString')) {
  45543. @trigger_error('Passing an object as an input is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  45544. return (string) $input;
  45545. }
  45546. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  45547. }
  45548. return $input;
  45549. }
  45550. private static function isSurroundedBy($arg, $char)
  45551. {
  45552. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  45553. }
  45554. }
  45555. Copyright (c) 2011 Jordi Boggiano
  45556. Permission is hereby granted, free of charge, to any person obtaining a copy
  45557. of this software and associated documentation files (the "Software"), to deal
  45558. in the Software without restriction, including without limitation the rights
  45559. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  45560. copies of the Software, and to permit persons to whom the Software is furnished
  45561. to do so, subject to the following conditions:
  45562. The above copyright notice and this permission notice shall be included in all
  45563. copies or substantial portions of the Software.
  45564. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  45565. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  45566. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  45567. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  45568. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  45569. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  45570. THE SOFTWARE.
  45571. <?php
  45572. namespace Seld\JsonLint;
  45573. class DuplicateKeyException extends ParsingException
  45574. {
  45575. public function __construct($message, $key, array $details = array())
  45576. {
  45577. $details['key'] = $key;
  45578. parent::__construct($message, $details);
  45579. }
  45580. public function getKey()
  45581. {
  45582. return $this->details['key'];
  45583. }
  45584. }
  45585. <?php
  45586. namespace Seld\JsonLint;
  45587. use stdClass;
  45588. class JsonParser
  45589. {
  45590. const DETECT_KEY_CONFLICTS = 1;
  45591. const ALLOW_DUPLICATE_KEYS = 2;
  45592. const PARSE_TO_ASSOC = 4;
  45593. private $lexer;
  45594. private $flags;
  45595. private $stack;
  45596. private $vstack;
  45597. private $lstack;
  45598. private $symbols = array(
  45599. 'error' => 2,
  45600. 'JSONString' => 3,
  45601. 'STRING' => 4,
  45602. 'JSONNumber' => 5,
  45603. 'NUMBER' => 6,
  45604. 'JSONNullLiteral' => 7,
  45605. 'NULL' => 8,
  45606. 'JSONBooleanLiteral' => 9,
  45607. 'TRUE' => 10,
  45608. 'FALSE' => 11,
  45609. 'JSONText' => 12,
  45610. 'JSONValue' => 13,
  45611. 'EOF' => 14,
  45612. 'JSONObject' => 15,
  45613. 'JSONArray' => 16,
  45614. '{' => 17,
  45615. '}' => 18,
  45616. 'JSONMemberList' => 19,
  45617. 'JSONMember' => 20,
  45618. ':' => 21,
  45619. ',' => 22,
  45620. '[' => 23,
  45621. ']' => 24,
  45622. 'JSONElementList' => 25,
  45623. '$accept' => 0,
  45624. '$end' => 1,
  45625. );
  45626. private $terminals_ = array(
  45627. 2 => "error",
  45628. 4 => "STRING",
  45629. 6 => "NUMBER",
  45630. 8 => "NULL",
  45631. 10 => "TRUE",
  45632. 11 => "FALSE",
  45633. 14 => "EOF",
  45634. 17 => "{",
  45635. 18 => "}",
  45636. 21 => ":",
  45637. 22 => ",",
  45638. 23 => "[",
  45639. 24 => "]",
  45640. );
  45641. private $productions_ = array(
  45642. 0,
  45643. array(3, 1),
  45644. array(5, 1),
  45645. array(7, 1),
  45646. array(9, 1),
  45647. array(9, 1),
  45648. array(12, 2),
  45649. array(13, 1),
  45650. array(13, 1),
  45651. array(13, 1),
  45652. array(13, 1),
  45653. array(13, 1),
  45654. array(13, 1),
  45655. array(15, 2),
  45656. array(15, 3),
  45657. array(20, 3),
  45658. array(19, 1),
  45659. array(19, 3),
  45660. array(16, 2),
  45661. array(16, 3),
  45662. array(25, 1),
  45663. array(25, 3)
  45664. );
  45665. private $table = array(array(3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 1 => array(3)), array( 14 => array(1,16)), array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)), array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)), array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)), array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)), array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)), array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)), array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)), array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)), array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)), array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)), array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)), array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ), array( 1 => array(2,6)), array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)), array( 18 => array(1,24), 22 => array(1,25)), array( 18 => array(2,16), 22 => array(2,16)), array( 21 => array(1,26)), array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)), array( 22 => array(1,28), 24 => array(1,27)), array( 22 => array(2,20), 24 => array(2,20)), array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)), array( 3 => 20, 4 => array(1,12), 20 => 29 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 18 => array(2,17), 22 => array(2,17)), array( 18 => array(2,15), 22 => array(2,15)), array( 22 => array(2,21), 24 => array(2,21)),
  45666. );
  45667. private $defaultActions = array(
  45668. 16 => array(2, 6)
  45669. );
  45670. public function lint($input, $flags = 0)
  45671. {
  45672. try {
  45673. $this->parse($input, $flags);
  45674. } catch (ParsingException $e) {
  45675. return $e;
  45676. }
  45677. }
  45678. public function parse($input, $flags = 0)
  45679. {
  45680. $this->failOnBOM($input);
  45681. $this->flags = $flags;
  45682. $this->stack = array(0);
  45683. $this->vstack = array(null);
  45684. $this->lstack = array();
  45685. $yytext = '';
  45686. $yylineno = 0;
  45687. $yyleng = 0;
  45688. $recovering = 0;
  45689. $TERROR = 2;
  45690. $EOF = 1;
  45691. $this->lexer = new Lexer();
  45692. $this->lexer->setInput($input);
  45693. $yyloc = $this->lexer->yylloc;
  45694. $this->lstack[] = $yyloc;
  45695. $symbol = null;
  45696. $preErrorSymbol = null;
  45697. $state = null;
  45698. $action = null;
  45699. $a = null;
  45700. $r = null;
  45701. $yyval = new stdClass;
  45702. $p = null;
  45703. $len = null;
  45704. $newState = null;
  45705. $expected = null;
  45706. $errStr = null;
  45707. while (true) {
  45708. $state = $this->stack[count($this->stack)-1];
  45709. if (isset($this->defaultActions[$state])) {
  45710. $action = $this->defaultActions[$state];
  45711. } else {
  45712. if ($symbol == null) {
  45713. $symbol = $this->lex();
  45714. }
  45715. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  45716. }
  45717. if (!$action || !$action[0]) {
  45718. if (!$recovering) {
  45719. $expected = array();
  45720. foreach ($this->table[$state] as $p => $ignore) {
  45721. if (isset($this->terminals_[$p]) && $p > 2) {
  45722. $expected[] = "'" . $this->terminals_[$p] . "'";
  45723. }
  45724. }
  45725. $message = null;
  45726. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  45727. $message = "Invalid string";
  45728. if ("'" === substr($this->lexer->match, 0, 1)) {
  45729. $message .= ", it appears you used single quotes instead of double quotes";
  45730. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  45731. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  45732. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  45733. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  45734. }
  45735. }
  45736. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  45737. $errStr .= $this->lexer->showPosition() . "\n";
  45738. if ($message) {
  45739. $errStr .= $message;
  45740. } else {
  45741. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  45742. $errStr .= implode(', ', $expected);
  45743. }
  45744. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  45745. $errStr .= " - It appears you have an extra trailing comma";
  45746. }
  45747. $this->parseError($errStr, array(
  45748. 'text' => $this->lexer->match,
  45749. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  45750. 'line' => $this->lexer->yylineno,
  45751. 'loc' => $yyloc,
  45752. 'expected' => $expected,
  45753. ));
  45754. }
  45755. if ($recovering == 3) {
  45756. if ($symbol == $EOF) {
  45757. throw new ParsingException($errStr ?: 'Parsing halted.');
  45758. }
  45759. $yyleng = $this->lexer->yyleng;
  45760. $yytext = $this->lexer->yytext;
  45761. $yylineno = $this->lexer->yylineno;
  45762. $yyloc = $this->lexer->yylloc;
  45763. $symbol = $this->lex();
  45764. }
  45765. while (true) {
  45766. if (array_key_exists($TERROR, $this->table[$state])) {
  45767. break;
  45768. }
  45769. if ($state == 0) {
  45770. throw new ParsingException($errStr ?: 'Parsing halted.');
  45771. }
  45772. $this->popStack(1);
  45773. $state = $this->stack[count($this->stack)-1];
  45774. }
  45775. $preErrorSymbol = $symbol;
  45776. $symbol = $TERROR;
  45777. $state = $this->stack[count($this->stack)-1];
  45778. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  45779. $recovering = 3;
  45780. }
  45781. if (is_array($action[0]) && count($action) > 1) {
  45782. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  45783. }
  45784. switch ($action[0]) {
  45785. case 1:
  45786. $this->stack[] = $symbol;
  45787. $this->vstack[] = $this->lexer->yytext;
  45788. $this->lstack[] = $this->lexer->yylloc;
  45789. $this->stack[] = $action[1];
  45790. $symbol = null;
  45791. if (!$preErrorSymbol) {
  45792. $yyleng = $this->lexer->yyleng;
  45793. $yytext = $this->lexer->yytext;
  45794. $yylineno = $this->lexer->yylineno;
  45795. $yyloc = $this->lexer->yylloc;
  45796. if ($recovering > 0) {
  45797. $recovering--;
  45798. }
  45799. } else {
  45800. $symbol = $preErrorSymbol;
  45801. $preErrorSymbol = null;
  45802. }
  45803. break;
  45804. case 2:
  45805. $len = $this->productions_[$action[1]][1];
  45806. $yyval->token = $this->vstack[count($this->vstack) - $len];
  45807. $yyval->store = array(
  45808. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  45809. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  45810. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  45811. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  45812. );
  45813. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  45814. if (!$r instanceof Undefined) {
  45815. return $r;
  45816. }
  45817. if ($len) {
  45818. $this->popStack($len);
  45819. }
  45820. $this->stack[] = $this->productions_[$action[1]][0];
  45821. $this->vstack[] = $yyval->token;
  45822. $this->lstack[] = $yyval->store;
  45823. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  45824. $this->stack[] = $newState;
  45825. break;
  45826. case 3:
  45827. return true;
  45828. }
  45829. }
  45830. return true;
  45831. }
  45832. protected function parseError($str, $hash)
  45833. {
  45834. throw new ParsingException($str, $hash);
  45835. }
  45836. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  45837. {
  45838. $len = count($tokens) - 1;
  45839. switch ($yystate) {
  45840. case 1:
  45841. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  45842. $yyval->token = $yytext;
  45843. break;
  45844. case 2:
  45845. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  45846. $yyval->token = floatval($yytext);
  45847. } else {
  45848. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  45849. }
  45850. break;
  45851. case 3:
  45852. $yyval->token = null;
  45853. break;
  45854. case 4:
  45855. $yyval->token = true;
  45856. break;
  45857. case 5:
  45858. $yyval->token = false;
  45859. break;
  45860. case 6:
  45861. return $yyval->token = $tokens[$len-1];
  45862. case 13:
  45863. if ($this->flags & self::PARSE_TO_ASSOC) {
  45864. $yyval->token = array();
  45865. } else {
  45866. $yyval->token = new stdClass;
  45867. }
  45868. break;
  45869. case 14:
  45870. $yyval->token = $tokens[$len-1];
  45871. break;
  45872. case 15:
  45873. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  45874. break;
  45875. case 16:
  45876. if (PHP_VERSION_ID < 70100) {
  45877. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  45878. } else {
  45879. $property = $tokens[$len][0];
  45880. }
  45881. if ($this->flags & self::PARSE_TO_ASSOC) {
  45882. $yyval->token = array();
  45883. $yyval->token[$property] = $tokens[$len][1];
  45884. } else {
  45885. $yyval->token = new stdClass;
  45886. $yyval->token->$property = $tokens[$len][1];
  45887. }
  45888. break;
  45889. case 17:
  45890. if ($this->flags & self::PARSE_TO_ASSOC) {
  45891. $yyval->token =& $tokens[$len-2];
  45892. $key = $tokens[$len][0];
  45893. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  45894. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  45895. $errStr .= $this->lexer->showPosition() . "\n";
  45896. $errStr .= "Duplicate key: ".$tokens[$len][0];
  45897. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  45898. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  45899. $duplicateCount = 1;
  45900. do {
  45901. $duplicateKey = $key . '.' . $duplicateCount++;
  45902. } while (isset($tokens[$len-2][$duplicateKey]));
  45903. $key = $duplicateKey;
  45904. }
  45905. $tokens[$len-2][$key] = $tokens[$len][1];
  45906. } else {
  45907. $yyval->token = $tokens[$len-2];
  45908. if (PHP_VERSION_ID < 70100) {
  45909. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  45910. } else {
  45911. $key = $tokens[$len][0];
  45912. }
  45913. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  45914. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  45915. $errStr .= $this->lexer->showPosition() . "\n";
  45916. $errStr .= "Duplicate key: ".$tokens[$len][0];
  45917. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  45918. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  45919. $duplicateCount = 1;
  45920. do {
  45921. $duplicateKey = $key . '.' . $duplicateCount++;
  45922. } while (isset($tokens[$len-2]->$duplicateKey));
  45923. $key = $duplicateKey;
  45924. }
  45925. $tokens[$len-2]->$key = $tokens[$len][1];
  45926. }
  45927. break;
  45928. case 18:
  45929. $yyval->token = array();
  45930. break;
  45931. case 19:
  45932. $yyval->token = $tokens[$len-1];
  45933. break;
  45934. case 20:
  45935. $yyval->token = array($tokens[$len]);
  45936. break;
  45937. case 21:
  45938. $tokens[$len-2][] = $tokens[$len];
  45939. $yyval->token = $tokens[$len-2];
  45940. break;
  45941. }
  45942. return new Undefined();
  45943. }
  45944. private function stringInterpolation($match)
  45945. {
  45946. switch ($match[0]) {
  45947. case '\\\\':
  45948. return '\\';
  45949. case '\"':
  45950. return '"';
  45951. case '\b':
  45952. return chr(8);
  45953. case '\f':
  45954. return chr(12);
  45955. case '\n':
  45956. return "\n";
  45957. case '\r':
  45958. return "\r";
  45959. case '\t':
  45960. return "\t";
  45961. case '\/':
  45962. return "/";
  45963. default:
  45964. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
  45965. }
  45966. }
  45967. private function popStack($n)
  45968. {
  45969. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  45970. $this->vstack = array_slice($this->vstack, 0, - $n);
  45971. $this->lstack = array_slice($this->lstack, 0, - $n);
  45972. }
  45973. private function lex()
  45974. {
  45975. $token = $this->lexer->lex() ?: 1;
  45976. if (!is_numeric($token)) {
  45977. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  45978. }
  45979. return $token;
  45980. }
  45981. private function failOnBOM($input)
  45982. {
  45983. $bom = "\xEF\xBB\xBF";
  45984. if (substr($input, 0, 3) === $bom) {
  45985. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  45986. }
  45987. }
  45988. }
  45989. <?php
  45990. namespace Seld\JsonLint;
  45991. class Lexer
  45992. {
  45993. private $EOF = 1;
  45994. private $rules = array(
  45995. 0 => '/^\s+/',
  45996. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  45997. 2 => '{^"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  45998. 3 => '/^\{/',
  45999. 4 => '/^\}/',
  46000. 5 => '/^\[/',
  46001. 6 => '/^\]/',
  46002. 7 => '/^,/',
  46003. 8 => '/^:/',
  46004. 9 => '/^true\b/',
  46005. 10 => '/^false\b/',
  46006. 11 => '/^null\b/',
  46007. 12 => '/^$/',
  46008. 13 => '/^./',
  46009. );
  46010. private $conditions = array(
  46011. "INITIAL" => array(
  46012. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  46013. "inclusive" => true,
  46014. ),
  46015. );
  46016. private $conditionStack;
  46017. private $input;
  46018. private $more;
  46019. private $done;
  46020. private $matched;
  46021. public $match;
  46022. public $yylineno;
  46023. public $yyleng;
  46024. public $yytext;
  46025. public $yylloc;
  46026. public function lex()
  46027. {
  46028. $r = $this->next();
  46029. if (!$r instanceof Undefined) {
  46030. return $r;
  46031. }
  46032. return $this->lex();
  46033. }
  46034. public function setInput($input)
  46035. {
  46036. $this->input = $input;
  46037. $this->more = false;
  46038. $this->done = false;
  46039. $this->yylineno = $this->yyleng = 0;
  46040. $this->yytext = $this->matched = $this->match = '';
  46041. $this->conditionStack = array('INITIAL');
  46042. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  46043. return $this;
  46044. }
  46045. public function showPosition()
  46046. {
  46047. $pre = str_replace("\n", '', $this->getPastInput());
  46048. $c = str_repeat('-', max(0, strlen($pre) - 1));
  46049. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  46050. }
  46051. public function getPastInput()
  46052. {
  46053. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  46054. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  46055. }
  46056. public function getUpcomingInput()
  46057. {
  46058. $next = $this->match;
  46059. if (strlen($next) < 20) {
  46060. $next .= substr($this->input, 0, 20 - strlen($next));
  46061. }
  46062. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  46063. }
  46064. protected function parseError($str, $hash)
  46065. {
  46066. throw new \Exception($str);
  46067. }
  46068. private function next()
  46069. {
  46070. if ($this->done) {
  46071. return $this->EOF;
  46072. }
  46073. if ($this->input === '') {
  46074. $this->done = true;
  46075. }
  46076. $token = null;
  46077. $match = null;
  46078. $col = null;
  46079. $lines = null;
  46080. if (!$this->more) {
  46081. $this->yytext = '';
  46082. $this->match = '';
  46083. }
  46084. $rules = $this->getCurrentRules();
  46085. $rulesLen = count($rules);
  46086. for ($i=0; $i < $rulesLen; $i++) {
  46087. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  46088. preg_match_all('/\n.*/', $match[0], $lines);
  46089. $lines = $lines[0];
  46090. if ($lines) {
  46091. $this->yylineno += count($lines);
  46092. }
  46093. $this->yylloc = array(
  46094. 'first_line' => $this->yylloc['last_line'],
  46095. 'last_line' => $this->yylineno+1,
  46096. 'first_column' => $this->yylloc['last_column'],
  46097. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  46098. );
  46099. $this->yytext .= $match[0];
  46100. $this->match .= $match[0];
  46101. $this->yyleng = strlen($this->yytext);
  46102. $this->more = false;
  46103. $this->input = substr($this->input, strlen($match[0]));
  46104. $this->matched .= $match[0];
  46105. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  46106. if ($token) {
  46107. return $token;
  46108. }
  46109. return new Undefined();
  46110. }
  46111. }
  46112. if ($this->input === "") {
  46113. return $this->EOF;
  46114. }
  46115. $this->parseError(
  46116. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  46117. array(
  46118. 'text' => "",
  46119. 'token' => null,
  46120. 'line' => $this->yylineno,
  46121. )
  46122. );
  46123. }
  46124. private function getCurrentRules()
  46125. {
  46126. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  46127. }
  46128. private function performAction($avoiding_name_collisions, $YY_START)
  46129. {
  46130. switch ($avoiding_name_collisions) {
  46131. case 0:
  46132. break;
  46133. case 1:
  46134. return 6;
  46135. break;
  46136. case 2:
  46137. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  46138. return 4;
  46139. case 3:
  46140. return 17;
  46141. case 4:
  46142. return 18;
  46143. case 5:
  46144. return 23;
  46145. case 6:
  46146. return 24;
  46147. case 7:
  46148. return 22;
  46149. case 8:
  46150. return 21;
  46151. case 9:
  46152. return 10;
  46153. case 10:
  46154. return 11;
  46155. case 11:
  46156. return 8;
  46157. case 12:
  46158. return 14;
  46159. case 13:
  46160. return 'INVALID';
  46161. }
  46162. }
  46163. }
  46164. <?php
  46165. namespace Seld\JsonLint;
  46166. class ParsingException extends \Exception
  46167. {
  46168. protected $details;
  46169. public function __construct($message, $details = array())
  46170. {
  46171. $this->details = $details;
  46172. parent::__construct($message);
  46173. }
  46174. public function getDetails()
  46175. {
  46176. return $this->details;
  46177. }
  46178. }
  46179. <?php
  46180. namespace Seld\JsonLint;
  46181. class Undefined
  46182. {
  46183. }
  46184. Copyright (c) 2015 Jordi Boggiano
  46185. Permission is hereby granted, free of charge, to any person obtaining a copy
  46186. of this software and associated documentation files (the "Software"), to deal
  46187. in the Software without restriction, including without limitation the rights
  46188. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46189. copies of the Software, and to permit persons to whom the Software is furnished
  46190. to do so, subject to the following conditions:
  46191. The above copyright notice and this permission notice shall be included in all
  46192. copies or substantial portions of the Software.
  46193. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46194. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46195. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46196. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46197. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46198. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  46199. THE SOFTWARE.
  46200. <?php
  46201. require __DIR__.'/../vendor/autoload.php';
  46202. echo 'Say hello (visible): ';
  46203. $answer = Seld\CliPrompt\CliPrompt::prompt();
  46204. echo 'You answered: '.$answer . PHP_EOL;
  46205. echo 'Say hello (hidden): ';
  46206. $answer = Seld\CliPrompt\CliPrompt::hiddenPrompt();
  46207. echo 'You answered: '.$answer . PHP_EOL;
  46208. <?php
  46209. namespace Seld\CliPrompt;
  46210. class CliPrompt
  46211. {
  46212. public static function prompt()
  46213. {
  46214. $stdin = fopen('php://stdin', 'r');
  46215. $answer = self::trimAnswer(fgets($stdin, 4096));
  46216. fclose($stdin);
  46217. return $answer;
  46218. }
  46219. public static function hiddenPrompt($allowFallback = false)
  46220. {
  46221. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  46222. $exe = __DIR__.'\\..\\res\\hiddeninput.exe';
  46223. if ('phar:' === substr(__FILE__, 0, 5)) {
  46224. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  46225. $source = fopen($exe, 'r');
  46226. $target = fopen($tmpExe, 'w+');
  46227. stream_copy_to_stream($source, $target);
  46228. fclose($source);
  46229. fclose($target);
  46230. unset($source, $target);
  46231. $exe = $tmpExe;
  46232. }
  46233. $output = shell_exec($exe);
  46234. if (isset($tmpExe)) {
  46235. unlink($tmpExe);
  46236. }
  46237. if ($output !== null) {
  46238. echo PHP_EOL;
  46239. return self::trimAnswer($output);
  46240. }
  46241. }
  46242. if (file_exists('/usr/bin/env')) {
  46243. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  46244. foreach (array('bash', 'zsh', 'ksh', 'csh', 'sh') as $sh) {
  46245. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  46246. $shell = $sh;
  46247. break;
  46248. }
  46249. }
  46250. if (isset($shell)) {
  46251. $readCmd = ($shell === 'csh') ? 'set mypassword = $<' : 'read -r mypassword';
  46252. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  46253. $output = shell_exec($command);
  46254. if ($output !== null) {
  46255. echo PHP_EOL;
  46256. return self::trimAnswer($output);
  46257. }
  46258. }
  46259. }
  46260. if (!$allowFallback) {
  46261. throw new \RuntimeException('Could not prompt for input in a secure fashion, aborting');
  46262. }
  46263. return self::prompt();
  46264. }
  46265. private static function trimAnswer($str)
  46266. {
  46267. return preg_replace('{\r?\n$}D', '', $str);
  46268. }
  46269. }
  46270. MIT License
  46271. Copyright (c) 2016
  46272. Permission is hereby granted, free of charge, to any person obtaining a copy
  46273. of this software and associated documentation files (the "Software"), to deal
  46274. in the Software without restriction, including without limitation the rights
  46275. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46276. copies of the Software, and to permit persons to whom the Software is
  46277. furnished to do so, subject to the following conditions:
  46278. The above copyright notice and this permission notice shall be included in all
  46279. copies or substantial portions of the Software.
  46280. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46281. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46282. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46283. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46284. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46285. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  46286. SOFTWARE.
  46287. <?php
  46288. require __DIR__ . '/../vendor/autoload.php';
  46289. $data = json_decode(file_get_contents('data.json'));
  46290. $validator = new JsonSchema\Validator();
  46291. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  46292. if ($validator->isValid()) {
  46293. echo "The supplied JSON validates against the schema.\n";
  46294. } else {
  46295. echo "JSON does not validate. Violations:\n";
  46296. foreach ($validator->getErrors() as $error) {
  46297. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  46298. }
  46299. }
  46300. <?php
  46301. namespace JsonSchema\Constraints;
  46302. use JsonSchema\Entity\JsonPointer;
  46303. use JsonSchema\Exception\InvalidArgumentException;
  46304. use JsonSchema\Exception\ValidationException;
  46305. use JsonSchema\Validator;
  46306. class BaseConstraint
  46307. {
  46308. protected $errors = array();
  46309. protected $errorMask = Validator::ERROR_NONE;
  46310. protected $factory;
  46311. public function __construct(Factory $factory = null)
  46312. {
  46313. $this->factory = $factory ?: new Factory();
  46314. }
  46315. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  46316. {
  46317. $error = array(
  46318. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  46319. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  46320. 'message' => $message,
  46321. 'constraint' => $constraint,
  46322. 'context' => $this->factory->getErrorContext(),
  46323. );
  46324. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  46325. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  46326. }
  46327. if (is_array($more) && count($more) > 0) {
  46328. $error += $more;
  46329. }
  46330. $this->errors[] = $error;
  46331. $this->errorMask |= $error['context'];
  46332. }
  46333. public function addErrors(array $errors)
  46334. {
  46335. if ($errors) {
  46336. $this->errors = array_merge($this->errors, $errors);
  46337. $errorMask = &$this->errorMask;
  46338. array_walk($errors, function ($error) use (&$errorMask) {
  46339. if (isset($error['context'])) {
  46340. $errorMask |= $error['context'];
  46341. }
  46342. });
  46343. }
  46344. }
  46345. public function getErrors($errorContext = Validator::ERROR_ALL)
  46346. {
  46347. if ($errorContext === Validator::ERROR_ALL) {
  46348. return $this->errors;
  46349. }
  46350. return array_filter($this->errors, function ($error) use ($errorContext) {
  46351. if ($errorContext & $error['context']) {
  46352. return true;
  46353. }
  46354. });
  46355. }
  46356. public function numErrors($errorContext = Validator::ERROR_ALL)
  46357. {
  46358. if ($errorContext === Validator::ERROR_ALL) {
  46359. return count($this->errors);
  46360. }
  46361. return count($this->getErrors($errorContext));
  46362. }
  46363. public function isValid()
  46364. {
  46365. return !$this->getErrors();
  46366. }
  46367. public function reset()
  46368. {
  46369. $this->errors = array();
  46370. $this->errorMask = Validator::ERROR_NONE;
  46371. }
  46372. public function getErrorMask()
  46373. {
  46374. return $this->errorMask;
  46375. }
  46376. public static function arrayToObjectRecursive($array)
  46377. {
  46378. $json = json_encode($array);
  46379. if (json_last_error() !== \JSON_ERROR_NONE) {
  46380. $message = 'Unable to encode schema array as JSON';
  46381. if (function_exists('json_last_error_msg')) {
  46382. $message .= ': ' . json_last_error_msg();
  46383. }
  46384. throw new InvalidArgumentException($message);
  46385. }
  46386. return (object) json_decode($json);
  46387. }
  46388. }
  46389. <?php
  46390. namespace JsonSchema\Constraints;
  46391. use JsonSchema\Entity\JsonPointer;
  46392. class CollectionConstraint extends Constraint
  46393. {
  46394. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46395. {
  46396. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  46397. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  46398. }
  46399. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  46400. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  46401. }
  46402. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  46403. $unique = $value;
  46404. if (is_array($value) && count($value)) {
  46405. $unique = array_map(function ($e) {
  46406. return var_export($e, true);
  46407. }, $value);
  46408. }
  46409. if (count(array_unique($unique)) != count($value)) {
  46410. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  46411. }
  46412. }
  46413. if (isset($schema->items)) {
  46414. $this->validateItems($value, $schema, $path, $i);
  46415. }
  46416. }
  46417. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46418. {
  46419. if (is_object($schema->items)) {
  46420. if (isset($schema->items->type)
  46421. && (
  46422. $schema->items->type == 'string'
  46423. || $schema->items->type == 'number'
  46424. || $schema->items->type == 'integer'
  46425. )
  46426. && !isset($schema->additionalItems)
  46427. ) {
  46428. $type = $schema->items->type;
  46429. $typeValidator = $this->factory->createInstanceFor('type');
  46430. $validator = $this->factory->createInstanceFor($type === 'integer' ? 'number' : $type);
  46431. foreach ($value as $k => &$v) {
  46432. $k_path = $this->incrementPath($path, $k);
  46433. $typeValidator->check($v, $schema->items, $k_path, $i);
  46434. $validator->check($v, $schema->items, $k_path, $i);
  46435. }
  46436. unset($v);
  46437. $this->addErrors($typeValidator->getErrors());
  46438. $this->addErrors($validator->getErrors());
  46439. } else {
  46440. foreach ($value as $k => &$v) {
  46441. $initErrors = $this->getErrors();
  46442. $this->checkUndefined($v, $schema->items, $path, $k);
  46443. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  46444. $secondErrors = $this->getErrors();
  46445. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  46446. }
  46447. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  46448. $this->errors = $secondErrors;
  46449. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  46450. $this->errors = $initErrors;
  46451. }
  46452. }
  46453. unset($v);
  46454. }
  46455. } else {
  46456. foreach ($value as $k => &$v) {
  46457. if (array_key_exists($k, $schema->items)) {
  46458. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  46459. } else {
  46460. if (property_exists($schema, 'additionalItems')) {
  46461. if ($schema->additionalItems !== false) {
  46462. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  46463. } else {
  46464. $this->addError(
  46465. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  46466. }
  46467. } else {
  46468. $this->checkUndefined($v, new \stdClass(), $path, $k);
  46469. }
  46470. }
  46471. }
  46472. unset($v);
  46473. if (count($value) > 0) {
  46474. for ($k = count($value); $k < count($schema->items); $k++) {
  46475. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  46476. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  46477. }
  46478. }
  46479. }
  46480. }
  46481. }
  46482. <?php
  46483. namespace JsonSchema\Constraints;
  46484. use JsonSchema\Entity\JsonPointer;
  46485. use JsonSchema\SchemaStorage;
  46486. use JsonSchema\Uri\UriRetriever;
  46487. use JsonSchema\UriRetrieverInterface;
  46488. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  46489. {
  46490. protected $inlineSchemaProperty = '$schema';
  46491. const CHECK_MODE_NONE = 0x00000000;
  46492. const CHECK_MODE_NORMAL = 0x00000001;
  46493. const CHECK_MODE_TYPE_CAST = 0x00000002;
  46494. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  46495. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  46496. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  46497. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  46498. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  46499. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  46500. protected function incrementPath(JsonPointer $path = null, $i)
  46501. {
  46502. $path = $path ?: new JsonPointer('');
  46503. $path = $path->withPropertyPaths(
  46504. array_merge(
  46505. $path->getPropertyPaths(),
  46506. array_filter(array($i), 'strlen')
  46507. )
  46508. );
  46509. return $path;
  46510. }
  46511. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46512. {
  46513. $validator = $this->factory->createInstanceFor('collection');
  46514. $validator->check($value, $schema, $path, $i);
  46515. $this->addErrors($validator->getErrors());
  46516. }
  46517. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  46518. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  46519. {
  46520. $validator = $this->factory->createInstanceFor('object');
  46521. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  46522. $this->addErrors($validator->getErrors());
  46523. }
  46524. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  46525. {
  46526. $validator = $this->factory->createInstanceFor('type');
  46527. $validator->check($value, $schema, $path, $i);
  46528. $this->addErrors($validator->getErrors());
  46529. }
  46530. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  46531. {
  46532. $validator = $this->factory->createInstanceFor('undefined');
  46533. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  46534. $this->addErrors($validator->getErrors());
  46535. }
  46536. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  46537. {
  46538. $validator = $this->factory->createInstanceFor('string');
  46539. $validator->check($value, $schema, $path, $i);
  46540. $this->addErrors($validator->getErrors());
  46541. }
  46542. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  46543. {
  46544. $validator = $this->factory->createInstanceFor('number');
  46545. $validator->check($value, $schema, $path, $i);
  46546. $this->addErrors($validator->getErrors());
  46547. }
  46548. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  46549. {
  46550. $validator = $this->factory->createInstanceFor('enum');
  46551. $validator->check($value, $schema, $path, $i);
  46552. $this->addErrors($validator->getErrors());
  46553. }
  46554. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  46555. {
  46556. $validator = $this->factory->createInstanceFor('format');
  46557. $validator->check($value, $schema, $path, $i);
  46558. $this->addErrors($validator->getErrors());
  46559. }
  46560. protected function getTypeCheck()
  46561. {
  46562. return $this->factory->getTypeCheck();
  46563. }
  46564. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  46565. {
  46566. $result = array_map(
  46567. function ($path) {
  46568. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  46569. },
  46570. $pointer->getPropertyPaths()
  46571. );
  46572. return trim(implode('', $result), '.');
  46573. }
  46574. }
  46575. <?php
  46576. namespace JsonSchema\Constraints;
  46577. use JsonSchema\Entity\JsonPointer;
  46578. interface ConstraintInterface
  46579. {
  46580. public function getErrors();
  46581. public function addErrors(array $errors);
  46582. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  46583. public function isValid();
  46584. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  46585. }
  46586. <?php
  46587. namespace JsonSchema\Constraints;
  46588. use JsonSchema\Entity\JsonPointer;
  46589. class EnumConstraint extends Constraint
  46590. {
  46591. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  46592. {
  46593. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  46594. return;
  46595. }
  46596. $type = gettype($element);
  46597. foreach ($schema->enum as $enum) {
  46598. $enumType = gettype($enum);
  46599. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  46600. if ((object) $element == $enum) {
  46601. return;
  46602. }
  46603. }
  46604. if ($type === gettype($enum)) {
  46605. if ($type == 'object') {
  46606. if ($element == $enum) {
  46607. return;
  46608. }
  46609. } elseif ($element === $enum) {
  46610. return;
  46611. }
  46612. }
  46613. }
  46614. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  46615. }
  46616. }
  46617. <?php
  46618. namespace JsonSchema\Constraints;
  46619. use JsonSchema\Constraints\Constraint;
  46620. use JsonSchema\Exception\InvalidArgumentException;
  46621. use JsonSchema\Exception\InvalidConfigException;
  46622. use JsonSchema\SchemaStorage;
  46623. use JsonSchema\SchemaStorageInterface;
  46624. use JsonSchema\Uri\UriRetriever;
  46625. use JsonSchema\UriRetrieverInterface;
  46626. use JsonSchema\Validator;
  46627. class Factory
  46628. {
  46629. protected $schemaStorage;
  46630. protected $uriRetriever;
  46631. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  46632. private $typeCheck = array();
  46633. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  46634. protected $constraintMap = array(
  46635. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  46636. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  46637. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  46638. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  46639. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  46640. 'string' => 'JsonSchema\Constraints\StringConstraint',
  46641. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  46642. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  46643. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  46644. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  46645. 'validator' => 'JsonSchema\Validator'
  46646. );
  46647. private $instanceCache = array();
  46648. public function __construct(
  46649. SchemaStorageInterface $schemaStorage = null,
  46650. UriRetrieverInterface $uriRetriever = null,
  46651. $checkMode = Constraint::CHECK_MODE_NORMAL
  46652. ) {
  46653. $this->setConfig($checkMode);
  46654. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  46655. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  46656. }
  46657. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  46658. {
  46659. $this->checkMode = $checkMode;
  46660. }
  46661. public function addConfig($options)
  46662. {
  46663. $this->checkMode |= $options;
  46664. }
  46665. public function removeConfig($options)
  46666. {
  46667. $this->checkMode &= ~$options;
  46668. }
  46669. public function getConfig($options = null)
  46670. {
  46671. if ($options === null) {
  46672. return $this->checkMode;
  46673. }
  46674. return $this->checkMode & $options;
  46675. }
  46676. public function getUriRetriever()
  46677. {
  46678. return $this->uriRetriever;
  46679. }
  46680. public function getSchemaStorage()
  46681. {
  46682. return $this->schemaStorage;
  46683. }
  46684. public function getTypeCheck()
  46685. {
  46686. if (!isset($this->typeCheck[$this->checkMode])) {
  46687. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  46688. ? new TypeCheck\LooseTypeCheck()
  46689. : new TypeCheck\StrictTypeCheck();
  46690. }
  46691. return $this->typeCheck[$this->checkMode];
  46692. }
  46693. public function setConstraintClass($name, $class)
  46694. {
  46695. if (!class_exists($class)) {
  46696. throw new InvalidArgumentException('Unknown constraint ' . $name);
  46697. }
  46698. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  46699. throw new InvalidArgumentException('Invalid class ' . $name);
  46700. }
  46701. $this->constraintMap[$name] = $class;
  46702. return $this;
  46703. }
  46704. public function createInstanceFor($constraintName)
  46705. {
  46706. if (!isset($this->constraintMap[$constraintName])) {
  46707. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  46708. }
  46709. if (!isset($this->instanceCache[$constraintName])) {
  46710. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  46711. }
  46712. return clone $this->instanceCache[$constraintName];
  46713. }
  46714. public function getErrorContext()
  46715. {
  46716. return $this->errorContext;
  46717. }
  46718. public function setErrorContext($errorContext)
  46719. {
  46720. $this->errorContext = $errorContext;
  46721. }
  46722. }
  46723. <?php
  46724. namespace JsonSchema\Constraints;
  46725. use JsonSchema\Entity\JsonPointer;
  46726. use JsonSchema\Rfc3339;
  46727. class FormatConstraint extends Constraint
  46728. {
  46729. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  46730. {
  46731. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  46732. return;
  46733. }
  46734. switch ($schema->format) {
  46735. case 'date':
  46736. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  46737. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  46738. }
  46739. break;
  46740. case 'time':
  46741. if (!$this->validateDateTime($element, 'H:i:s')) {
  46742. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  46743. }
  46744. break;
  46745. case 'date-time':
  46746. if (null === Rfc3339::createFromString($element)) {
  46747. $this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format));
  46748. }
  46749. break;
  46750. case 'utc-millisec':
  46751. if (!$this->validateDateTime($element, 'U')) {
  46752. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  46753. }
  46754. break;
  46755. case 'regex':
  46756. if (!$this->validateRegex($element)) {
  46757. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  46758. }
  46759. break;
  46760. case 'color':
  46761. if (!$this->validateColor($element)) {
  46762. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  46763. }
  46764. break;
  46765. case 'style':
  46766. if (!$this->validateStyle($element)) {
  46767. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  46768. }
  46769. break;
  46770. case 'phone':
  46771. if (!$this->validatePhone($element)) {
  46772. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  46773. }
  46774. break;
  46775. case 'uri':
  46776. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  46777. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  46778. }
  46779. break;
  46780. case 'uriref':
  46781. case 'uri-reference':
  46782. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  46783. if (substr($element, 0, 2) === '//') {
  46784. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  46785. } elseif (substr($element, 0, 1) === '/') {
  46786. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  46787. } elseif (strlen($element)) {
  46788. $pathParts = explode('/', $element, 2);
  46789. if (strpos($pathParts[0], ':') !== false) {
  46790. $validURL = null;
  46791. } else {
  46792. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  46793. }
  46794. } else {
  46795. $validURL = null;
  46796. }
  46797. if ($validURL === null) {
  46798. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  46799. }
  46800. }
  46801. break;
  46802. case 'email':
  46803. $filterFlags = FILTER_NULL_ON_FAILURE;
  46804. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  46805. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  46806. }
  46807. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  46808. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  46809. }
  46810. break;
  46811. case 'ip-address':
  46812. case 'ipv4':
  46813. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  46814. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  46815. }
  46816. break;
  46817. case 'ipv6':
  46818. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  46819. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  46820. }
  46821. break;
  46822. case 'host-name':
  46823. case 'hostname':
  46824. if (!$this->validateHostname($element)) {
  46825. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  46826. }
  46827. break;
  46828. default:
  46829. break;
  46830. }
  46831. }
  46832. protected function validateDateTime($datetime, $format)
  46833. {
  46834. $dt = \DateTime::createFromFormat($format, $datetime);
  46835. if (!$dt) {
  46836. return false;
  46837. }
  46838. if ($datetime === $dt->format($format)) {
  46839. return true;
  46840. }
  46841. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  46842. return true;
  46843. }
  46844. return false;
  46845. }
  46846. protected function validateRegex($regex)
  46847. {
  46848. return false !== @preg_match('/' . $regex . '/u', '');
  46849. }
  46850. protected function validateColor($color)
  46851. {
  46852. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  46853. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  46854. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  46855. return true;
  46856. }
  46857. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  46858. }
  46859. protected function validateStyle($style)
  46860. {
  46861. $properties = explode(';', rtrim($style, ';'));
  46862. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  46863. return empty($invalidEntries);
  46864. }
  46865. protected function validatePhone($phone)
  46866. {
  46867. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  46868. }
  46869. protected function validateHostname($host)
  46870. {
  46871. $hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i';
  46872. return preg_match($hostnameRegex, $host);
  46873. }
  46874. }
  46875. <?php
  46876. namespace JsonSchema\Constraints;
  46877. use JsonSchema\Entity\JsonPointer;
  46878. class NumberConstraint extends Constraint
  46879. {
  46880. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  46881. {
  46882. if (isset($schema->exclusiveMinimum)) {
  46883. if (isset($schema->minimum)) {
  46884. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  46885. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  46886. } elseif ($element < $schema->minimum) {
  46887. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  46888. }
  46889. } else {
  46890. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  46891. }
  46892. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  46893. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  46894. }
  46895. if (isset($schema->exclusiveMaximum)) {
  46896. if (isset($schema->maximum)) {
  46897. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  46898. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  46899. } elseif ($element > $schema->maximum) {
  46900. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  46901. }
  46902. } else {
  46903. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  46904. }
  46905. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  46906. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  46907. }
  46908. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  46909. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  46910. }
  46911. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  46912. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  46913. }
  46914. $this->checkFormat($element, $schema, $path, $i);
  46915. }
  46916. private function fmod($number1, $number2)
  46917. {
  46918. $number1 = abs($number1);
  46919. $modulus = fmod($number1, $number2);
  46920. $precision = abs(0.0000000001);
  46921. $diff = (float) ($modulus - $number2);
  46922. if (-$precision < $diff && $diff < $precision) {
  46923. return 0.0;
  46924. }
  46925. $decimals1 = mb_strpos($number1, '.') ? mb_strlen($number1) - mb_strpos($number1, '.') - 1 : 0;
  46926. $decimals2 = mb_strpos($number2, '.') ? mb_strlen($number2) - mb_strpos($number2, '.') - 1 : 0;
  46927. return (float) round($modulus, max($decimals1, $decimals2));
  46928. }
  46929. }
  46930. <?php
  46931. namespace JsonSchema\Constraints;
  46932. use JsonSchema\Entity\JsonPointer;
  46933. class ObjectConstraint extends Constraint
  46934. {
  46935. protected $appliedDefaults = array();
  46936. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  46937. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  46938. {
  46939. if ($element instanceof UndefinedConstraint) {
  46940. return;
  46941. }
  46942. $this->appliedDefaults = $appliedDefaults;
  46943. $matches = array();
  46944. if ($patternProperties) {
  46945. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  46946. }
  46947. if ($properties) {
  46948. $this->validateProperties($element, $properties, $path);
  46949. }
  46950. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  46951. }
  46952. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  46953. {
  46954. $try = array('/', '#', '+', '~', '%');
  46955. $matches = array();
  46956. foreach ($patternProperties as $pregex => $schema) {
  46957. $delimiter = '/';
  46958. foreach ($try as $delimiter) {
  46959. if (strpos($pregex, $delimiter) === false) {
  46960. break;
  46961. }
  46962. }
  46963. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  46964. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  46965. continue;
  46966. }
  46967. foreach ($element as $i => $value) {
  46968. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  46969. $matches[] = $i;
  46970. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  46971. }
  46972. }
  46973. }
  46974. return $matches;
  46975. }
  46976. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  46977. $properties = null, $additionalProp = null)
  46978. {
  46979. $this->validateMinMaxConstraint($element, $schema, $path);
  46980. foreach ($element as $i => $value) {
  46981. $definition = $this->getProperty($properties, $i);
  46982. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  46983. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  46984. }
  46985. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  46986. if ($additionalProp === true) {
  46987. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  46988. } else {
  46989. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  46990. }
  46991. }
  46992. $require = $this->getProperty($definition, 'requires');
  46993. if ($require && !$this->getProperty($element, $require)) {
  46994. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  46995. }
  46996. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  46997. if (is_object($property)) {
  46998. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  46999. }
  47000. }
  47001. }
  47002. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  47003. {
  47004. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  47005. foreach ($properties as $i => $value) {
  47006. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  47007. $definition = $this->getProperty($properties, $i);
  47008. if (is_object($definition)) {
  47009. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  47010. }
  47011. }
  47012. }
  47013. protected function &getProperty(&$element, $property, $fallback = null)
  47014. {
  47015. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  47016. return $element[$property];
  47017. } elseif (is_object($element) && property_exists($element, $property)) {
  47018. return $element->$property;
  47019. }
  47020. return $fallback;
  47021. }
  47022. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  47023. {
  47024. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  47025. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  47026. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  47027. }
  47028. }
  47029. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  47030. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  47031. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  47032. }
  47033. }
  47034. }
  47035. }
  47036. <?php
  47037. namespace JsonSchema\Constraints;
  47038. use JsonSchema\Entity\JsonPointer;
  47039. use JsonSchema\Exception\InvalidArgumentException;
  47040. use JsonSchema\Exception\InvalidSchemaException;
  47041. use JsonSchema\Exception\RuntimeException;
  47042. use JsonSchema\SchemaStorage;
  47043. use JsonSchema\Validator;
  47044. class SchemaConstraint extends Constraint
  47045. {
  47046. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  47047. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47048. {
  47049. if ($schema !== null) {
  47050. $validationSchema = $schema;
  47051. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  47052. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  47053. } else {
  47054. throw new InvalidArgumentException('no schema found to verify against');
  47055. }
  47056. if (is_array($validationSchema)) {
  47057. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  47058. }
  47059. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  47060. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  47061. throw new RuntimeException('Cannot validate the schema of a non-object');
  47062. }
  47063. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  47064. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  47065. } else {
  47066. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  47067. }
  47068. $schemaStorage = $this->factory->getSchemaStorage();
  47069. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  47070. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  47071. }
  47072. $initialErrorCount = $this->numErrors();
  47073. $initialConfig = $this->factory->getConfig();
  47074. $initialContext = $this->factory->getErrorContext();
  47075. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  47076. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  47077. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  47078. try {
  47079. $this->check($validationSchema, $schemaSpec);
  47080. } catch (\Exception $e) {
  47081. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  47082. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  47083. }
  47084. }
  47085. if ($this->numErrors() > $initialErrorCount) {
  47086. $this->addError($path, 'Schema is not valid', 'schema');
  47087. }
  47088. $this->factory->setConfig($initialConfig);
  47089. $this->factory->setErrorContext($initialContext);
  47090. }
  47091. $this->checkUndefined($element, $validationSchema, $path, $i);
  47092. }
  47093. }
  47094. <?php
  47095. namespace JsonSchema\Constraints;
  47096. use JsonSchema\Entity\JsonPointer;
  47097. class StringConstraint extends Constraint
  47098. {
  47099. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  47100. {
  47101. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  47102. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  47103. 'maxLength' => $schema->maxLength,
  47104. ));
  47105. }
  47106. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  47107. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  47108. 'minLength' => $schema->minLength,
  47109. ));
  47110. }
  47111. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  47112. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  47113. 'pattern' => $schema->pattern,
  47114. ));
  47115. }
  47116. $this->checkFormat($element, $schema, $path, $i);
  47117. }
  47118. private function strlen($string)
  47119. {
  47120. if (extension_loaded('mbstring')) {
  47121. return mb_strlen($string, mb_detect_encoding($string));
  47122. }
  47123. return strlen($string);
  47124. }
  47125. }
  47126. <?php
  47127. namespace JsonSchema\Constraints\TypeCheck;
  47128. class LooseTypeCheck implements TypeCheckInterface
  47129. {
  47130. public static function isObject($value)
  47131. {
  47132. return
  47133. is_object($value) ||
  47134. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  47135. }
  47136. public static function isArray($value)
  47137. {
  47138. return
  47139. is_array($value) &&
  47140. (count($value) == 0 || !self::isAssociativeArray($value));
  47141. }
  47142. public static function propertyGet($value, $property)
  47143. {
  47144. if (is_object($value)) {
  47145. return $value->{$property};
  47146. }
  47147. return $value[$property];
  47148. }
  47149. public static function propertySet(&$value, $property, $data)
  47150. {
  47151. if (is_object($value)) {
  47152. $value->{$property} = $data;
  47153. } else {
  47154. $value[$property] = $data;
  47155. }
  47156. }
  47157. public static function propertyExists($value, $property)
  47158. {
  47159. if (is_object($value)) {
  47160. return property_exists($value, $property);
  47161. }
  47162. return array_key_exists($property, $value);
  47163. }
  47164. public static function propertyCount($value)
  47165. {
  47166. if (is_object($value)) {
  47167. return count(get_object_vars($value));
  47168. }
  47169. return count($value);
  47170. }
  47171. private static function isAssociativeArray($arr)
  47172. {
  47173. return array_keys($arr) !== range(0, count($arr) - 1);
  47174. }
  47175. }
  47176. <?php
  47177. namespace JsonSchema\Constraints\TypeCheck;
  47178. class StrictTypeCheck implements TypeCheckInterface
  47179. {
  47180. public static function isObject($value)
  47181. {
  47182. return is_object($value);
  47183. }
  47184. public static function isArray($value)
  47185. {
  47186. return is_array($value);
  47187. }
  47188. public static function propertyGet($value, $property)
  47189. {
  47190. return $value->{$property};
  47191. }
  47192. public static function propertySet(&$value, $property, $data)
  47193. {
  47194. $value->{$property} = $data;
  47195. }
  47196. public static function propertyExists($value, $property)
  47197. {
  47198. return property_exists($value, $property);
  47199. }
  47200. public static function propertyCount($value)
  47201. {
  47202. return count(get_object_vars($value));
  47203. }
  47204. }
  47205. <?php
  47206. namespace JsonSchema\Constraints\TypeCheck;
  47207. interface TypeCheckInterface
  47208. {
  47209. public static function isObject($value);
  47210. public static function isArray($value);
  47211. public static function propertyGet($value, $property);
  47212. public static function propertySet(&$value, $property, $data);
  47213. public static function propertyExists($value, $property);
  47214. public static function propertyCount($value);
  47215. }
  47216. <?php
  47217. namespace JsonSchema\Constraints;
  47218. use JsonSchema\Entity\JsonPointer;
  47219. use JsonSchema\Exception\InvalidArgumentException;
  47220. use UnexpectedValueException as StandardUnexpectedValueException;
  47221. class TypeConstraint extends Constraint
  47222. {
  47223. public static $wording = array(
  47224. 'integer' => 'an integer',
  47225. 'number' => 'a number',
  47226. 'boolean' => 'a boolean',
  47227. 'object' => 'an object',
  47228. 'array' => 'an array',
  47229. 'string' => 'a string',
  47230. 'null' => 'a null',
  47231. 'any' => null,
  47232. 0 => null,
  47233. );
  47234. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  47235. {
  47236. $type = isset($schema->type) ? $schema->type : null;
  47237. $isValid = false;
  47238. $wording = array();
  47239. if (is_array($type)) {
  47240. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  47241. } elseif (is_object($type)) {
  47242. $this->checkUndefined($value, $type, $path);
  47243. return;
  47244. } else {
  47245. $isValid = $this->validateType($value, $type);
  47246. }
  47247. if ($isValid === false) {
  47248. if (!is_array($type)) {
  47249. $this->validateTypeNameWording($type);
  47250. $wording[] = self::$wording[$type];
  47251. }
  47252. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  47253. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  47254. }
  47255. }
  47256. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  47257. {
  47258. foreach ($type as $tp) {
  47259. if (is_object($tp)) {
  47260. if (!$isValid) {
  47261. $validator = $this->factory->createInstanceFor('type');
  47262. $subSchema = new \stdClass();
  47263. $subSchema->type = $tp;
  47264. $validator->check($value, $subSchema, $path, null);
  47265. $error = $validator->getErrors();
  47266. $isValid = !(bool) $error;
  47267. $validTypesWording[] = self::$wording['object'];
  47268. }
  47269. } else {
  47270. $this->validateTypeNameWording($tp);
  47271. $validTypesWording[] = self::$wording[$tp];
  47272. if (!$isValid) {
  47273. $isValid = $this->validateType($value, $tp);
  47274. }
  47275. }
  47276. }
  47277. }
  47278. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  47279. {
  47280. if ($listEnd === false || !isset($elements[1])) {
  47281. return implode($delimiter, $elements);
  47282. }
  47283. $lastElement = array_slice($elements, -1);
  47284. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  47285. $implodedElements = array_merge(array($firsElements), $lastElement);
  47286. return join(" $listEnd ", $implodedElements);
  47287. }
  47288. protected function validateTypeNameWording($type)
  47289. {
  47290. if (!isset(self::$wording[$type])) {
  47291. throw new StandardUnexpectedValueException(
  47292. sprintf(
  47293. 'No wording for %s available, expected wordings are: [%s]',
  47294. var_export($type, true),
  47295. implode(', ', array_filter(self::$wording)))
  47296. );
  47297. }
  47298. }
  47299. protected function validateType(&$value, $type)
  47300. {
  47301. if (!$type) {
  47302. return true;
  47303. }
  47304. if ('any' === $type) {
  47305. return true;
  47306. }
  47307. if ('object' === $type) {
  47308. return $this->getTypeCheck()->isObject($value);
  47309. }
  47310. if ('array' === $type) {
  47311. return $this->getTypeCheck()->isArray($value);
  47312. }
  47313. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  47314. if ('integer' === $type) {
  47315. if ($coerce) {
  47316. $value = $this->toInteger($value);
  47317. }
  47318. return is_int($value);
  47319. }
  47320. if ('number' === $type) {
  47321. if ($coerce) {
  47322. $value = $this->toNumber($value);
  47323. }
  47324. return is_numeric($value) && !is_string($value);
  47325. }
  47326. if ('boolean' === $type) {
  47327. if ($coerce) {
  47328. $value = $this->toBoolean($value);
  47329. }
  47330. return is_bool($value);
  47331. }
  47332. if ('string' === $type) {
  47333. return is_string($value);
  47334. }
  47335. if ('email' === $type) {
  47336. return is_string($value);
  47337. }
  47338. if ('null' === $type) {
  47339. return is_null($value);
  47340. }
  47341. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  47342. }
  47343. protected function toBoolean($value)
  47344. {
  47345. if ($value === 'true') {
  47346. return true;
  47347. }
  47348. if ($value === 'false') {
  47349. return false;
  47350. }
  47351. return $value;
  47352. }
  47353. protected function toNumber($value)
  47354. {
  47355. if (is_numeric($value)) {
  47356. return $value + 0;
  47357. }
  47358. return $value;
  47359. }
  47360. protected function toInteger($value)
  47361. {
  47362. if (is_numeric($value) && (int) $value == $value) {
  47363. return (int) $value;
  47364. }
  47365. return $value;
  47366. }
  47367. }
  47368. <?php
  47369. namespace JsonSchema\Constraints;
  47370. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  47371. use JsonSchema\Entity\JsonPointer;
  47372. use JsonSchema\Exception\ValidationException;
  47373. use JsonSchema\Uri\UriResolver;
  47374. class UndefinedConstraint extends Constraint
  47375. {
  47376. protected $appliedDefaults = array();
  47377. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  47378. {
  47379. if (is_null($schema) || !is_object($schema)) {
  47380. return;
  47381. }
  47382. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  47383. if ($fromDefault) {
  47384. $path->setFromDefault();
  47385. }
  47386. $this->validateCommonProperties($value, $schema, $path, $i);
  47387. $this->validateOfProperties($value, $schema, $path, '');
  47388. $this->validateTypes($value, $schema, $path, $i);
  47389. }
  47390. public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null)
  47391. {
  47392. if ($this->getTypeCheck()->isArray($value)) {
  47393. $this->checkArray($value, $schema, $path, $i);
  47394. }
  47395. if (LooseTypeCheck::isObject($value)) {
  47396. $this->checkObject(
  47397. $value,
  47398. $schema,
  47399. $path,
  47400. isset($schema->properties) ? $schema->properties : null,
  47401. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  47402. isset($schema->patternProperties) ? $schema->patternProperties : null,
  47403. $this->appliedDefaults
  47404. );
  47405. }
  47406. if (is_string($value)) {
  47407. $this->checkString($value, $schema, $path, $i);
  47408. }
  47409. if (is_numeric($value)) {
  47410. $this->checkNumber($value, $schema, $path, $i);
  47411. }
  47412. if (isset($schema->enum)) {
  47413. $this->checkEnum($value, $schema, $path, $i);
  47414. }
  47415. }
  47416. protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '')
  47417. {
  47418. if (isset($schema->extends)) {
  47419. if (is_string($schema->extends)) {
  47420. $schema->extends = $this->validateUri($schema, $schema->extends);
  47421. }
  47422. if (is_array($schema->extends)) {
  47423. foreach ($schema->extends as $extends) {
  47424. $this->checkUndefined($value, $extends, $path, $i);
  47425. }
  47426. } else {
  47427. $this->checkUndefined($value, $schema->extends, $path, $i);
  47428. }
  47429. }
  47430. if (!$path->fromDefault()) {
  47431. $this->applyDefaultValues($value, $schema, $path);
  47432. }
  47433. if ($this->getTypeCheck()->isObject($value)) {
  47434. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  47435. foreach ($schema->required as $required) {
  47436. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  47437. $this->addError(
  47438. $this->incrementPath($path ?: new JsonPointer(''), $required),
  47439. 'The property ' . $required . ' is required',
  47440. 'required'
  47441. );
  47442. }
  47443. }
  47444. } elseif (isset($schema->required) && !is_array($schema->required)) {
  47445. if ($schema->required && $value instanceof self) {
  47446. $propertyPaths = $path->getPropertyPaths();
  47447. $propertyName = end($propertyPaths);
  47448. $this->addError(
  47449. $path,
  47450. 'The property ' . $propertyName . ' is required',
  47451. 'required'
  47452. );
  47453. }
  47454. }
  47455. }
  47456. if (!($value instanceof self)) {
  47457. $this->checkType($value, $schema, $path, $i);
  47458. }
  47459. if (isset($schema->disallow)) {
  47460. $initErrors = $this->getErrors();
  47461. $typeSchema = new \stdClass();
  47462. $typeSchema->type = $schema->disallow;
  47463. $this->checkType($value, $typeSchema, $path);
  47464. if (count($this->getErrors()) == count($initErrors)) {
  47465. $this->addError($path, 'Disallowed value was matched', 'disallow');
  47466. } else {
  47467. $this->errors = $initErrors;
  47468. }
  47469. }
  47470. if (isset($schema->not)) {
  47471. $initErrors = $this->getErrors();
  47472. $this->checkUndefined($value, $schema->not, $path, $i);
  47473. if (count($this->getErrors()) == count($initErrors)) {
  47474. $this->addError($path, 'Matched a schema which it should not', 'not');
  47475. } else {
  47476. $this->errors = $initErrors;
  47477. }
  47478. }
  47479. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  47480. $this->validateDependencies($value, $schema->dependencies, $path);
  47481. }
  47482. }
  47483. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  47484. {
  47485. if (!$requiredOnly) {
  47486. return true;
  47487. }
  47488. if (
  47489. $name !== null
  47490. && isset($parentSchema->required)
  47491. && is_array($parentSchema->required)
  47492. && in_array($name, $parentSchema->required)
  47493. ) {
  47494. return true;
  47495. }
  47496. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  47497. return true;
  47498. }
  47499. return false;
  47500. }
  47501. protected function applyDefaultValues(&$value, $schema, $path)
  47502. {
  47503. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  47504. return;
  47505. }
  47506. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  47507. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  47508. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  47509. if (
  47510. !LooseTypeCheck::propertyExists($value, $currentProperty)
  47511. && property_exists($propertyDefinition, 'default')
  47512. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  47513. ) {
  47514. if (is_object($propertyDefinition->default)) {
  47515. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  47516. } else {
  47517. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  47518. }
  47519. $this->appliedDefaults[] = $currentProperty;
  47520. }
  47521. }
  47522. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  47523. $items = array();
  47524. if (LooseTypeCheck::isArray($schema->items)) {
  47525. $items = $schema->items;
  47526. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  47527. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  47528. }
  47529. foreach ($items as $currentItem => $itemDefinition) {
  47530. if (
  47531. !array_key_exists($currentItem, $value)
  47532. && property_exists($itemDefinition, 'default')
  47533. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  47534. if (is_object($itemDefinition->default)) {
  47535. $value[$currentItem] = clone $itemDefinition->default;
  47536. } else {
  47537. $value[$currentItem] = $itemDefinition->default;
  47538. }
  47539. }
  47540. $path->setFromDefault();
  47541. }
  47542. } elseif (
  47543. $value instanceof self
  47544. && property_exists($schema, 'default')
  47545. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  47546. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  47547. $path->setFromDefault();
  47548. }
  47549. }
  47550. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  47551. {
  47552. if ($value instanceof self) {
  47553. return;
  47554. }
  47555. if (isset($schema->allOf)) {
  47556. $isValid = true;
  47557. foreach ($schema->allOf as $allOf) {
  47558. $initErrors = $this->getErrors();
  47559. $this->checkUndefined($value, $allOf, $path, $i);
  47560. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  47561. }
  47562. if (!$isValid) {
  47563. $this->addError($path, 'Failed to match all schemas', 'allOf');
  47564. }
  47565. }
  47566. if (isset($schema->anyOf)) {
  47567. $isValid = false;
  47568. $startErrors = $this->getErrors();
  47569. $caughtException = null;
  47570. foreach ($schema->anyOf as $anyOf) {
  47571. $initErrors = $this->getErrors();
  47572. try {
  47573. $this->checkUndefined($value, $anyOf, $path, $i);
  47574. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  47575. break;
  47576. }
  47577. } catch (ValidationException $e) {
  47578. $isValid = false;
  47579. }
  47580. }
  47581. if (!$isValid) {
  47582. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  47583. } else {
  47584. $this->errors = $startErrors;
  47585. }
  47586. }
  47587. if (isset($schema->oneOf)) {
  47588. $allErrors = array();
  47589. $matchedSchemas = 0;
  47590. $startErrors = $this->getErrors();
  47591. foreach ($schema->oneOf as $oneOf) {
  47592. try {
  47593. $this->errors = array();
  47594. $this->checkUndefined($value, $oneOf, $path, $i);
  47595. if (count($this->getErrors()) == 0) {
  47596. $matchedSchemas++;
  47597. }
  47598. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  47599. } catch (ValidationException $e) {
  47600. }
  47601. }
  47602. if ($matchedSchemas !== 1) {
  47603. $this->addErrors(array_merge($allErrors, $startErrors));
  47604. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  47605. } else {
  47606. $this->errors = $startErrors;
  47607. }
  47608. }
  47609. }
  47610. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  47611. {
  47612. foreach ($dependencies as $key => $dependency) {
  47613. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  47614. if (is_string($dependency)) {
  47615. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  47616. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  47617. }
  47618. } elseif (is_array($dependency)) {
  47619. foreach ($dependency as $d) {
  47620. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  47621. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  47622. }
  47623. }
  47624. } elseif (is_object($dependency)) {
  47625. $this->checkUndefined($value, $dependency, $path, $i);
  47626. }
  47627. }
  47628. }
  47629. }
  47630. protected function validateUri($schema, $schemaUri = null)
  47631. {
  47632. $resolver = new UriResolver();
  47633. $retriever = $this->factory->getUriRetriever();
  47634. $jsonSchema = null;
  47635. if ($resolver->isValid($schemaUri)) {
  47636. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  47637. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  47638. }
  47639. return $jsonSchema;
  47640. }
  47641. }
  47642. <?php
  47643. namespace JsonSchema\Entity;
  47644. use JsonSchema\Exception\InvalidArgumentException;
  47645. class JsonPointer
  47646. {
  47647. private $filename;
  47648. private $propertyPaths = array();
  47649. private $fromDefault = false;
  47650. public function __construct($value)
  47651. {
  47652. if (!is_string($value)) {
  47653. throw new InvalidArgumentException('Ref value must be a string');
  47654. }
  47655. $splitRef = explode('#', $value, 2);
  47656. $this->filename = $splitRef[0];
  47657. if (array_key_exists(1, $splitRef)) {
  47658. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  47659. }
  47660. }
  47661. private function decodePropertyPaths($propertyPathString)
  47662. {
  47663. $paths = array();
  47664. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  47665. $path = $this->decodePath($path);
  47666. if (is_string($path) && '' !== $path) {
  47667. $paths[] = $path;
  47668. }
  47669. }
  47670. return $paths;
  47671. }
  47672. private function encodePropertyPaths()
  47673. {
  47674. return array_map(
  47675. array($this, 'encodePath'),
  47676. $this->getPropertyPaths()
  47677. );
  47678. }
  47679. private function decodePath($path)
  47680. {
  47681. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  47682. }
  47683. private function encodePath($path)
  47684. {
  47685. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  47686. }
  47687. public function getFilename()
  47688. {
  47689. return $this->filename;
  47690. }
  47691. public function getPropertyPaths()
  47692. {
  47693. return $this->propertyPaths;
  47694. }
  47695. public function withPropertyPaths(array $propertyPaths)
  47696. {
  47697. $new = clone $this;
  47698. $new->propertyPaths = $propertyPaths;
  47699. return $new;
  47700. }
  47701. public function getPropertyPathAsString()
  47702. {
  47703. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  47704. }
  47705. public function __toString()
  47706. {
  47707. return $this->getFilename() . $this->getPropertyPathAsString();
  47708. }
  47709. public function setFromDefault()
  47710. {
  47711. $this->fromDefault = true;
  47712. }
  47713. public function fromDefault()
  47714. {
  47715. return $this->fromDefault;
  47716. }
  47717. }
  47718. <?php
  47719. namespace JsonSchema\Exception;
  47720. interface ExceptionInterface
  47721. {
  47722. }
  47723. <?php
  47724. namespace JsonSchema\Exception;
  47725. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  47726. {
  47727. }
  47728. <?php
  47729. namespace JsonSchema\Exception;
  47730. class InvalidConfigException extends RuntimeException
  47731. {
  47732. }
  47733. <?php
  47734. namespace JsonSchema\Exception;
  47735. class InvalidSchemaException extends RuntimeException
  47736. {
  47737. }
  47738. <?php
  47739. namespace JsonSchema\Exception;
  47740. class InvalidSchemaMediaTypeException extends RuntimeException
  47741. {
  47742. }
  47743. <?php
  47744. namespace JsonSchema\Exception;
  47745. class InvalidSourceUriException extends InvalidArgumentException
  47746. {
  47747. }
  47748. <?php
  47749. namespace JsonSchema\Exception;
  47750. class JsonDecodingException extends RuntimeException
  47751. {
  47752. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  47753. {
  47754. switch ($code) {
  47755. case JSON_ERROR_DEPTH:
  47756. $message = 'The maximum stack depth has been exceeded';
  47757. break;
  47758. case JSON_ERROR_STATE_MISMATCH:
  47759. $message = 'Invalid or malformed JSON';
  47760. break;
  47761. case JSON_ERROR_CTRL_CHAR:
  47762. $message = 'Control character error, possibly incorrectly encoded';
  47763. break;
  47764. case JSON_ERROR_UTF8:
  47765. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  47766. break;
  47767. case JSON_ERROR_SYNTAX:
  47768. $message = 'JSON syntax is malformed';
  47769. break;
  47770. default:
  47771. $message = 'Syntax error';
  47772. }
  47773. parent::__construct($message, $code, $previous);
  47774. }
  47775. }
  47776. <?php
  47777. namespace JsonSchema\Exception;
  47778. class ResourceNotFoundException extends RuntimeException
  47779. {
  47780. }
  47781. <?php
  47782. namespace JsonSchema\Exception;
  47783. class RuntimeException extends \RuntimeException implements ExceptionInterface
  47784. {
  47785. }
  47786. <?php
  47787. namespace JsonSchema\Exception;
  47788. class UnresolvableJsonPointerException extends InvalidArgumentException
  47789. {
  47790. }
  47791. <?php
  47792. namespace JsonSchema\Exception;
  47793. class UriResolverException extends RuntimeException
  47794. {
  47795. }
  47796. <?php
  47797. namespace JsonSchema\Exception;
  47798. class ValidationException extends RuntimeException
  47799. {
  47800. }
  47801. <?php
  47802. namespace JsonSchema\Iterator;
  47803. class ObjectIterator implements \Iterator, \Countable
  47804. {
  47805. private $object;
  47806. private $position = 0;
  47807. private $data = array();
  47808. private $initialized = false;
  47809. public function __construct($object)
  47810. {
  47811. $this->object = $object;
  47812. }
  47813. public function current()
  47814. {
  47815. $this->initialize();
  47816. return $this->data[$this->position];
  47817. }
  47818. public function next()
  47819. {
  47820. $this->initialize();
  47821. $this->position++;
  47822. }
  47823. public function key()
  47824. {
  47825. $this->initialize();
  47826. return $this->position;
  47827. }
  47828. public function valid()
  47829. {
  47830. $this->initialize();
  47831. return isset($this->data[$this->position]);
  47832. }
  47833. public function rewind()
  47834. {
  47835. $this->initialize();
  47836. $this->position = 0;
  47837. }
  47838. public function count()
  47839. {
  47840. $this->initialize();
  47841. return count($this->data);
  47842. }
  47843. private function initialize()
  47844. {
  47845. if (!$this->initialized) {
  47846. $this->data = $this->buildDataFromObject($this->object);
  47847. $this->initialized = true;
  47848. }
  47849. }
  47850. private function buildDataFromObject($object)
  47851. {
  47852. $result = array();
  47853. $stack = new \SplStack();
  47854. $stack->push($object);
  47855. while (!$stack->isEmpty()) {
  47856. $current = $stack->pop();
  47857. if (is_object($current)) {
  47858. array_push($result, $current);
  47859. }
  47860. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  47861. if (is_object($propertyValue) || is_array($propertyValue)) {
  47862. $stack->push($propertyValue);
  47863. }
  47864. }
  47865. }
  47866. return $result;
  47867. }
  47868. private function getDataFromItem($item)
  47869. {
  47870. if (!is_object($item) && !is_array($item)) {
  47871. return array();
  47872. }
  47873. return is_object($item) ? get_object_vars($item) : $item;
  47874. }
  47875. }
  47876. <?php
  47877. namespace JsonSchema;
  47878. class Rfc3339
  47879. {
  47880. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  47881. public static function createFromString($string)
  47882. {
  47883. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  47884. return null;
  47885. }
  47886. $dateAndTime = $matches[1];
  47887. $microseconds = $matches[2] ?: '.000000';
  47888. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  47889. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  47890. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  47891. return $dateTime ?: null;
  47892. }
  47893. }
  47894. <?php
  47895. namespace JsonSchema;
  47896. use JsonSchema\Constraints\BaseConstraint;
  47897. use JsonSchema\Entity\JsonPointer;
  47898. use JsonSchema\Exception\UnresolvableJsonPointerException;
  47899. use JsonSchema\Uri\UriResolver;
  47900. use JsonSchema\Uri\UriRetriever;
  47901. class SchemaStorage implements SchemaStorageInterface
  47902. {
  47903. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  47904. protected $uriRetriever;
  47905. protected $uriResolver;
  47906. protected $schemas = array();
  47907. public function __construct(
  47908. UriRetrieverInterface $uriRetriever = null,
  47909. UriResolverInterface $uriResolver = null
  47910. ) {
  47911. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  47912. $this->uriResolver = $uriResolver ?: new UriResolver();
  47913. }
  47914. public function getUriRetriever()
  47915. {
  47916. return $this->uriRetriever;
  47917. }
  47918. public function getUriResolver()
  47919. {
  47920. return $this->uriResolver;
  47921. }
  47922. public function addSchema($id, $schema = null)
  47923. {
  47924. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  47925. $schema = $this->uriRetriever->retrieve($id);
  47926. }
  47927. if (is_array($schema)) {
  47928. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  47929. }
  47930. if (is_object($schema) && property_exists($schema, 'id')) {
  47931. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  47932. $schema->properties->id->format = 'uri-reference';
  47933. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  47934. $schema->properties->id->format = 'uri-reference';
  47935. $schema->properties->{'$ref'}->format = 'uri-reference';
  47936. }
  47937. }
  47938. $this->expandRefs($schema, $id);
  47939. $this->schemas[$id] = $schema;
  47940. }
  47941. private function expandRefs(&$schema, $base = null)
  47942. {
  47943. if (!is_object($schema)) {
  47944. if (is_array($schema)) {
  47945. foreach ($schema as &$member) {
  47946. $this->expandRefs($member, $base);
  47947. }
  47948. }
  47949. return;
  47950. }
  47951. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  47952. $base = $this->uriResolver->resolve($schema->id, $base);
  47953. }
  47954. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  47955. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  47956. $schema->{'$ref'} = (string) $refPointer;
  47957. }
  47958. foreach ($schema as &$member) {
  47959. $this->expandRefs($member, $base);
  47960. }
  47961. }
  47962. public function getSchema($id)
  47963. {
  47964. if (!array_key_exists($id, $this->schemas)) {
  47965. $this->addSchema($id);
  47966. }
  47967. return $this->schemas[$id];
  47968. }
  47969. public function resolveRef($ref)
  47970. {
  47971. $jsonPointer = new JsonPointer($ref);
  47972. $fileName = $jsonPointer->getFilename();
  47973. if (!strlen($fileName)) {
  47974. throw new UnresolvableJsonPointerException(sprintf(
  47975. "Could not resolve fragment '%s': no file is defined",
  47976. $jsonPointer->getPropertyPathAsString()
  47977. ));
  47978. }
  47979. $refSchema = $this->getSchema($fileName);
  47980. foreach ($jsonPointer->getPropertyPaths() as $path) {
  47981. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  47982. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  47983. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  47984. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  47985. } else {
  47986. throw new UnresolvableJsonPointerException(sprintf(
  47987. 'File: %s is found, but could not resolve fragment: %s',
  47988. $jsonPointer->getFilename(),
  47989. $jsonPointer->getPropertyPathAsString()
  47990. ));
  47991. }
  47992. }
  47993. return $refSchema;
  47994. }
  47995. public function resolveRefSchema($refSchema)
  47996. {
  47997. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  47998. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  47999. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  48000. unset($refSchema->{'$ref'});
  48001. }
  48002. return $refSchema;
  48003. }
  48004. }
  48005. <?php
  48006. namespace JsonSchema;
  48007. interface SchemaStorageInterface
  48008. {
  48009. public function addSchema($id, $schema = null);
  48010. public function getSchema($id);
  48011. public function resolveRef($ref);
  48012. public function resolveRefSchema($refSchema);
  48013. }
  48014. <?php
  48015. namespace JsonSchema\Uri\Retrievers;
  48016. abstract class AbstractRetriever implements UriRetrieverInterface
  48017. {
  48018. protected $contentType;
  48019. public function getContentType()
  48020. {
  48021. return $this->contentType;
  48022. }
  48023. }
  48024. <?php
  48025. namespace JsonSchema\Uri\Retrievers;
  48026. use JsonSchema\Exception\RuntimeException;
  48027. use JsonSchema\Validator;
  48028. class Curl extends AbstractRetriever
  48029. {
  48030. protected $messageBody;
  48031. public function __construct()
  48032. {
  48033. if (!function_exists('curl_init')) {
  48034. throw new RuntimeException('cURL not installed');
  48035. }
  48036. }
  48037. public function retrieve($uri)
  48038. {
  48039. $ch = curl_init();
  48040. curl_setopt($ch, CURLOPT_URL, $uri);
  48041. curl_setopt($ch, CURLOPT_HEADER, true);
  48042. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  48043. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  48044. $response = curl_exec($ch);
  48045. if (false === $response) {
  48046. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  48047. }
  48048. $this->fetchMessageBody($response);
  48049. $this->fetchContentType($response);
  48050. curl_close($ch);
  48051. return $this->messageBody;
  48052. }
  48053. private function fetchMessageBody($response)
  48054. {
  48055. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  48056. $this->messageBody = $match[1];
  48057. }
  48058. protected function fetchContentType($response)
  48059. {
  48060. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  48061. $this->contentType = trim($match[1]);
  48062. return true;
  48063. }
  48064. return false;
  48065. }
  48066. }
  48067. <?php
  48068. namespace JsonSchema\Uri\Retrievers;
  48069. use JsonSchema\Exception\ResourceNotFoundException;
  48070. class FileGetContents extends AbstractRetriever
  48071. {
  48072. protected $messageBody;
  48073. public function retrieve($uri)
  48074. {
  48075. $errorMessage = null;
  48076. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  48077. $errorMessage = $errstr;
  48078. });
  48079. $response = file_get_contents($uri);
  48080. restore_error_handler();
  48081. if ($errorMessage) {
  48082. throw new ResourceNotFoundException($errorMessage);
  48083. }
  48084. if (false === $response) {
  48085. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  48086. }
  48087. if ($response == ''
  48088. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  48089. ) {
  48090. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  48091. }
  48092. $this->messageBody = $response;
  48093. if (!empty($http_response_header)) {
  48094. $this->fetchContentType($http_response_header);
  48095. } else {
  48096. $this->contentType = null;
  48097. }
  48098. return $this->messageBody;
  48099. }
  48100. private function fetchContentType(array $headers)
  48101. {
  48102. foreach ($headers as $header) {
  48103. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  48104. return true;
  48105. }
  48106. }
  48107. return false;
  48108. }
  48109. protected static function getContentTypeMatchInHeader($header)
  48110. {
  48111. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  48112. return trim($match[1]);
  48113. }
  48114. return null;
  48115. }
  48116. }
  48117. <?php
  48118. namespace JsonSchema\Uri\Retrievers;
  48119. use JsonSchema\Validator;
  48120. class PredefinedArray extends AbstractRetriever
  48121. {
  48122. private $schemas;
  48123. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  48124. {
  48125. $this->schemas = $schemas;
  48126. $this->contentType = $contentType;
  48127. }
  48128. public function retrieve($uri)
  48129. {
  48130. if (!array_key_exists($uri, $this->schemas)) {
  48131. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  48132. 'The JSON schema "%s" was not found.',
  48133. $uri
  48134. ));
  48135. }
  48136. return $this->schemas[$uri];
  48137. }
  48138. }
  48139. <?php
  48140. namespace JsonSchema\Uri\Retrievers;
  48141. interface UriRetrieverInterface
  48142. {
  48143. public function retrieve($uri);
  48144. public function getContentType();
  48145. }
  48146. <?php
  48147. namespace JsonSchema\Uri;
  48148. use JsonSchema\Exception\UriResolverException;
  48149. use JsonSchema\UriResolverInterface;
  48150. class UriResolver implements UriResolverInterface
  48151. {
  48152. public function parse($uri)
  48153. {
  48154. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  48155. $components = array();
  48156. if (5 < count($match)) {
  48157. $components = array(
  48158. 'scheme' => $match[2],
  48159. 'authority' => $match[4],
  48160. 'path' => $match[5]
  48161. );
  48162. }
  48163. if (7 < count($match)) {
  48164. $components['query'] = $match[7];
  48165. }
  48166. if (9 < count($match)) {
  48167. $components['fragment'] = $match[9];
  48168. }
  48169. return $components;
  48170. }
  48171. public function generate(array $components)
  48172. {
  48173. $uri = $components['scheme'] . '://'
  48174. . $components['authority']
  48175. . $components['path'];
  48176. if (array_key_exists('query', $components) && strlen($components['query'])) {
  48177. $uri .= '?' . $components['query'];
  48178. }
  48179. if (array_key_exists('fragment', $components)) {
  48180. $uri .= '#' . $components['fragment'];
  48181. }
  48182. return $uri;
  48183. }
  48184. public function resolve($uri, $baseUri = null)
  48185. {
  48186. if (
  48187. !is_null($baseUri) &&
  48188. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  48189. !preg_match('|^[^/]+://|u', $baseUri)
  48190. ) {
  48191. if (is_file($baseUri)) {
  48192. $baseUri = 'file://' . realpath($baseUri);
  48193. } elseif (is_dir($baseUri)) {
  48194. $baseUri = 'file://' . realpath($baseUri) . '/';
  48195. } else {
  48196. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  48197. }
  48198. }
  48199. if ($uri == '') {
  48200. return $baseUri;
  48201. }
  48202. $components = $this->parse($uri);
  48203. $path = $components['path'];
  48204. if (!empty($components['scheme'])) {
  48205. return $uri;
  48206. }
  48207. $baseComponents = $this->parse($baseUri);
  48208. $basePath = $baseComponents['path'];
  48209. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  48210. if (isset($components['fragment'])) {
  48211. $baseComponents['fragment'] = $components['fragment'];
  48212. }
  48213. return $this->generate($baseComponents);
  48214. }
  48215. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  48216. {
  48217. $relativePath = self::normalizePath($relativePath);
  48218. if ($relativePath == '') {
  48219. return $basePath;
  48220. }
  48221. if ($relativePath[0] == '/') {
  48222. return $relativePath;
  48223. }
  48224. $basePathSegments = explode('/', $basePath);
  48225. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  48226. $numLevelUp = strlen($match[0]) /3 + 1;
  48227. if ($numLevelUp >= count($basePathSegments)) {
  48228. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  48229. }
  48230. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  48231. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  48232. return implode('/', $basePathSegments) . '/' . $path;
  48233. }
  48234. private static function normalizePath($path)
  48235. {
  48236. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  48237. $path = preg_replace('|//|', '/', $path);
  48238. return $path;
  48239. }
  48240. public function isValid($uri)
  48241. {
  48242. $components = $this->parse($uri);
  48243. return !empty($components);
  48244. }
  48245. }
  48246. <?php
  48247. namespace JsonSchema\Uri;
  48248. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  48249. use JsonSchema\Exception\JsonDecodingException;
  48250. use JsonSchema\Exception\ResourceNotFoundException;
  48251. use JsonSchema\Uri\Retrievers\FileGetContents;
  48252. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  48253. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  48254. use JsonSchema\Validator;
  48255. class UriRetriever implements BaseUriRetrieverInterface
  48256. {
  48257. protected $translationMap = array(
  48258. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  48259. );
  48260. protected $uriRetriever = null;
  48261. private $schemaCache = array();
  48262. public function confirmMediaType($uriRetriever, $uri)
  48263. {
  48264. $contentType = $uriRetriever->getContentType();
  48265. if (is_null($contentType)) {
  48266. return;
  48267. }
  48268. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  48269. return;
  48270. }
  48271. if (substr($uri, 0, 23) == 'http://json-schema.org/') {
  48272. return true;
  48273. }
  48274. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  48275. }
  48276. public function getUriRetriever()
  48277. {
  48278. if (is_null($this->uriRetriever)) {
  48279. $this->setUriRetriever(new FileGetContents());
  48280. }
  48281. return $this->uriRetriever;
  48282. }
  48283. public function resolvePointer($jsonSchema, $uri)
  48284. {
  48285. $resolver = new UriResolver();
  48286. $parsed = $resolver->parse($uri);
  48287. if (empty($parsed['fragment'])) {
  48288. return $jsonSchema;
  48289. }
  48290. $path = explode('/', $parsed['fragment']);
  48291. while ($path) {
  48292. $pathElement = array_shift($path);
  48293. if (!empty($pathElement)) {
  48294. $pathElement = str_replace('~1', '/', $pathElement);
  48295. $pathElement = str_replace('~0', '~', $pathElement);
  48296. if (!empty($jsonSchema->$pathElement)) {
  48297. $jsonSchema = $jsonSchema->$pathElement;
  48298. } else {
  48299. throw new ResourceNotFoundException(
  48300. 'Fragment "' . $parsed['fragment'] . '" not found'
  48301. . ' in ' . $uri
  48302. );
  48303. }
  48304. if (!is_object($jsonSchema)) {
  48305. throw new ResourceNotFoundException(
  48306. 'Fragment part "' . $pathElement . '" is no object '
  48307. . ' in ' . $uri
  48308. );
  48309. }
  48310. }
  48311. }
  48312. return $jsonSchema;
  48313. }
  48314. public function retrieve($uri, $baseUri = null, $translate = true)
  48315. {
  48316. $resolver = new UriResolver();
  48317. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  48318. $arParts = $resolver->parse($resolvedUri);
  48319. if (isset($arParts['fragment'])) {
  48320. unset($arParts['fragment']);
  48321. $fetchUri = $resolver->generate($arParts);
  48322. }
  48323. if ($translate) {
  48324. $fetchUri = $this->translate($fetchUri);
  48325. }
  48326. $jsonSchema = $this->loadSchema($fetchUri);
  48327. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  48328. if ($jsonSchema instanceof \stdClass) {
  48329. $jsonSchema->id = $resolvedUri;
  48330. }
  48331. return $jsonSchema;
  48332. }
  48333. protected function loadSchema($fetchUri)
  48334. {
  48335. if (isset($this->schemaCache[$fetchUri])) {
  48336. return $this->schemaCache[$fetchUri];
  48337. }
  48338. $uriRetriever = $this->getUriRetriever();
  48339. $contents = $this->uriRetriever->retrieve($fetchUri);
  48340. $this->confirmMediaType($uriRetriever, $fetchUri);
  48341. $jsonSchema = json_decode($contents);
  48342. if (JSON_ERROR_NONE < $error = json_last_error()) {
  48343. throw new JsonDecodingException($error);
  48344. }
  48345. $this->schemaCache[$fetchUri] = $jsonSchema;
  48346. return $jsonSchema;
  48347. }
  48348. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  48349. {
  48350. $this->uriRetriever = $uriRetriever;
  48351. return $this;
  48352. }
  48353. public function parse($uri)
  48354. {
  48355. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  48356. $components = array();
  48357. if (5 < count($match)) {
  48358. $components = array(
  48359. 'scheme' => $match[2],
  48360. 'authority' => $match[4],
  48361. 'path' => $match[5]
  48362. );
  48363. }
  48364. if (7 < count($match)) {
  48365. $components['query'] = $match[7];
  48366. }
  48367. if (9 < count($match)) {
  48368. $components['fragment'] = $match[9];
  48369. }
  48370. return $components;
  48371. }
  48372. public function generate(array $components)
  48373. {
  48374. $uri = $components['scheme'] . '://'
  48375. . $components['authority']
  48376. . $components['path'];
  48377. if (array_key_exists('query', $components)) {
  48378. $uri .= $components['query'];
  48379. }
  48380. if (array_key_exists('fragment', $components)) {
  48381. $uri .= $components['fragment'];
  48382. }
  48383. return $uri;
  48384. }
  48385. public function resolve($uri, $baseUri = null)
  48386. {
  48387. $components = $this->parse($uri);
  48388. $path = $components['path'];
  48389. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  48390. return $uri;
  48391. }
  48392. $baseComponents = $this->parse($baseUri);
  48393. $basePath = $baseComponents['path'];
  48394. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  48395. return $this->generate($baseComponents);
  48396. }
  48397. public function isValid($uri)
  48398. {
  48399. $components = $this->parse($uri);
  48400. return !empty($components);
  48401. }
  48402. public function setTranslation($from, $to)
  48403. {
  48404. $this->translationMap[$from] = $to;
  48405. }
  48406. public function translate($uri)
  48407. {
  48408. foreach ($this->translationMap as $from => $to) {
  48409. $uri = preg_replace($from, $to, $uri);
  48410. }
  48411. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  48412. return $uri;
  48413. }
  48414. }
  48415. <?php
  48416. namespace JsonSchema;
  48417. interface UriResolverInterface
  48418. {
  48419. public function resolve($uri, $baseUri = null);
  48420. }
  48421. <?php
  48422. namespace JsonSchema;
  48423. interface UriRetrieverInterface
  48424. {
  48425. public function retrieve($uri, $baseUri = null);
  48426. }
  48427. <?php
  48428. namespace JsonSchema;
  48429. use JsonSchema\Constraints\BaseConstraint;
  48430. use JsonSchema\Constraints\Constraint;
  48431. use JsonSchema\Exception\InvalidConfigException;
  48432. use JsonSchema\SchemaStorage;
  48433. class Validator extends BaseConstraint
  48434. {
  48435. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  48436. const ERROR_NONE = 0x00000000;
  48437. const ERROR_ALL = 0xFFFFFFFF;
  48438. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  48439. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  48440. public function validate(&$value, $schema = null, $checkMode = null)
  48441. {
  48442. if (is_array($schema)) {
  48443. $schema = self::arrayToObjectRecursive($schema);
  48444. }
  48445. $initialCheckMode = $this->factory->getConfig();
  48446. if ($checkMode !== null) {
  48447. $this->factory->setConfig($checkMode);
  48448. }
  48449. if (is_object($schema) && property_exists($schema, 'id')) {
  48450. $schemaURI = $schema->id;
  48451. } else {
  48452. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  48453. }
  48454. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  48455. $validator = $this->factory->createInstanceFor('schema');
  48456. $validator->check(
  48457. $value,
  48458. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  48459. );
  48460. $this->factory->setConfig($initialCheckMode);
  48461. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  48462. return $validator->getErrorMask();
  48463. }
  48464. public function check($value, $schema)
  48465. {
  48466. return $this->validate($value, $schema);
  48467. }
  48468. public function coerce(&$value, $schema)
  48469. {
  48470. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  48471. }
  48472. }
  48473. Copyright (C) 2015 Composer
  48474. Permission is hereby granted, free of charge, to any person obtaining a copy of
  48475. this software and associated documentation files (the "Software"), to deal in
  48476. the Software without restriction, including without limitation the rights to
  48477. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  48478. of the Software, and to permit persons to whom the Software is furnished to do
  48479. so, subject to the following conditions:
  48480. The above copyright notice and this permission notice shall be included in all
  48481. copies or substantial portions of the Software.
  48482. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48483. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48484. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48485. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48486. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48487. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  48488. SOFTWARE.
  48489. <?php
  48490. namespace Composer\Spdx;
  48491. class SpdxLicenses
  48492. {
  48493. const LICENSES_FILE = 'spdx-licenses.json';
  48494. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  48495. private $licenses;
  48496. private $licensesExpression;
  48497. private $exceptions;
  48498. private $exceptionsExpression;
  48499. public function __construct()
  48500. {
  48501. $this->loadLicenses();
  48502. $this->loadExceptions();
  48503. }
  48504. public function getLicenseByIdentifier($identifier)
  48505. {
  48506. $key = strtolower($identifier);
  48507. if (!isset($this->licenses[$key])) {
  48508. return;
  48509. }
  48510. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  48511. return array(
  48512. $name,
  48513. $isOsiApproved,
  48514. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  48515. $isDeprecatedLicenseId,
  48516. );
  48517. }
  48518. public function getLicenses()
  48519. {
  48520. return $this->licenses;
  48521. }
  48522. public function getExceptionByIdentifier($identifier)
  48523. {
  48524. $key = strtolower($identifier);
  48525. if (!isset($this->exceptions[$key])) {
  48526. return;
  48527. }
  48528. list($identifier, $name) = $this->exceptions[$key];
  48529. return array(
  48530. $name,
  48531. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  48532. );
  48533. }
  48534. public function getIdentifierByName($name)
  48535. {
  48536. foreach ($this->licenses as $licenseData) {
  48537. if ($licenseData[1] === $name) {
  48538. return $licenseData[0];
  48539. }
  48540. }
  48541. foreach ($this->exceptions as $licenseData) {
  48542. if ($licenseData[1] === $name) {
  48543. return $licenseData[0];
  48544. }
  48545. }
  48546. }
  48547. public function isOsiApprovedByIdentifier($identifier)
  48548. {
  48549. return $this->licenses[strtolower($identifier)][2];
  48550. }
  48551. public function isDeprecatedByIdentifier($identifier)
  48552. {
  48553. return $this->licenses[strtolower($identifier)][3];
  48554. }
  48555. public function validate($license)
  48556. {
  48557. if (is_array($license)) {
  48558. $count = count($license);
  48559. if ($count !== count(array_filter($license, 'is_string'))) {
  48560. throw new \InvalidArgumentException('Array of strings expected.');
  48561. }
  48562. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  48563. }
  48564. if (!is_string($license)) {
  48565. throw new \InvalidArgumentException(sprintf(
  48566. 'Array or String expected, %s given.',
  48567. gettype($license)
  48568. ));
  48569. }
  48570. return $this->isValidLicenseString($license);
  48571. }
  48572. public static function getResourcesDir()
  48573. {
  48574. return dirname(__DIR__) . '/res';
  48575. }
  48576. private function loadLicenses()
  48577. {
  48578. if (null !== $this->licenses) {
  48579. return;
  48580. }
  48581. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  48582. $this->licenses = array();
  48583. foreach (json_decode($json, true) as $identifier => $license) {
  48584. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  48585. }
  48586. }
  48587. private function loadExceptions()
  48588. {
  48589. if (null !== $this->exceptions) {
  48590. return;
  48591. }
  48592. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  48593. $this->exceptions = array();
  48594. foreach (json_decode($json, true) as $identifier => $exception) {
  48595. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  48596. }
  48597. }
  48598. private function getLicensesExpression()
  48599. {
  48600. if (null === $this->licensesExpression) {
  48601. $licenses = array_map('preg_quote', array_keys($this->licenses));
  48602. rsort($licenses);
  48603. $licenses = implode('|', $licenses);
  48604. $this->licensesExpression = $licenses;
  48605. }
  48606. return $this->licensesExpression;
  48607. }
  48608. private function getExceptionsExpression()
  48609. {
  48610. if (null === $this->exceptionsExpression) {
  48611. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  48612. rsort($exceptions);
  48613. $exceptions = implode('|', $exceptions);
  48614. $this->exceptionsExpression = $exceptions;
  48615. }
  48616. return $this->exceptionsExpression;
  48617. }
  48618. private function isValidLicenseString($license)
  48619. {
  48620. if (isset($this->licenses[strtolower($license)])) {
  48621. return true;
  48622. }
  48623. $licenses = $this->getLicensesExpression();
  48624. $exceptions = $this->getExceptionsExpression();
  48625. $regex = <<<REGEX
  48626. {
  48627. (?(DEFINE)
  48628. # idstring: 1*( ALPHA / DIGIT / - / . )
  48629. (?<idstring>[\pL\pN.-]{1,})
  48630. # license-id: taken from list
  48631. (?<licenseid>${licenses})
  48632. # license-exception-id: taken from list
  48633. (?<licenseexceptionid>${exceptions})
  48634. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  48635. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  48636. # simple-expresssion: license-id / license-id+ / license-ref
  48637. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  48638. # compound-expression: 1*(
  48639. # simple-expression /
  48640. # simple-expression WITH license-exception-id /
  48641. # compound-expression AND compound-expression /
  48642. # compound-expression OR compound-expression
  48643. # ) / ( compound-expression ) )
  48644. (?<compound_head>
  48645. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  48646. | \( \s* (?&compound_expression) \s* \)
  48647. )
  48648. (?<compound_expression>
  48649. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  48650. )
  48651. # license-expression: 1*1(simple-expression / compound-expression)
  48652. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  48653. ) # end of define
  48654. ^(NONE | NOASSERTION | (?&license_expression))$
  48655. }xi
  48656. REGEX;
  48657. $match = preg_match($regex, $license);
  48658. if (0 === $match) {
  48659. return false;
  48660. }
  48661. if (false === $match) {
  48662. throw new \RuntimeException('Regex failed to compile/run.');
  48663. }
  48664. return true;
  48665. }
  48666. }
  48667. Copyright (C) 2015 Composer
  48668. Permission is hereby granted, free of charge, to any person obtaining a copy of
  48669. this software and associated documentation files (the "Software"), to deal in
  48670. the Software without restriction, including without limitation the rights to
  48671. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  48672. of the Software, and to permit persons to whom the Software is furnished to do
  48673. so, subject to the following conditions:
  48674. The above copyright notice and this permission notice shall be included in all
  48675. copies or substantial portions of the Software.
  48676. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48677. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48678. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48679. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48680. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48681. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  48682. SOFTWARE.
  48683. <?php
  48684. namespace Composer\Semver;
  48685. use Composer\Semver\Constraint\Constraint;
  48686. class Comparator
  48687. {
  48688. public static function greaterThan($version1, $version2)
  48689. {
  48690. return self::compare($version1, '>', $version2);
  48691. }
  48692. public static function greaterThanOrEqualTo($version1, $version2)
  48693. {
  48694. return self::compare($version1, '>=', $version2);
  48695. }
  48696. public static function lessThan($version1, $version2)
  48697. {
  48698. return self::compare($version1, '<', $version2);
  48699. }
  48700. public static function lessThanOrEqualTo($version1, $version2)
  48701. {
  48702. return self::compare($version1, '<=', $version2);
  48703. }
  48704. public static function equalTo($version1, $version2)
  48705. {
  48706. return self::compare($version1, '==', $version2);
  48707. }
  48708. public static function notEqualTo($version1, $version2)
  48709. {
  48710. return self::compare($version1, '!=', $version2);
  48711. }
  48712. public static function compare($version1, $operator, $version2)
  48713. {
  48714. $constraint = new Constraint($operator, $version2);
  48715. return $constraint->matches(new Constraint('==', $version1));
  48716. }
  48717. }
  48718. <?php
  48719. namespace Composer\Semver\Constraint;
  48720. trigger_error('The ' . __CLASS__ . ' abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  48721. abstract class AbstractConstraint implements ConstraintInterface
  48722. {
  48723. protected $prettyString;
  48724. public function matches(ConstraintInterface $provider)
  48725. {
  48726. if ($provider instanceof $this) {
  48727. return $this->matchSpecific($provider);
  48728. }
  48729. return $provider->matches($this);
  48730. }
  48731. public function setPrettyString($prettyString)
  48732. {
  48733. $this->prettyString = $prettyString;
  48734. }
  48735. public function getPrettyString()
  48736. {
  48737. if ($this->prettyString) {
  48738. return $this->prettyString;
  48739. }
  48740. return $this->__toString();
  48741. }
  48742. }
  48743. <?php
  48744. namespace Composer\Semver\Constraint;
  48745. class Constraint implements ConstraintInterface
  48746. {
  48747. const OP_EQ = 0;
  48748. const OP_LT = 1;
  48749. const OP_LE = 2;
  48750. const OP_GT = 3;
  48751. const OP_GE = 4;
  48752. const OP_NE = 5;
  48753. private static $transOpStr = array(
  48754. '=' => self::OP_EQ,
  48755. '==' => self::OP_EQ,
  48756. '<' => self::OP_LT,
  48757. '<=' => self::OP_LE,
  48758. '>' => self::OP_GT,
  48759. '>=' => self::OP_GE,
  48760. '<>' => self::OP_NE,
  48761. '!=' => self::OP_NE,
  48762. );
  48763. private static $transOpInt = array(
  48764. self::OP_EQ => '==',
  48765. self::OP_LT => '<',
  48766. self::OP_LE => '<=',
  48767. self::OP_GT => '>',
  48768. self::OP_GE => '>=',
  48769. self::OP_NE => '!=',
  48770. );
  48771. protected $operator;
  48772. protected $version;
  48773. protected $prettyString;
  48774. public function matches(ConstraintInterface $provider)
  48775. {
  48776. if ($provider instanceof $this) {
  48777. return $this->matchSpecific($provider);
  48778. }
  48779. return $provider->matches($this);
  48780. }
  48781. public function setPrettyString($prettyString)
  48782. {
  48783. $this->prettyString = $prettyString;
  48784. }
  48785. public function getPrettyString()
  48786. {
  48787. if ($this->prettyString) {
  48788. return $this->prettyString;
  48789. }
  48790. return $this->__toString();
  48791. }
  48792. public static function getSupportedOperators()
  48793. {
  48794. return array_keys(self::$transOpStr);
  48795. }
  48796. public function __construct($operator, $version)
  48797. {
  48798. if (!isset(self::$transOpStr[$operator])) {
  48799. throw new \InvalidArgumentException(sprintf(
  48800. 'Invalid operator "%s" given, expected one of: %s',
  48801. $operator,
  48802. implode(', ', self::getSupportedOperators())
  48803. ));
  48804. }
  48805. $this->operator = self::$transOpStr[$operator];
  48806. $this->version = $version;
  48807. }
  48808. public function versionCompare($a, $b, $operator, $compareBranches = false)
  48809. {
  48810. if (!isset(self::$transOpStr[$operator])) {
  48811. throw new \InvalidArgumentException(sprintf(
  48812. 'Invalid operator "%s" given, expected one of: %s',
  48813. $operator,
  48814. implode(', ', self::getSupportedOperators())
  48815. ));
  48816. }
  48817. $aIsBranch = 'dev-' === substr($a, 0, 4);
  48818. $bIsBranch = 'dev-' === substr($b, 0, 4);
  48819. if ($aIsBranch && $bIsBranch) {
  48820. return $operator === '==' && $a === $b;
  48821. }
  48822. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  48823. return false;
  48824. }
  48825. return version_compare($a, $b, $operator);
  48826. }
  48827. public function matchSpecific(Constraint $provider, $compareBranches = false)
  48828. {
  48829. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  48830. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  48831. $isEqualOp = self::OP_EQ === $this->operator;
  48832. $isNonEqualOp = self::OP_NE === $this->operator;
  48833. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  48834. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  48835. if ($isNonEqualOp || $isProviderNonEqualOp) {
  48836. return !$isEqualOp && !$isProviderEqualOp
  48837. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  48838. }
  48839. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  48840. return true;
  48841. }
  48842. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  48843. if ($provider->version === $this->version
  48844. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  48845. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  48846. return false;
  48847. }
  48848. return true;
  48849. }
  48850. return false;
  48851. }
  48852. public function __toString()
  48853. {
  48854. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  48855. }
  48856. }
  48857. <?php
  48858. namespace Composer\Semver\Constraint;
  48859. interface ConstraintInterface
  48860. {
  48861. public function matches(ConstraintInterface $provider);
  48862. public function getPrettyString();
  48863. public function __toString();
  48864. }
  48865. <?php
  48866. namespace Composer\Semver\Constraint;
  48867. class EmptyConstraint implements ConstraintInterface
  48868. {
  48869. protected $prettyString;
  48870. public function matches(ConstraintInterface $provider)
  48871. {
  48872. return true;
  48873. }
  48874. public function setPrettyString($prettyString)
  48875. {
  48876. $this->prettyString = $prettyString;
  48877. }
  48878. public function getPrettyString()
  48879. {
  48880. if ($this->prettyString) {
  48881. return $this->prettyString;
  48882. }
  48883. return $this->__toString();
  48884. }
  48885. public function __toString()
  48886. {
  48887. return '[]';
  48888. }
  48889. }
  48890. <?php
  48891. namespace Composer\Semver\Constraint;
  48892. class MultiConstraint implements ConstraintInterface
  48893. {
  48894. protected $constraints;
  48895. protected $prettyString;
  48896. protected $conjunctive;
  48897. public function __construct(array $constraints, $conjunctive = true)
  48898. {
  48899. $this->constraints = $constraints;
  48900. $this->conjunctive = $conjunctive;
  48901. }
  48902. public function getConstraints()
  48903. {
  48904. return $this->constraints;
  48905. }
  48906. public function isConjunctive()
  48907. {
  48908. return $this->conjunctive;
  48909. }
  48910. public function isDisjunctive()
  48911. {
  48912. return !$this->conjunctive;
  48913. }
  48914. public function matches(ConstraintInterface $provider)
  48915. {
  48916. if (false === $this->conjunctive) {
  48917. foreach ($this->constraints as $constraint) {
  48918. if ($constraint->matches($provider)) {
  48919. return true;
  48920. }
  48921. }
  48922. return false;
  48923. }
  48924. foreach ($this->constraints as $constraint) {
  48925. if (!$constraint->matches($provider)) {
  48926. return false;
  48927. }
  48928. }
  48929. return true;
  48930. }
  48931. public function setPrettyString($prettyString)
  48932. {
  48933. $this->prettyString = $prettyString;
  48934. }
  48935. public function getPrettyString()
  48936. {
  48937. if ($this->prettyString) {
  48938. return $this->prettyString;
  48939. }
  48940. return $this->__toString();
  48941. }
  48942. public function __toString()
  48943. {
  48944. $constraints = array();
  48945. foreach ($this->constraints as $constraint) {
  48946. $constraints[] = (string) $constraint;
  48947. }
  48948. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  48949. }
  48950. }
  48951. <?php
  48952. namespace Composer\Semver;
  48953. use Composer\Semver\Constraint\Constraint;
  48954. class Semver
  48955. {
  48956. const SORT_ASC = 1;
  48957. const SORT_DESC = -1;
  48958. private static $versionParser;
  48959. public static function satisfies($version, $constraints)
  48960. {
  48961. if (null === self::$versionParser) {
  48962. self::$versionParser = new VersionParser();
  48963. }
  48964. $versionParser = self::$versionParser;
  48965. $provider = new Constraint('==', $versionParser->normalize($version));
  48966. $constraints = $versionParser->parseConstraints($constraints);
  48967. return $constraints->matches($provider);
  48968. }
  48969. public static function satisfiedBy(array $versions, $constraints)
  48970. {
  48971. $versions = array_filter($versions, function ($version) use ($constraints) {
  48972. return Semver::satisfies($version, $constraints);
  48973. });
  48974. return array_values($versions);
  48975. }
  48976. public static function sort(array $versions)
  48977. {
  48978. return self::usort($versions, self::SORT_ASC);
  48979. }
  48980. public static function rsort(array $versions)
  48981. {
  48982. return self::usort($versions, self::SORT_DESC);
  48983. }
  48984. private static function usort(array $versions, $direction)
  48985. {
  48986. if (null === self::$versionParser) {
  48987. self::$versionParser = new VersionParser();
  48988. }
  48989. $versionParser = self::$versionParser;
  48990. $normalized = array();
  48991. foreach ($versions as $key => $version) {
  48992. $normalized[] = array($versionParser->normalize($version), $key);
  48993. }
  48994. usort($normalized, function (array $left, array $right) use ($direction) {
  48995. if ($left[0] === $right[0]) {
  48996. return 0;
  48997. }
  48998. if (Comparator::lessThan($left[0], $right[0])) {
  48999. return -$direction;
  49000. }
  49001. return $direction;
  49002. });
  49003. $sorted = array();
  49004. foreach ($normalized as $item) {
  49005. $sorted[] = $versions[$item[1]];
  49006. }
  49007. return $sorted;
  49008. }
  49009. }
  49010. <?php
  49011. namespace Composer\Semver;
  49012. use Composer\Semver\Constraint\ConstraintInterface;
  49013. use Composer\Semver\Constraint\EmptyConstraint;
  49014. use Composer\Semver\Constraint\MultiConstraint;
  49015. use Composer\Semver\Constraint\Constraint;
  49016. class VersionParser
  49017. {
  49018. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  49019. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  49020. public static function parseStability($version)
  49021. {
  49022. $version = preg_replace('{#.+$}i', '', $version);
  49023. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  49024. return 'dev';
  49025. }
  49026. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  49027. if (!empty($match[3])) {
  49028. return 'dev';
  49029. }
  49030. if (!empty($match[1])) {
  49031. if ('beta' === $match[1] || 'b' === $match[1]) {
  49032. return 'beta';
  49033. }
  49034. if ('alpha' === $match[1] || 'a' === $match[1]) {
  49035. return 'alpha';
  49036. }
  49037. if ('rc' === $match[1]) {
  49038. return 'RC';
  49039. }
  49040. }
  49041. return 'stable';
  49042. }
  49043. public static function normalizeStability($stability)
  49044. {
  49045. $stability = strtolower($stability);
  49046. return $stability === 'rc' ? 'RC' : $stability;
  49047. }
  49048. public function normalize($version, $fullVersion = null)
  49049. {
  49050. $version = trim($version);
  49051. if (null === $fullVersion) {
  49052. $fullVersion = $version;
  49053. }
  49054. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  49055. $version = $match[1];
  49056. }
  49057. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  49058. return '9999999-dev';
  49059. }
  49060. if ('dev-' === strtolower(substr($version, 0, 4))) {
  49061. return 'dev-' . substr($version, 4);
  49062. }
  49063. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  49064. $version = $match[1];
  49065. }
  49066. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  49067. $version = $matches[1]
  49068. . (!empty($matches[2]) ? $matches[2] : '.0')
  49069. . (!empty($matches[3]) ? $matches[3] : '.0')
  49070. . (!empty($matches[4]) ? $matches[4] : '.0');
  49071. $index = 5;
  49072. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  49073. $version = preg_replace('{\D}', '.', $matches[1]);
  49074. $index = 2;
  49075. }
  49076. if (isset($index)) {
  49077. if (!empty($matches[$index])) {
  49078. if ('stable' === $matches[$index]) {
  49079. return $version;
  49080. }
  49081. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  49082. }
  49083. if (!empty($matches[$index + 2])) {
  49084. $version .= '-dev';
  49085. }
  49086. return $version;
  49087. }
  49088. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  49089. try {
  49090. return $this->normalizeBranch($match[1]);
  49091. } catch (\Exception $e) {
  49092. }
  49093. }
  49094. $extraMessage = '';
  49095. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  49096. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  49097. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  49098. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  49099. }
  49100. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  49101. }
  49102. public function parseNumericAliasPrefix($branch)
  49103. {
  49104. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  49105. return $matches['version'] . '.';
  49106. }
  49107. return false;
  49108. }
  49109. public function normalizeBranch($name)
  49110. {
  49111. $name = trim($name);
  49112. if (in_array($name, array('master', 'trunk', 'default'))) {
  49113. return $this->normalize($name);
  49114. }
  49115. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  49116. $version = '';
  49117. for ($i = 1; $i < 5; ++$i) {
  49118. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  49119. }
  49120. return str_replace('x', '9999999', $version) . '-dev';
  49121. }
  49122. return 'dev-' . $name;
  49123. }
  49124. public function parseConstraints($constraints)
  49125. {
  49126. $prettyConstraint = $constraints;
  49127. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  49128. $constraints = empty($match[1]) ? '*' : $match[1];
  49129. }
  49130. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  49131. $constraints = $match[1];
  49132. }
  49133. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  49134. $orGroups = array();
  49135. foreach ($orConstraints as $constraints) {
  49136. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  49137. if (count($andConstraints) > 1) {
  49138. $constraintObjects = array();
  49139. foreach ($andConstraints as $constraint) {
  49140. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  49141. $constraintObjects[] = $parsedConstraint;
  49142. }
  49143. }
  49144. } else {
  49145. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  49146. }
  49147. if (1 === count($constraintObjects)) {
  49148. $constraint = $constraintObjects[0];
  49149. } else {
  49150. $constraint = new MultiConstraint($constraintObjects);
  49151. }
  49152. $orGroups[] = $constraint;
  49153. }
  49154. if (1 === count($orGroups)) {
  49155. $constraint = $orGroups[0];
  49156. } elseif (2 === count($orGroups)
  49157. && $orGroups[0] instanceof MultiConstraint
  49158. && $orGroups[1] instanceof MultiConstraint
  49159. && 2 === count($orGroups[0]->getConstraints())
  49160. && 2 === count($orGroups[1]->getConstraints())
  49161. && ($a = (string) $orGroups[0])
  49162. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  49163. && ($b = (string) $orGroups[1])
  49164. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  49165. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  49166. ) {
  49167. $constraint = new MultiConstraint(array(
  49168. new Constraint('>=', substr($a, 4, $posA - 5)),
  49169. new Constraint('<', substr($b, $posB + 2, -1)),
  49170. ));
  49171. } else {
  49172. $constraint = new MultiConstraint($orGroups, false);
  49173. }
  49174. $constraint->setPrettyString($prettyConstraint);
  49175. return $constraint;
  49176. }
  49177. private function parseConstraint($constraint)
  49178. {
  49179. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  49180. $constraint = $match[1];
  49181. if ($match[2] !== 'stable') {
  49182. $stabilityModifier = $match[2];
  49183. }
  49184. }
  49185. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  49186. return array(new EmptyConstraint());
  49187. }
  49188. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  49189. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  49190. if (substr($constraint, 0, 2) === '~>') {
  49191. throw new \UnexpectedValueException(
  49192. 'Could not parse version constraint ' . $constraint . ': ' .
  49193. 'Invalid operator "~>", you probably meant to use the "~" operator'
  49194. );
  49195. }
  49196. if (isset($matches[4]) && '' !== $matches[4]) {
  49197. $position = 4;
  49198. } elseif (isset($matches[3]) && '' !== $matches[3]) {
  49199. $position = 3;
  49200. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  49201. $position = 2;
  49202. } else {
  49203. $position = 1;
  49204. }
  49205. $stabilitySuffix = '';
  49206. if (!empty($matches[5])) {
  49207. $stabilitySuffix .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
  49208. }
  49209. if (!empty($matches[7])) {
  49210. $stabilitySuffix .= '-dev';
  49211. }
  49212. if (!$stabilitySuffix) {
  49213. $stabilitySuffix = '-dev';
  49214. }
  49215. $lowVersion = $this->manipulateVersionString($matches, $position, 0) . $stabilitySuffix;
  49216. $lowerBound = new Constraint('>=', $lowVersion);
  49217. $highPosition = max(1, $position - 1);
  49218. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  49219. $upperBound = new Constraint('<', $highVersion);
  49220. return array(
  49221. $lowerBound,
  49222. $upperBound,
  49223. );
  49224. }
  49225. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  49226. if ('0' !== $matches[1] || '' === $matches[2]) {
  49227. $position = 1;
  49228. } elseif ('0' !== $matches[2] || '' === $matches[3]) {
  49229. $position = 2;
  49230. } else {
  49231. $position = 3;
  49232. }
  49233. $stabilitySuffix = '';
  49234. if (empty($matches[5]) && empty($matches[7])) {
  49235. $stabilitySuffix .= '-dev';
  49236. }
  49237. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  49238. $lowerBound = new Constraint('>=', $lowVersion);
  49239. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  49240. $upperBound = new Constraint('<', $highVersion);
  49241. return array(
  49242. $lowerBound,
  49243. $upperBound,
  49244. );
  49245. }
  49246. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  49247. if (isset($matches[3]) && '' !== $matches[3]) {
  49248. $position = 3;
  49249. } elseif (isset($matches[2]) && '' !== $matches[2]) {
  49250. $position = 2;
  49251. } else {
  49252. $position = 1;
  49253. }
  49254. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  49255. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  49256. if ($lowVersion === '0.0.0.0-dev') {
  49257. return array(new Constraint('<', $highVersion));
  49258. }
  49259. return array(
  49260. new Constraint('>=', $lowVersion),
  49261. new Constraint('<', $highVersion),
  49262. );
  49263. }
  49264. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  49265. $lowStabilitySuffix = '';
  49266. if (empty($matches[6]) && empty($matches[8])) {
  49267. $lowStabilitySuffix = '-dev';
  49268. }
  49269. $lowVersion = $this->normalize($matches['from']);
  49270. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  49271. $empty = function ($x) {
  49272. return ($x === 0 || $x === '0') ? false : empty($x);
  49273. };
  49274. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  49275. $highVersion = $this->normalize($matches['to']);
  49276. $upperBound = new Constraint('<=', $highVersion);
  49277. } else {
  49278. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  49279. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  49280. $upperBound = new Constraint('<', $highVersion);
  49281. }
  49282. return array(
  49283. $lowerBound,
  49284. $upperBound,
  49285. );
  49286. }
  49287. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  49288. try {
  49289. $version = $this->normalize($matches[2]);
  49290. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  49291. $version .= '-' . $stabilityModifier;
  49292. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  49293. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  49294. if (substr($matches[2], 0, 4) !== 'dev-') {
  49295. $version .= '-dev';
  49296. }
  49297. }
  49298. }
  49299. return array(new Constraint($matches[1] ?: '=', $version));
  49300. } catch (\Exception $e) {
  49301. }
  49302. }
  49303. $message = 'Could not parse version constraint ' . $constraint;
  49304. if (isset($e)) {
  49305. $message .= ': ' . $e->getMessage();
  49306. }
  49307. throw new \UnexpectedValueException($message);
  49308. }
  49309. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  49310. {
  49311. for ($i = 4; $i > 0; --$i) {
  49312. if ($i > $position) {
  49313. $matches[$i] = $pad;
  49314. } elseif ($i === $position && $increment) {
  49315. $matches[$i] += $increment;
  49316. if ($matches[$i] < 0) {
  49317. $matches[$i] = $pad;
  49318. --$position;
  49319. if ($i === 1) {
  49320. return;
  49321. }
  49322. }
  49323. }
  49324. }
  49325. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  49326. }
  49327. private function expandStability($stability)
  49328. {
  49329. $stability = strtolower($stability);
  49330. switch ($stability) {
  49331. case 'a':
  49332. return 'alpha';
  49333. case 'b':
  49334. return 'beta';
  49335. case 'p':
  49336. case 'pl':
  49337. return 'patch';
  49338. case 'rc':
  49339. return 'RC';
  49340. default:
  49341. return $stability;
  49342. }
  49343. }
  49344. }
  49345. Copyright (C) 2016 Composer
  49346. Permission is hereby granted, free of charge, to any person obtaining a copy of
  49347. this software and associated documentation files (the "Software"), to deal in
  49348. the Software without restriction, including without limitation the rights to
  49349. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  49350. of the Software, and to permit persons to whom the Software is furnished to do
  49351. so, subject to the following conditions:
  49352. The above copyright notice and this permission notice shall be included in all
  49353. copies or substantial portions of the Software.
  49354. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49355. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49356. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49357. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49358. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49359. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  49360. SOFTWARE.
  49361. <?php
  49362. namespace Composer\CaBundle;
  49363. use Psr\Log\LoggerInterface;
  49364. use Symfony\Component\Process\PhpProcess;
  49365. class CaBundle
  49366. {
  49367. private static $caPath;
  49368. private static $caFileValidity = array();
  49369. private static $useOpensslParse;
  49370. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  49371. {
  49372. if (self::$caPath !== null) {
  49373. return self::$caPath;
  49374. }
  49375. $envCertFile = getenv('SSL_CERT_FILE');
  49376. if ($envCertFile && is_readable($envCertFile) && static::validateCaFile($envCertFile, $logger)) {
  49377. return self::$caPath = $envCertFile;
  49378. }
  49379. $envCertDir = getenv('SSL_CERT_DIR');
  49380. if ($envCertDir && is_dir($envCertDir) && is_readable($envCertDir)) {
  49381. return self::$caPath = $envCertDir;
  49382. }
  49383. $configured = ini_get('openssl.cafile');
  49384. if ($configured && strlen($configured) > 0 && is_readable($configured) && static::validateCaFile($configured, $logger)) {
  49385. return self::$caPath = $configured;
  49386. }
  49387. $configured = ini_get('openssl.capath');
  49388. if ($configured && is_dir($configured) && is_readable($configured)) {
  49389. return self::$caPath = $configured;
  49390. }
  49391. $caBundlePaths = array(
  49392. '/etc/pki/tls/certs/ca-bundle.crt',
  49393. '/etc/ssl/certs/ca-certificates.crt',
  49394. '/etc/ssl/ca-bundle.pem',
  49395. '/usr/local/share/certs/ca-root-nss.crt',
  49396. '/usr/ssl/certs/ca-bundle.crt',
  49397. '/opt/local/share/curl/curl-ca-bundle.crt',
  49398. '/usr/local/share/curl/curl-ca-bundle.crt',
  49399. '/usr/share/ssl/certs/ca-bundle.crt',
  49400. '/etc/ssl/cert.pem',
  49401. '/usr/local/etc/ssl/cert.pem',
  49402. '/usr/local/etc/openssl/cert.pem',
  49403. );
  49404. foreach ($caBundlePaths as $caBundle) {
  49405. if (@is_readable($caBundle) && static::validateCaFile($caBundle, $logger)) {
  49406. return self::$caPath = $caBundle;
  49407. }
  49408. }
  49409. foreach ($caBundlePaths as $caBundle) {
  49410. $caBundle = dirname($caBundle);
  49411. if (@is_dir($caBundle) && glob($caBundle.'/*')) {
  49412. return self::$caPath = $caBundle;
  49413. }
  49414. }
  49415. return self::$caPath = static::getBundledCaBundlePath();
  49416. }
  49417. public static function getBundledCaBundlePath()
  49418. {
  49419. $caBundleFile = __DIR__.'/../res/cacert.pem';
  49420. if (0 === strpos($caBundleFile, 'phar://')) {
  49421. file_put_contents(
  49422. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  49423. file_get_contents($caBundleFile)
  49424. );
  49425. register_shutdown_function(function() use ($tempCaBundleFile) {
  49426. @unlink($tempCaBundleFile);
  49427. });
  49428. $caBundleFile = $tempCaBundleFile;
  49429. }
  49430. return $caBundleFile;
  49431. }
  49432. public static function validateCaFile($filename, LoggerInterface $logger = null)
  49433. {
  49434. static $warned = false;
  49435. if (isset(self::$caFileValidity[$filename])) {
  49436. return self::$caFileValidity[$filename];
  49437. }
  49438. $contents = file_get_contents($filename);
  49439. if (!static::isOpensslParseSafe()) {
  49440. if (!$warned && $logger) {
  49441. $logger->warning(sprintf(
  49442. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  49443. PHP_VERSION
  49444. ));
  49445. $warned = true;
  49446. }
  49447. $isValid = !empty($contents);
  49448. } else {
  49449. $isValid = (bool) openssl_x509_parse($contents);
  49450. }
  49451. if ($logger) {
  49452. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  49453. }
  49454. return self::$caFileValidity[$filename] = $isValid;
  49455. }
  49456. public static function isOpensslParseSafe()
  49457. {
  49458. if (null !== self::$useOpensslParse) {
  49459. return self::$useOpensslParse;
  49460. }
  49461. if (PHP_VERSION_ID >= 50600) {
  49462. return self::$useOpensslParse = true;
  49463. }
  49464. if (
  49465. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  49466. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  49467. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  49468. ) {
  49469. return self::$useOpensslParse = true;
  49470. }
  49471. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  49472. return self::$useOpensslParse = false;
  49473. }
  49474. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  49475. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  49476. if (preg_match($regex, PHP_VERSION, $m)) {
  49477. return ((int) $m[1]) >= $fixedVersion;
  49478. }
  49479. return false;
  49480. };
  49481. if (
  49482. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  49483. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  49484. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  49485. ) {
  49486. return self::$useOpensslParse = true;
  49487. }
  49488. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  49489. return self::$useOpensslParse = false;
  49490. }
  49491. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  49492. $script = <<<'EOT'
  49493. error_reporting(-1);
  49494. $info = openssl_x509_parse(base64_decode('%s'));
  49495. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  49496. EOT;
  49497. $script = '<'."?php\n".sprintf($script, $cert);
  49498. try {
  49499. $process = new PhpProcess($script);
  49500. $process->mustRun();
  49501. } catch (\Exception $e) {
  49502. return self::$useOpensslParse = false;
  49503. }
  49504. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  49505. $errorOutput = trim($process->getErrorOutput());
  49506. if (
  49507. count($output) === 3
  49508. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  49509. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  49510. && $output[2] === 'int(-1)'
  49511. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  49512. ) {
  49513. return self::$useOpensslParse = true;
  49514. }
  49515. return self::$useOpensslParse = false;
  49516. }
  49517. public static function reset()
  49518. {
  49519. self::$caFileValidity = array();
  49520. self::$caPath = null;
  49521. self::$useOpensslParse = null;
  49522. }
  49523. }
  49524. Copyright (c) 2012 PHP Framework Interoperability Group
  49525. Permission is hereby granted, free of charge, to any person obtaining a copy
  49526. of this software and associated documentation files (the "Software"), to deal
  49527. in the Software without restriction, including without limitation the rights
  49528. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  49529. copies of the Software, and to permit persons to whom the Software is
  49530. furnished to do so, subject to the following conditions:
  49531. The above copyright notice and this permission notice shall be included in
  49532. all copies or substantial portions of the Software.
  49533. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49534. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49535. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49536. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49537. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49538. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  49539. THE SOFTWARE.
  49540. <?php
  49541. namespace Psr\Log;
  49542. abstract class AbstractLogger implements LoggerInterface
  49543. {
  49544. public function emergency($message, array $context = array())
  49545. {
  49546. $this->log(LogLevel::EMERGENCY, $message, $context);
  49547. }
  49548. public function alert($message, array $context = array())
  49549. {
  49550. $this->log(LogLevel::ALERT, $message, $context);
  49551. }
  49552. public function critical($message, array $context = array())
  49553. {
  49554. $this->log(LogLevel::CRITICAL, $message, $context);
  49555. }
  49556. public function error($message, array $context = array())
  49557. {
  49558. $this->log(LogLevel::ERROR, $message, $context);
  49559. }
  49560. public function warning($message, array $context = array())
  49561. {
  49562. $this->log(LogLevel::WARNING, $message, $context);
  49563. }
  49564. public function notice($message, array $context = array())
  49565. {
  49566. $this->log(LogLevel::NOTICE, $message, $context);
  49567. }
  49568. public function info($message, array $context = array())
  49569. {
  49570. $this->log(LogLevel::INFO, $message, $context);
  49571. }
  49572. public function debug($message, array $context = array())
  49573. {
  49574. $this->log(LogLevel::DEBUG, $message, $context);
  49575. }
  49576. }
  49577. <?php
  49578. namespace Psr\Log;
  49579. class InvalidArgumentException extends \InvalidArgumentException
  49580. {
  49581. }
  49582. <?php
  49583. namespace Psr\Log;
  49584. class LogLevel
  49585. {
  49586. const EMERGENCY = 'emergency';
  49587. const ALERT = 'alert';
  49588. const CRITICAL = 'critical';
  49589. const ERROR = 'error';
  49590. const WARNING = 'warning';
  49591. const NOTICE = 'notice';
  49592. const INFO = 'info';
  49593. const DEBUG = 'debug';
  49594. }
  49595. <?php
  49596. namespace Psr\Log;
  49597. interface LoggerAwareInterface
  49598. {
  49599. public function setLogger(LoggerInterface $logger);
  49600. }
  49601. <?php
  49602. namespace Psr\Log;
  49603. trait LoggerAwareTrait
  49604. {
  49605. protected $logger;
  49606. public function setLogger(LoggerInterface $logger)
  49607. {
  49608. $this->logger = $logger;
  49609. }
  49610. }
  49611. <?php
  49612. namespace Psr\Log;
  49613. interface LoggerInterface
  49614. {
  49615. public function emergency($message, array $context = array());
  49616. public function alert($message, array $context = array());
  49617. public function critical($message, array $context = array());
  49618. public function error($message, array $context = array());
  49619. public function warning($message, array $context = array());
  49620. public function notice($message, array $context = array());
  49621. public function info($message, array $context = array());
  49622. public function debug($message, array $context = array());
  49623. public function log($level, $message, array $context = array());
  49624. }
  49625. <?php
  49626. namespace Psr\Log;
  49627. trait LoggerTrait
  49628. {
  49629. public function emergency($message, array $context = array())
  49630. {
  49631. $this->log(LogLevel::EMERGENCY, $message, $context);
  49632. }
  49633. public function alert($message, array $context = array())
  49634. {
  49635. $this->log(LogLevel::ALERT, $message, $context);
  49636. }
  49637. public function critical($message, array $context = array())
  49638. {
  49639. $this->log(LogLevel::CRITICAL, $message, $context);
  49640. }
  49641. public function error($message, array $context = array())
  49642. {
  49643. $this->log(LogLevel::ERROR, $message, $context);
  49644. }
  49645. public function warning($message, array $context = array())
  49646. {
  49647. $this->log(LogLevel::WARNING, $message, $context);
  49648. }
  49649. public function notice($message, array $context = array())
  49650. {
  49651. $this->log(LogLevel::NOTICE, $message, $context);
  49652. }
  49653. public function info($message, array $context = array())
  49654. {
  49655. $this->log(LogLevel::INFO, $message, $context);
  49656. }
  49657. public function debug($message, array $context = array())
  49658. {
  49659. $this->log(LogLevel::DEBUG, $message, $context);
  49660. }
  49661. abstract public function log($level, $message, array $context = array());
  49662. }
  49663. <?php
  49664. namespace Psr\Log;
  49665. class NullLogger extends AbstractLogger
  49666. {
  49667. public function log($level, $message, array $context = array())
  49668. {
  49669. }
  49670. }
  49671. <?php
  49672. namespace Psr\Log\Test;
  49673. use Psr\Log\LoggerInterface;
  49674. use Psr\Log\LogLevel;
  49675. abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
  49676. {
  49677. abstract public function getLogger();
  49678. abstract public function getLogs();
  49679. public function testImplements()
  49680. {
  49681. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  49682. }
  49683. public function testLogsAtAllLevels($level, $message)
  49684. {
  49685. $logger = $this->getLogger();
  49686. $logger->{$level}($message, array('user' => 'Bob'));
  49687. $logger->log($level, $message, array('user' => 'Bob'));
  49688. $expected = array(
  49689. $level.' message of level '.$level.' with context: Bob',
  49690. $level.' message of level '.$level.' with context: Bob',
  49691. );
  49692. $this->assertEquals($expected, $this->getLogs());
  49693. }
  49694. public function provideLevelsAndMessages()
  49695. {
  49696. return array(
  49697. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  49698. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  49699. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  49700. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  49701. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  49702. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  49703. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  49704. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  49705. );
  49706. }
  49707. public function testThrowsOnInvalidLevel()
  49708. {
  49709. $logger = $this->getLogger();
  49710. $logger->log('invalid level', 'Foo');
  49711. }
  49712. public function testContextReplacement()
  49713. {
  49714. $logger = $this->getLogger();
  49715. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  49716. $expected = array('info {Message {nothing} Bob Bar a}');
  49717. $this->assertEquals($expected, $this->getLogs());
  49718. }
  49719. public function testObjectCastToString()
  49720. {
  49721. if (method_exists($this, 'createPartialMock')) {
  49722. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  49723. } else {
  49724. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  49725. }
  49726. $dummy->expects($this->once())
  49727. ->method('__toString')
  49728. ->will($this->returnValue('DUMMY'));
  49729. $this->getLogger()->warning($dummy);
  49730. $expected = array('warning DUMMY');
  49731. $this->assertEquals($expected, $this->getLogs());
  49732. }
  49733. public function testContextCanContainAnything()
  49734. {
  49735. $context = array(
  49736. 'bool' => true,
  49737. 'null' => null,
  49738. 'string' => 'Foo',
  49739. 'int' => 0,
  49740. 'float' => 0.5,
  49741. 'nested' => array('with object' => new DummyTest),
  49742. 'object' => new \DateTime,
  49743. 'resource' => fopen('php://memory', 'r'),
  49744. );
  49745. $this->getLogger()->warning('Crazy context data', $context);
  49746. $expected = array('warning Crazy context data');
  49747. $this->assertEquals($expected, $this->getLogs());
  49748. }
  49749. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  49750. {
  49751. $logger = $this->getLogger();
  49752. $logger->warning('Random message', array('exception' => 'oops'));
  49753. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  49754. $expected = array(
  49755. 'warning Random message',
  49756. 'critical Uncaught Exception!'
  49757. );
  49758. $this->assertEquals($expected, $this->getLogs());
  49759. }
  49760. }
  49761. class DummyTest
  49762. {
  49763. public function __toString()
  49764. {
  49765. }
  49766. }
  49767. <?php
  49768. require_once __DIR__ . '/composer/autoload_real.php';
  49769. return ComposerAutoloaderInitComposerPhar1517412498::getLoader();
  49770. <?php
  49771. $vendorDir = dirname(dirname(__FILE__));
  49772. $baseDir = dirname($vendorDir);
  49773. return array(
  49774. );
  49775. <?php
  49776. $vendorDir = dirname(dirname(__FILE__));
  49777. $baseDir = dirname($vendorDir);
  49778. return array(
  49779. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  49780. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  49781. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  49782. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  49783. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  49784. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  49785. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  49786. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  49787. 'Seld\\CliPrompt\\' => array($vendorDir . '/seld/cli-prompt/src'),
  49788. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  49789. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  49790. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  49791. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  49792. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  49793. 'Composer\\' => array($baseDir . '/src/Composer'),
  49794. );
  49795. <?php
  49796. $vendorDir = dirname(dirname(__FILE__));
  49797. $baseDir = dirname($vendorDir);
  49798. return array(
  49799. );
  49800. <?php
  49801. $vendorDir = dirname(dirname(__FILE__));
  49802. $baseDir = dirname($vendorDir);
  49803. return array(
  49804. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  49805. );
  49806. <?php
  49807. class ComposerAutoloaderInitComposerPhar1517412498
  49808. {
  49809. private static $loader;
  49810. public static function loadClassLoader($class)
  49811. {
  49812. if ('Composer\Autoload\ClassLoader' === $class) {
  49813. require __DIR__ . '/ClassLoader.php';
  49814. }
  49815. }
  49816. public static function getLoader()
  49817. {
  49818. if (null !== self::$loader) {
  49819. return self::$loader;
  49820. }
  49821. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1517412498', 'loadClassLoader'), true, true);
  49822. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  49823. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1517412498', 'loadClassLoader'));
  49824. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  49825. if ($useStaticLoader) {
  49826. require_once __DIR__ . '/autoload_static.php';
  49827. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1517412498::getInitializer($loader));
  49828. } else {
  49829. $map = require __DIR__ . '/autoload_namespaces.php';
  49830. foreach ($map as $namespace => $path) {
  49831. $loader->set($namespace, $path);
  49832. }
  49833. $map = require __DIR__ . '/autoload_psr4.php';
  49834. foreach ($map as $namespace => $path) {
  49835. $loader->setPsr4($namespace, $path);
  49836. }
  49837. $classMap = require __DIR__ . '/autoload_classmap.php';
  49838. if ($classMap) {
  49839. $loader->addClassMap($classMap);
  49840. }
  49841. }
  49842. $loader->register(true);
  49843. if ($useStaticLoader) {
  49844. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1517412498::$files;
  49845. } else {
  49846. $includeFiles = require __DIR__ . '/autoload_files.php';
  49847. }
  49848. foreach ($includeFiles as $fileIdentifier => $file) {
  49849. composerRequireComposerPhar1517412498($fileIdentifier, $file);
  49850. }
  49851. return $loader;
  49852. }
  49853. }
  49854. function composerRequireComposerPhar1517412498($fileIdentifier, $file)
  49855. {
  49856. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  49857. require $file;
  49858. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  49859. }
  49860. }
  49861. <?php
  49862. namespace Composer\Autoload;
  49863. class ComposerStaticInitComposerPhar1517412498
  49864. {
  49865. public static $files = array (
  49866. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  49867. );
  49868. public static $prefixLengthsPsr4 = array (
  49869. 'S' =>
  49870. array (
  49871. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  49872. 'Symfony\\Component\\Process\\' => 26,
  49873. 'Symfony\\Component\\Finder\\' => 25,
  49874. 'Symfony\\Component\\Filesystem\\' => 29,
  49875. 'Symfony\\Component\\Debug\\' => 24,
  49876. 'Symfony\\Component\\Console\\' => 26,
  49877. 'Seld\\PharUtils\\' => 15,
  49878. 'Seld\\JsonLint\\' => 14,
  49879. 'Seld\\CliPrompt\\' => 15,
  49880. ),
  49881. 'P' =>
  49882. array (
  49883. 'Psr\\Log\\' => 8,
  49884. ),
  49885. 'J' =>
  49886. array (
  49887. 'JsonSchema\\' => 11,
  49888. ),
  49889. 'C' =>
  49890. array (
  49891. 'Composer\\Spdx\\' => 14,
  49892. 'Composer\\Semver\\' => 16,
  49893. 'Composer\\CaBundle\\' => 18,
  49894. 'Composer\\' => 9,
  49895. ),
  49896. );
  49897. public static $prefixDirsPsr4 = array (
  49898. 'Symfony\\Polyfill\\Mbstring\\' =>
  49899. array (
  49900. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  49901. ),
  49902. 'Symfony\\Component\\Process\\' =>
  49903. array (
  49904. 0 => __DIR__ . '/..' . '/symfony/process',
  49905. ),
  49906. 'Symfony\\Component\\Finder\\' =>
  49907. array (
  49908. 0 => __DIR__ . '/..' . '/symfony/finder',
  49909. ),
  49910. 'Symfony\\Component\\Filesystem\\' =>
  49911. array (
  49912. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  49913. ),
  49914. 'Symfony\\Component\\Debug\\' =>
  49915. array (
  49916. 0 => __DIR__ . '/..' . '/symfony/debug',
  49917. ),
  49918. 'Symfony\\Component\\Console\\' =>
  49919. array (
  49920. 0 => __DIR__ . '/..' . '/symfony/console',
  49921. ),
  49922. 'Seld\\PharUtils\\' =>
  49923. array (
  49924. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  49925. ),
  49926. 'Seld\\JsonLint\\' =>
  49927. array (
  49928. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  49929. ),
  49930. 'Seld\\CliPrompt\\' =>
  49931. array (
  49932. 0 => __DIR__ . '/..' . '/seld/cli-prompt/src',
  49933. ),
  49934. 'Psr\\Log\\' =>
  49935. array (
  49936. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  49937. ),
  49938. 'JsonSchema\\' =>
  49939. array (
  49940. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  49941. ),
  49942. 'Composer\\Spdx\\' =>
  49943. array (
  49944. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  49945. ),
  49946. 'Composer\\Semver\\' =>
  49947. array (
  49948. 0 => __DIR__ . '/..' . '/composer/semver/src',
  49949. ),
  49950. 'Composer\\CaBundle\\' =>
  49951. array (
  49952. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  49953. ),
  49954. 'Composer\\' =>
  49955. array (
  49956. 0 => __DIR__ . '/../..' . '/src/Composer',
  49957. ),
  49958. );
  49959. public static function getInitializer(ClassLoader $loader)
  49960. {
  49961. return \Closure::bind(function () use ($loader) {
  49962. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1517412498::$prefixLengthsPsr4;
  49963. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1517412498::$prefixDirsPsr4;
  49964. }, null, ClassLoader::class);
  49965. }
  49966. }
  49967. <?php
  49968. namespace Composer\Autoload;
  49969. class ClassLoader
  49970. {
  49971. private $prefixLengthsPsr4 = array();
  49972. private $prefixDirsPsr4 = array();
  49973. private $fallbackDirsPsr4 = array();
  49974. private $prefixesPsr0 = array();
  49975. private $fallbackDirsPsr0 = array();
  49976. private $useIncludePath = false;
  49977. private $classMap = array();
  49978. private $classMapAuthoritative = false;
  49979. private $missingClasses = array();
  49980. private $apcuPrefix;
  49981. public function getPrefixes()
  49982. {
  49983. if (!empty($this->prefixesPsr0)) {
  49984. return call_user_func_array('array_merge', $this->prefixesPsr0);
  49985. }
  49986. return array();
  49987. }
  49988. public function getPrefixesPsr4()
  49989. {
  49990. return $this->prefixDirsPsr4;
  49991. }
  49992. public function getFallbackDirs()
  49993. {
  49994. return $this->fallbackDirsPsr0;
  49995. }
  49996. public function getFallbackDirsPsr4()
  49997. {
  49998. return $this->fallbackDirsPsr4;
  49999. }
  50000. public function getClassMap()
  50001. {
  50002. return $this->classMap;
  50003. }
  50004. public function addClassMap(array $classMap)
  50005. {
  50006. if ($this->classMap) {
  50007. $this->classMap = array_merge($this->classMap, $classMap);
  50008. } else {
  50009. $this->classMap = $classMap;
  50010. }
  50011. }
  50012. public function add($prefix, $paths, $prepend = false)
  50013. {
  50014. if (!$prefix) {
  50015. if ($prepend) {
  50016. $this->fallbackDirsPsr0 = array_merge(
  50017. (array) $paths,
  50018. $this->fallbackDirsPsr0
  50019. );
  50020. } else {
  50021. $this->fallbackDirsPsr0 = array_merge(
  50022. $this->fallbackDirsPsr0,
  50023. (array) $paths
  50024. );
  50025. }
  50026. return;
  50027. }
  50028. $first = $prefix[0];
  50029. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  50030. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  50031. return;
  50032. }
  50033. if ($prepend) {
  50034. $this->prefixesPsr0[$first][$prefix] = array_merge(
  50035. (array) $paths,
  50036. $this->prefixesPsr0[$first][$prefix]
  50037. );
  50038. } else {
  50039. $this->prefixesPsr0[$first][$prefix] = array_merge(
  50040. $this->prefixesPsr0[$first][$prefix],
  50041. (array) $paths
  50042. );
  50043. }
  50044. }
  50045. public function addPsr4($prefix, $paths, $prepend = false)
  50046. {
  50047. if (!$prefix) {
  50048. if ($prepend) {
  50049. $this->fallbackDirsPsr4 = array_merge(
  50050. (array) $paths,
  50051. $this->fallbackDirsPsr4
  50052. );
  50053. } else {
  50054. $this->fallbackDirsPsr4 = array_merge(
  50055. $this->fallbackDirsPsr4,
  50056. (array) $paths
  50057. );
  50058. }
  50059. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  50060. $length = strlen($prefix);
  50061. if ('\\' !== $prefix[$length - 1]) {
  50062. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  50063. }
  50064. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  50065. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  50066. } elseif ($prepend) {
  50067. $this->prefixDirsPsr4[$prefix] = array_merge(
  50068. (array) $paths,
  50069. $this->prefixDirsPsr4[$prefix]
  50070. );
  50071. } else {
  50072. $this->prefixDirsPsr4[$prefix] = array_merge(
  50073. $this->prefixDirsPsr4[$prefix],
  50074. (array) $paths
  50075. );
  50076. }
  50077. }
  50078. public function set($prefix, $paths)
  50079. {
  50080. if (!$prefix) {
  50081. $this->fallbackDirsPsr0 = (array) $paths;
  50082. } else {
  50083. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  50084. }
  50085. }
  50086. public function setPsr4($prefix, $paths)
  50087. {
  50088. if (!$prefix) {
  50089. $this->fallbackDirsPsr4 = (array) $paths;
  50090. } else {
  50091. $length = strlen($prefix);
  50092. if ('\\' !== $prefix[$length - 1]) {
  50093. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  50094. }
  50095. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  50096. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  50097. }
  50098. }
  50099. public function setUseIncludePath($useIncludePath)
  50100. {
  50101. $this->useIncludePath = $useIncludePath;
  50102. }
  50103. public function getUseIncludePath()
  50104. {
  50105. return $this->useIncludePath;
  50106. }
  50107. public function setClassMapAuthoritative($classMapAuthoritative)
  50108. {
  50109. $this->classMapAuthoritative = $classMapAuthoritative;
  50110. }
  50111. public function isClassMapAuthoritative()
  50112. {
  50113. return $this->classMapAuthoritative;
  50114. }
  50115. public function setApcuPrefix($apcuPrefix)
  50116. {
  50117. $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
  50118. }
  50119. public function getApcuPrefix()
  50120. {
  50121. return $this->apcuPrefix;
  50122. }
  50123. public function register($prepend = false)
  50124. {
  50125. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  50126. }
  50127. public function unregister()
  50128. {
  50129. spl_autoload_unregister(array($this, 'loadClass'));
  50130. }
  50131. public function loadClass($class)
  50132. {
  50133. if ($file = $this->findFile($class)) {
  50134. includeFile($file);
  50135. return true;
  50136. }
  50137. }
  50138. public function findFile($class)
  50139. {
  50140. if (isset($this->classMap[$class])) {
  50141. return $this->classMap[$class];
  50142. }
  50143. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  50144. return false;
  50145. }
  50146. if (null !== $this->apcuPrefix) {
  50147. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  50148. if ($hit) {
  50149. return $file;
  50150. }
  50151. }
  50152. $file = $this->findFileWithExtension($class, '.php');
  50153. if (false === $file && defined('HHVM_VERSION')) {
  50154. $file = $this->findFileWithExtension($class, '.hh');
  50155. }
  50156. if (null !== $this->apcuPrefix) {
  50157. apcu_add($this->apcuPrefix.$class, $file);
  50158. }
  50159. if (false === $file) {
  50160. $this->missingClasses[$class] = true;
  50161. }
  50162. return $file;
  50163. }
  50164. private function findFileWithExtension($class, $ext)
  50165. {
  50166. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  50167. $first = $class[0];
  50168. if (isset($this->prefixLengthsPsr4[$first])) {
  50169. $subPath = $class;
  50170. while (false !== $lastPos = strrpos($subPath, '\\')) {
  50171. $subPath = substr($subPath, 0, $lastPos);
  50172. $search = $subPath.'\\';
  50173. if (isset($this->prefixDirsPsr4[$search])) {
  50174. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  50175. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  50176. if (file_exists($file = $dir . $pathEnd)) {
  50177. return $file;
  50178. }
  50179. }
  50180. }
  50181. }
  50182. }
  50183. foreach ($this->fallbackDirsPsr4 as $dir) {
  50184. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  50185. return $file;
  50186. }
  50187. }
  50188. if (false !== $pos = strrpos($class, '\\')) {
  50189. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  50190. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  50191. } else {
  50192. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  50193. }
  50194. if (isset($this->prefixesPsr0[$first])) {
  50195. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  50196. if (0 === strpos($class, $prefix)) {
  50197. foreach ($dirs as $dir) {
  50198. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  50199. return $file;
  50200. }
  50201. }
  50202. }
  50203. }
  50204. }
  50205. foreach ($this->fallbackDirsPsr0 as $dir) {
  50206. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  50207. return $file;
  50208. }
  50209. }
  50210. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  50211. return $file;
  50212. }
  50213. return false;
  50214. }
  50215. }
  50216. function includeFile($file)
  50217. {
  50218. include $file;
  50219. }
  50220. ##
  50221. ## Bundle of CA Root Certificates
  50222. ##
  50223. ## Certificate data from Mozilla as of: Wed Sep 20 03:12:05 2017 GMT
  50224. ##
  50225. ## This is a bundle of X.509 certificates of public Certificate Authorities
  50226. ## (CA). These were automatically extracted from Mozilla's root certificates
  50227. ## file (certdata.txt). This file can be found in the mozilla source tree:
  50228. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  50229. ##
  50230. ## It contains the certificates in PEM format and therefore
  50231. ## can be directly used with curl / libcurl / php_curl, or with
  50232. ## an Apache+mod_ssl webserver for SSL client authentication.
  50233. ## Just configure this file as the SSLCACertificateFile.
  50234. ##
  50235. ## Conversion done with mk-ca-bundle.pl version 1.27.
  50236. ## SHA256: 2b2dbe5244e0047e088c597998883a913f6c5fffd1cb5c0fe5a368c8466cb2ec
  50237. ##
  50238. GlobalSign Root CA
  50239. ==================
  50240. -----BEGIN CERTIFICATE-----
  50241. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  50242. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  50243. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  50244. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  50245. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  50246. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  50247. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  50248. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  50249. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  50250. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  50251. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  50252. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  50253. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  50254. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  50255. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  50256. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  50257. -----END CERTIFICATE-----
  50258. GlobalSign Root CA - R2
  50259. =======================
  50260. -----BEGIN CERTIFICATE-----
  50261. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  50262. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  50263. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  50264. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  50265. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  50266. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  50267. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  50268. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  50269. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  50270. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  50271. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  50272. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  50273. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  50274. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  50275. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  50276. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  50277. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  50278. -----END CERTIFICATE-----
  50279. Verisign Class 3 Public Primary Certification Authority - G3
  50280. ============================================================
  50281. -----BEGIN CERTIFICATE-----
  50282. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  50283. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  50284. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  50285. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  50286. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  50287. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  50288. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  50289. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  50290. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  50291. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  50292. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  50293. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  50294. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  50295. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  50296. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  50297. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  50298. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  50299. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  50300. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  50301. -----END CERTIFICATE-----
  50302. Entrust.net Premium 2048 Secure Server CA
  50303. =========================================
  50304. -----BEGIN CERTIFICATE-----
  50305. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  50306. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  50307. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  50308. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  50309. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  50310. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  50311. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  50312. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  50313. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  50314. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  50315. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  50316. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  50317. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  50318. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  50319. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  50320. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  50321. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  50322. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  50323. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  50324. -----END CERTIFICATE-----
  50325. Baltimore CyberTrust Root
  50326. =========================
  50327. -----BEGIN CERTIFICATE-----
  50328. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  50329. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  50330. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  50331. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  50332. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  50333. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  50334. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  50335. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  50336. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  50337. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  50338. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  50339. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  50340. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  50341. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  50342. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  50343. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  50344. -----END CERTIFICATE-----
  50345. AddTrust External Root
  50346. ======================
  50347. -----BEGIN CERTIFICATE-----
  50348. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  50349. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  50350. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  50351. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  50352. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  50353. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  50354. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  50355. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  50356. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  50357. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  50358. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  50359. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  50360. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  50361. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  50362. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  50363. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  50364. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  50365. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  50366. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  50367. -----END CERTIFICATE-----
  50368. Entrust Root Certification Authority
  50369. ====================================
  50370. -----BEGIN CERTIFICATE-----
  50371. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  50372. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  50373. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  50374. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  50375. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  50376. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  50377. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  50378. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  50379. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  50380. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  50381. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  50382. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  50383. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  50384. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  50385. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  50386. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  50387. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  50388. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  50389. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  50390. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  50391. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  50392. -----END CERTIFICATE-----
  50393. GeoTrust Global CA
  50394. ==================
  50395. -----BEGIN CERTIFICATE-----
  50396. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  50397. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  50398. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  50399. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  50400. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  50401. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  50402. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  50403. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  50404. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  50405. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  50406. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  50407. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  50408. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  50409. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  50410. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  50411. Mw==
  50412. -----END CERTIFICATE-----
  50413. GeoTrust Universal CA
  50414. =====================
  50415. -----BEGIN CERTIFICATE-----
  50416. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  50417. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  50418. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  50419. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  50420. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  50421. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  50422. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  50423. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  50424. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  50425. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  50426. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  50427. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  50428. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  50429. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  50430. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  50431. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  50432. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  50433. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  50434. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  50435. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  50436. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  50437. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  50438. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  50439. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  50440. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  50441. -----END CERTIFICATE-----
  50442. GeoTrust Universal CA 2
  50443. =======================
  50444. -----BEGIN CERTIFICATE-----
  50445. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  50446. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  50447. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  50448. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  50449. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  50450. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  50451. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  50452. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  50453. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  50454. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  50455. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  50456. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  50457. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  50458. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  50459. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  50460. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  50461. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  50462. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  50463. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  50464. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  50465. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  50466. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  50467. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  50468. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  50469. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  50470. -----END CERTIFICATE-----
  50471. Visa eCommerce Root
  50472. ===================
  50473. -----BEGIN CERTIFICATE-----
  50474. MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG
  50475. EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug
  50476. QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2
  50477. WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm
  50478. VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv
  50479. bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL
  50480. F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b
  50481. RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0
  50482. TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI
  50483. /k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs
  50484. GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG
  50485. MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc
  50486. CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW
  50487. YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz
  50488. zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu
  50489. YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
  50490. 398znM/jra6O1I7mT1GvFpLgXPYHDw==
  50491. -----END CERTIFICATE-----
  50492. Certum Root CA
  50493. ==============
  50494. -----BEGIN CERTIFICATE-----
  50495. MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQK
  50496. ExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQTAeFw0wMjA2MTExMDQ2Mzla
  50497. Fw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8u
  50498. by4xEjAQBgNVBAMTCUNlcnR1bSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6x
  50499. wS7TT3zNJc4YPk/EjG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdL
  50500. kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ
  50501. 89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K
  50502. Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P
  50503. NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq
  50504. hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+
  50505. GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg
  50506. GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/
  50507. 0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS
  50508. qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw==
  50509. -----END CERTIFICATE-----
  50510. Comodo AAA Services root
  50511. ========================
  50512. -----BEGIN CERTIFICATE-----
  50513. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  50514. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  50515. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  50516. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  50517. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  50518. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  50519. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  50520. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  50521. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  50522. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  50523. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  50524. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  50525. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  50526. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  50527. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  50528. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  50529. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  50530. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  50531. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  50532. -----END CERTIFICATE-----
  50533. QuoVadis Root CA
  50534. ================
  50535. -----BEGIN CERTIFICATE-----
  50536. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  50537. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  50538. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  50539. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  50540. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  50541. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  50542. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  50543. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  50544. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  50545. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  50546. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  50547. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  50548. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  50549. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  50550. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  50551. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  50552. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  50553. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  50554. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  50555. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  50556. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  50557. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  50558. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  50559. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  50560. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  50561. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  50562. 5nrQNiOKSnQ2+Q==
  50563. -----END CERTIFICATE-----
  50564. QuoVadis Root CA 2
  50565. ==================
  50566. -----BEGIN CERTIFICATE-----
  50567. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  50568. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  50569. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  50570. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  50571. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  50572. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  50573. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  50574. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  50575. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  50576. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  50577. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  50578. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  50579. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  50580. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  50581. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  50582. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  50583. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  50584. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  50585. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  50586. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  50587. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  50588. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  50589. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  50590. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  50591. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  50592. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  50593. -----END CERTIFICATE-----
  50594. QuoVadis Root CA 3
  50595. ==================
  50596. -----BEGIN CERTIFICATE-----
  50597. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  50598. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  50599. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  50600. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  50601. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  50602. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  50603. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  50604. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  50605. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  50606. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  50607. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  50608. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  50609. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  50610. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  50611. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  50612. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  50613. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  50614. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  50615. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  50616. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  50617. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  50618. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  50619. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  50620. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  50621. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  50622. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  50623. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  50624. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  50625. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  50626. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  50627. -----END CERTIFICATE-----
  50628. Security Communication Root CA
  50629. ==============================
  50630. -----BEGIN CERTIFICATE-----
  50631. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  50632. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  50633. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  50634. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  50635. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  50636. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  50637. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  50638. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  50639. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  50640. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  50641. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  50642. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  50643. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  50644. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  50645. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  50646. FL39vmwLAw==
  50647. -----END CERTIFICATE-----
  50648. Sonera Class 2 Root CA
  50649. ======================
  50650. -----BEGIN CERTIFICATE-----
  50651. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  50652. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  50653. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  50654. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  50655. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  50656. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  50657. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  50658. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  50659. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  50660. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  50661. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  50662. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  50663. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  50664. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  50665. llpwrN9M
  50666. -----END CERTIFICATE-----
  50667. Camerfirma Chambers of Commerce Root
  50668. ====================================
  50669. -----BEGIN CERTIFICATE-----
  50670. MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
  50671. QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
  50672. ZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAx
  50673. NjEzNDNaFw0zNzA5MzAxNjEzNDRaMH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZp
  50674. cm1hIFNBIENJRiBBODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3Jn
  50675. MSIwIAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0BAQEFAAOC
  50676. AQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtbunXF/KGIJPov7coISjlU
  50677. xFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0dBmpAPrMMhe5cG3nCYsS4No41XQEMIwRH
  50678. NaqbYE6gZj3LJgqcQKH0XZi/caulAGgq7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jW
  50679. DA+wWFjbw2Y3npuRVDM30pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFV
  50680. d9oKDMyXroDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIGA1Ud
  50681. EwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5jaGFtYmVyc2lnbi5v
  50682. cmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p26EpW1eLTXYGduHRooowDgYDVR0P
  50683. AQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hh
  50684. bWJlcnNpZ24ub3JnMCcGA1UdEgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYD
  50685. VR0gBFEwTzBNBgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz
  50686. aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi
  50687. fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD
  50688. L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN
  50689. UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n
  50690. ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1
  50691. erfutGWaIZDgqtCYvDi1czyL+Nw=
  50692. -----END CERTIFICATE-----
  50693. Camerfirma Global Chambersign Root
  50694. ==================================
  50695. -----BEGIN CERTIFICATE-----
  50696. MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
  50697. QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
  50698. ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx
  50699. NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt
  50700. YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg
  50701. MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw
  50702. ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J
  50703. 1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8O
  50704. by4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpVeAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl
  50705. 6DJWk0aJqCWKZQbua795B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c
  50706. 8lCrEqWhz0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0TAQH/
  50707. BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1iZXJzaWduLm9yZy9j
  50708. aGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4wTcbOX60Qq+UDpfqpFDAOBgNVHQ8B
  50709. Af8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAHMCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBj
  50710. aGFtYmVyc2lnbi5vcmcwKgYDVR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9y
  50711. ZzBbBgNVHSAEVDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh
  50712. bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0BAQUFAAOCAQEA
  50713. PDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUMbKGKfKX0j//U2K0X1S0E0T9Y
  50714. gOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXiryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJ
  50715. PJ7oKXqJ1/6v/2j1pReQvayZzKWGVwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4
  50716. IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes
  50717. t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A==
  50718. -----END CERTIFICATE-----
  50719. XRamp Global CA Root
  50720. ====================
  50721. -----BEGIN CERTIFICATE-----
  50722. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  50723. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  50724. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  50725. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  50726. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  50727. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  50728. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  50729. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  50730. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  50731. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  50732. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  50733. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  50734. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  50735. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  50736. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  50737. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  50738. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  50739. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  50740. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  50741. -----END CERTIFICATE-----
  50742. Go Daddy Class 2 CA
  50743. ===================
  50744. -----BEGIN CERTIFICATE-----
  50745. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  50746. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  50747. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  50748. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  50749. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  50750. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  50751. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  50752. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  50753. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  50754. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  50755. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  50756. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  50757. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  50758. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  50759. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  50760. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  50761. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  50762. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  50763. vZ8=
  50764. -----END CERTIFICATE-----
  50765. Starfield Class 2 CA
  50766. ====================
  50767. -----BEGIN CERTIFICATE-----
  50768. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  50769. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  50770. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  50771. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  50772. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  50773. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  50774. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  50775. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  50776. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  50777. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  50778. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  50779. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  50780. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  50781. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  50782. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  50783. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  50784. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  50785. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  50786. QBFGmh95DmK/D5fs4C8fF5Q=
  50787. -----END CERTIFICATE-----
  50788. StartCom Certification Authority
  50789. ================================
  50790. -----BEGIN CERTIFICATE-----
  50791. MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  50792. U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
  50793. ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
  50794. NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
  50795. LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
  50796. U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
  50797. ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
  50798. o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
  50799. Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
  50800. eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
  50801. 2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
  50802. 6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
  50803. osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
  50804. untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
  50805. UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
  50806. 37uMdBNSSwIDAQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE
  50807. FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9jZXJ0LnN0YXJ0
  50808. Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3JsLnN0YXJ0Y29tLm9yZy9zZnNj
  50809. YS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFMBgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUH
  50810. AgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRw
  50811. Oi8vY2VydC5zdGFydGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYg
  50812. U3RhcnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlhYmlsaXR5
  50813. LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2YgdGhlIFN0YXJ0Q29tIENl
  50814. cnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFpbGFibGUgYXQgaHR0cDovL2NlcnQuc3Rh
  50815. cnRjb20ub3JnL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilT
  50816. dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC
  50817. AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh
  50818. 3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm
  50819. vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk
  50820. fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3
  50821. fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ
  50822. EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
  50823. yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl
  50824. 1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/
  50825. lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro
  50826. g14=
  50827. -----END CERTIFICATE-----
  50828. Taiwan GRCA
  50829. ===========
  50830. -----BEGIN CERTIFICATE-----
  50831. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  50832. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  50833. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  50834. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  50835. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  50836. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  50837. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  50838. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  50839. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  50840. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  50841. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  50842. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  50843. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  50844. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  50845. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  50846. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  50847. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  50848. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  50849. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  50850. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  50851. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  50852. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  50853. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  50854. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  50855. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  50856. -----END CERTIFICATE-----
  50857. DigiCert Assured ID Root CA
  50858. ===========================
  50859. -----BEGIN CERTIFICATE-----
  50860. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  50861. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  50862. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  50863. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  50864. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  50865. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  50866. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  50867. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  50868. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  50869. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  50870. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  50871. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  50872. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  50873. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  50874. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  50875. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  50876. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  50877. -----END CERTIFICATE-----
  50878. DigiCert Global Root CA
  50879. =======================
  50880. -----BEGIN CERTIFICATE-----
  50881. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  50882. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  50883. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  50884. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  50885. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  50886. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  50887. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  50888. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  50889. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  50890. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  50891. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  50892. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  50893. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  50894. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  50895. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  50896. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  50897. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  50898. -----END CERTIFICATE-----
  50899. DigiCert High Assurance EV Root CA
  50900. ==================================
  50901. -----BEGIN CERTIFICATE-----
  50902. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  50903. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  50904. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  50905. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  50906. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  50907. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  50908. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  50909. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  50910. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  50911. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  50912. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  50913. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  50914. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  50915. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  50916. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  50917. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  50918. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  50919. -----END CERTIFICATE-----
  50920. Certplus Class 2 Primary CA
  50921. ===========================
  50922. -----BEGIN CERTIFICATE-----
  50923. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  50924. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  50925. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  50926. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  50927. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  50928. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  50929. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  50930. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  50931. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  50932. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  50933. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  50934. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  50935. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  50936. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  50937. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  50938. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  50939. l7+ijrRU
  50940. -----END CERTIFICATE-----
  50941. DST Root CA X3
  50942. ==============
  50943. -----BEGIN CERTIFICATE-----
  50944. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  50945. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  50946. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  50947. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  50948. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  50949. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  50950. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  50951. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  50952. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  50953. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  50954. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  50955. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  50956. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  50957. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  50958. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  50959. -----END CERTIFICATE-----
  50960. DST ACES CA X6
  50961. ==============
  50962. -----BEGIN CERTIFICATE-----
  50963. MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQG
  50964. EwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QxETAPBgNVBAsTCERTVCBBQ0VT
  50965. MRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0wMzExMjAyMTE5NThaFw0xNzExMjAyMTE5NTha
  50966. MFsxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UE
  50967. CxMIRFNUIEFDRVMxFzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOC
  50968. AQ8AMIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPuktKe1jzI
  50969. DZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7gLFViYsx+tC3dr5BPTCa
  50970. pCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZHfAjIgrrep4c9oW24MFbCswKBXy314pow
  50971. GCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4aahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPy
  50972. MjwmR/onJALJfh1biEITajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1Ud
  50973. EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rkc3Qu
  50974. Y29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjtodHRwOi8vd3d3LnRy
  50975. dXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMtaW5kZXguaHRtbDAdBgNVHQ4EFgQU
  50976. CXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZIhvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V2
  50977. 5FYrnJmQ6AgwbN99Pe7lv7UkQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t
  50978. Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq
  50979. nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs
  50980. vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3
  50981. oKfN5XozNmr6mis=
  50982. -----END CERTIFICATE-----
  50983. SwissSign Gold CA - G2
  50984. ======================
  50985. -----BEGIN CERTIFICATE-----
  50986. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  50987. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  50988. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  50989. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  50990. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  50991. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  50992. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  50993. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  50994. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  50995. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  50996. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  50997. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  50998. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  50999. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  51000. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  51001. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  51002. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  51003. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  51004. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  51005. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  51006. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  51007. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  51008. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  51009. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  51010. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  51011. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  51012. -----END CERTIFICATE-----
  51013. SwissSign Silver CA - G2
  51014. ========================
  51015. -----BEGIN CERTIFICATE-----
  51016. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  51017. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  51018. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  51019. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  51020. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  51021. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  51022. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  51023. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  51024. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  51025. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  51026. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  51027. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  51028. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  51029. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  51030. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  51031. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  51032. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  51033. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  51034. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  51035. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  51036. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  51037. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  51038. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  51039. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  51040. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  51041. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  51042. -----END CERTIFICATE-----
  51043. GeoTrust Primary Certification Authority
  51044. ========================================
  51045. -----BEGIN CERTIFICATE-----
  51046. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  51047. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  51048. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  51049. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  51050. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  51051. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  51052. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  51053. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  51054. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  51055. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  51056. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  51057. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  51058. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  51059. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  51060. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  51061. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  51062. -----END CERTIFICATE-----
  51063. thawte Primary Root CA
  51064. ======================
  51065. -----BEGIN CERTIFICATE-----
  51066. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  51067. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  51068. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  51069. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  51070. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  51071. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  51072. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  51073. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  51074. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  51075. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  51076. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  51077. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  51078. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  51079. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  51080. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  51081. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  51082. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  51083. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  51084. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  51085. -----END CERTIFICATE-----
  51086. VeriSign Class 3 Public Primary Certification Authority - G5
  51087. ============================================================
  51088. -----BEGIN CERTIFICATE-----
  51089. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  51090. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  51091. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  51092. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  51093. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  51094. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  51095. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  51096. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  51097. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  51098. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  51099. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  51100. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  51101. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  51102. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  51103. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  51104. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  51105. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  51106. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  51107. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  51108. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  51109. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  51110. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  51111. -----END CERTIFICATE-----
  51112. SecureTrust CA
  51113. ==============
  51114. -----BEGIN CERTIFICATE-----
  51115. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  51116. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  51117. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  51118. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  51119. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  51120. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  51121. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  51122. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  51123. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  51124. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  51125. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  51126. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  51127. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  51128. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  51129. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  51130. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  51131. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  51132. -----END CERTIFICATE-----
  51133. Secure Global CA
  51134. ================
  51135. -----BEGIN CERTIFICATE-----
  51136. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  51137. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  51138. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  51139. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  51140. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  51141. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  51142. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  51143. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  51144. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  51145. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  51146. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  51147. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  51148. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  51149. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  51150. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  51151. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  51152. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  51153. -----END CERTIFICATE-----
  51154. COMODO Certification Authority
  51155. ==============================
  51156. -----BEGIN CERTIFICATE-----
  51157. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  51158. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  51159. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  51160. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  51161. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  51162. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  51163. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  51164. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  51165. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  51166. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  51167. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  51168. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  51169. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  51170. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  51171. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  51172. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  51173. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  51174. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  51175. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  51176. -----END CERTIFICATE-----
  51177. Network Solutions Certificate Authority
  51178. =======================================
  51179. -----BEGIN CERTIFICATE-----
  51180. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  51181. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  51182. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  51183. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  51184. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  51185. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  51186. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  51187. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  51188. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  51189. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  51190. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  51191. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  51192. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  51193. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  51194. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  51195. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  51196. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  51197. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  51198. -----END CERTIFICATE-----
  51199. COMODO ECC Certification Authority
  51200. ==================================
  51201. -----BEGIN CERTIFICATE-----
  51202. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  51203. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  51204. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  51205. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  51206. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  51207. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  51208. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  51209. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  51210. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  51211. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  51212. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  51213. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  51214. -----END CERTIFICATE-----
  51215. Security Communication EV RootCA1
  51216. =================================
  51217. -----BEGIN CERTIFICATE-----
  51218. MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  51219. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh
  51220. dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE
  51221. BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl
  51222. Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  51223. AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO
  51224. /VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX
  51225. WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z
  51226. ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4
  51227. bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK
  51228. 9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
  51229. SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm
  51230. iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG
  51231. Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW
  51232. mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW
  51233. T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490
  51234. -----END CERTIFICATE-----
  51235. OISTE WISeKey Global Root GA CA
  51236. ===============================
  51237. -----BEGIN CERTIFICATE-----
  51238. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  51239. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  51240. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  51241. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  51242. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  51243. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  51244. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  51245. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  51246. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  51247. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  51248. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  51249. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  51250. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  51251. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  51252. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  51253. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  51254. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  51255. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  51256. -----END CERTIFICATE-----
  51257. Certigna
  51258. ========
  51259. -----BEGIN CERTIFICATE-----
  51260. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  51261. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  51262. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  51263. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  51264. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  51265. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  51266. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  51267. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  51268. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  51269. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  51270. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  51271. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  51272. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  51273. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  51274. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  51275. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  51276. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  51277. -----END CERTIFICATE-----
  51278. Deutsche Telekom Root CA 2
  51279. ==========================
  51280. -----BEGIN CERTIFICATE-----
  51281. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  51282. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  51283. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  51284. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  51285. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  51286. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  51287. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  51288. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  51289. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  51290. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  51291. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  51292. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  51293. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  51294. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  51295. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  51296. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  51297. Cm26OWMohpLzGITY+9HPBVZkVw==
  51298. -----END CERTIFICATE-----
  51299. Cybertrust Global Root
  51300. ======================
  51301. -----BEGIN CERTIFICATE-----
  51302. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  51303. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  51304. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  51305. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  51306. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  51307. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  51308. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  51309. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  51310. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  51311. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  51312. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  51313. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  51314. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  51315. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  51316. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  51317. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  51318. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  51319. -----END CERTIFICATE-----
  51320. ePKI Root Certification Authority
  51321. =================================
  51322. -----BEGIN CERTIFICATE-----
  51323. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  51324. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  51325. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  51326. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  51327. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  51328. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  51329. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  51330. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  51331. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  51332. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  51333. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  51334. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  51335. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  51336. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  51337. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  51338. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  51339. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  51340. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  51341. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  51342. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  51343. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  51344. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  51345. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  51346. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  51347. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  51348. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  51349. -----END CERTIFICATE-----
  51350. T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3
  51351. =============================================================================================================================
  51352. -----BEGIN CERTIFICATE-----
  51353. MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRSMRgwFgYDVQQH
  51354. DA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJpbGltc2VsIHZlIFRla25vbG9q
  51355. aWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSwVEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ry
  51356. b25payB2ZSBLcmlwdG9sb2ppIEFyYcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNV
  51357. BAsMGkthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUg
  51358. S8O2ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAeFw0wNzA4
  51359. MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIxGDAWBgNVBAcMD0dlYnpl
  51360. IC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmlsaW1zZWwgdmUgVGVrbm9sb2ppayBBcmHF
  51361. n3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBUQUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZl
  51362. IEtyaXB0b2xvamkgQXJhxZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2Ft
  51363. dSBTZXJ0aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7ZrIFNl
  51364. cnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIBIjANBgkqhkiG9w0B
  51365. AQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4hgb46ezzb8R1Sf1n68yJMlaCQvEhO
  51366. Eav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yKO7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1
  51367. xnnRFDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR
  51368. 6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL
  51369. hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd
  51370. BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  51371. MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4
  51372. N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT
  51373. y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh
  51374. LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M
  51375. dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI=
  51376. -----END CERTIFICATE-----
  51377. certSIGN ROOT CA
  51378. ================
  51379. -----BEGIN CERTIFICATE-----
  51380. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  51381. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  51382. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  51383. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  51384. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  51385. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  51386. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  51387. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  51388. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  51389. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  51390. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  51391. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  51392. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  51393. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  51394. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  51395. -----END CERTIFICATE-----
  51396. GeoTrust Primary Certification Authority - G3
  51397. =============================================
  51398. -----BEGIN CERTIFICATE-----
  51399. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  51400. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  51401. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  51402. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  51403. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  51404. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  51405. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  51406. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  51407. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  51408. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  51409. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  51410. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  51411. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  51412. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  51413. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  51414. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  51415. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  51416. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  51417. -----END CERTIFICATE-----
  51418. thawte Primary Root CA - G2
  51419. ===========================
  51420. -----BEGIN CERTIFICATE-----
  51421. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  51422. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  51423. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  51424. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  51425. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  51426. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  51427. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  51428. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  51429. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  51430. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  51431. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  51432. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  51433. -----END CERTIFICATE-----
  51434. thawte Primary Root CA - G3
  51435. ===========================
  51436. -----BEGIN CERTIFICATE-----
  51437. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  51438. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  51439. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  51440. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  51441. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  51442. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  51443. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  51444. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  51445. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  51446. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  51447. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  51448. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  51449. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  51450. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  51451. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  51452. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  51453. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  51454. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  51455. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  51456. -----END CERTIFICATE-----
  51457. GeoTrust Primary Certification Authority - G2
  51458. =============================================
  51459. -----BEGIN CERTIFICATE-----
  51460. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  51461. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  51462. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  51463. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  51464. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  51465. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  51466. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  51467. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  51468. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  51469. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  51470. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  51471. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  51472. npaqBA+K
  51473. -----END CERTIFICATE-----
  51474. VeriSign Universal Root Certification Authority
  51475. ===============================================
  51476. -----BEGIN CERTIFICATE-----
  51477. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  51478. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  51479. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  51480. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  51481. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  51482. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  51483. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  51484. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  51485. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  51486. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  51487. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  51488. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  51489. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  51490. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  51491. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  51492. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  51493. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  51494. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  51495. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  51496. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  51497. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  51498. mJO37M2CYfE45k+XmCpajQ==
  51499. -----END CERTIFICATE-----
  51500. VeriSign Class 3 Public Primary Certification Authority - G4
  51501. ============================================================
  51502. -----BEGIN CERTIFICATE-----
  51503. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  51504. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  51505. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  51506. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  51507. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  51508. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  51509. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  51510. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  51511. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  51512. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  51513. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  51514. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  51515. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  51516. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  51517. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  51518. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  51519. -----END CERTIFICATE-----
  51520. NetLock Arany (Class Gold) Főtanúsítvány
  51521. ========================================
  51522. -----BEGIN CERTIFICATE-----
  51523. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  51524. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  51525. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  51526. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  51527. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  51528. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  51529. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  51530. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  51531. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  51532. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  51533. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  51534. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  51535. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  51536. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  51537. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  51538. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  51539. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  51540. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  51541. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  51542. -----END CERTIFICATE-----
  51543. Staat der Nederlanden Root CA - G2
  51544. ==================================
  51545. -----BEGIN CERTIFICATE-----
  51546. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  51547. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  51548. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  51549. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  51550. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  51551. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  51552. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  51553. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  51554. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  51555. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  51556. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  51557. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  51558. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  51559. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  51560. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  51561. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  51562. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  51563. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  51564. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  51565. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  51566. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  51567. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  51568. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  51569. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  51570. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  51571. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  51572. 66+KAQ==
  51573. -----END CERTIFICATE-----
  51574. Hongkong Post Root CA 1
  51575. =======================
  51576. -----BEGIN CERTIFICATE-----
  51577. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  51578. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  51579. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  51580. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  51581. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  51582. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  51583. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  51584. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  51585. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  51586. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  51587. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  51588. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  51589. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  51590. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  51591. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  51592. -----END CERTIFICATE-----
  51593. SecureSign RootCA11
  51594. ===================
  51595. -----BEGIN CERTIFICATE-----
  51596. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  51597. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  51598. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  51599. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  51600. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  51601. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  51602. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  51603. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  51604. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  51605. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  51606. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  51607. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  51608. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  51609. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  51610. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  51611. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  51612. -----END CERTIFICATE-----
  51613. ACEDICOM Root
  51614. =============
  51615. -----BEGIN CERTIFICATE-----
  51616. MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UEAwwNQUNFRElD
  51617. T00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMB4XDTA4
  51618. MDQxODE2MjQyMloXDTI4MDQxMzE2MjQyMlowRDEWMBQGA1UEAwwNQUNFRElDT00gUm9vdDEMMAoG
  51619. A1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMIICIjANBgkqhkiG9w0BAQEF
  51620. AAOCAg8AMIICCgKCAgEA/5KV4WgGdrQsyFhIyv2AVClVYyT/kGWbEHV7w2rbYgIB8hiGtXxaOLHk
  51621. WLn709gtn70yN78sFW2+tfQh0hOR2QetAQXW8713zl9CgQr5auODAKgrLlUTY4HKRxx7XBZXehuD
  51622. YAQ6PmXDzQHe3qTWDLqO3tkE7hdWIpuPY/1NFgu3e3eM+SW10W2ZEi5PGrjm6gSSrj0RuVFCPYew
  51623. MYWveVqc/udOXpJPQ/yrOq2lEiZmueIM15jO1FillUAKt0SdE3QrwqXrIhWYENiLxQSfHY9g5QYb
  51624. m8+5eaA9oiM/Qj9r+hwDezCNzmzAv+YbX79nuIQZ1RXve8uQNjFiybwCq0Zfm/4aaJQ0PZCOrfbk
  51625. HQl/Sog4P75n/TSW9R28MHTLOO7VbKvU/PQAtwBbhTIWdjPp2KOZnQUAqhbm84F9b32qhm2tFXTT
  51626. xKJxqvQUfecyuB+81fFOvW8XAjnXDpVCOscAPukmYxHqC9FK/xidstd7LzrZlvvoHpKuE1XI2Sf2
  51627. 3EgbsCTBheN3nZqk8wwRHQ3ItBTutYJXCb8gWH8vIiPYcMt5bMlL8qkqyPyHK9caUPgn6C9D4zq9
  51628. 2Fdx/c6mUlv53U3t5fZvie27k5x2IXXwkkwp9y+cAS7+UEaeZAwUswdbxcJzbPEHXEUkFDWug/Fq
  51629. TYl6+rPYLWbwNof1K1MCAwEAAaOBqjCBpzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKaz
  51630. 4SsrSbbXc6GqlPUB53NlTKxQMA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUprPhKytJttdzoaqU
  51631. 9QHnc2VMrFAwRAYDVR0gBD0wOzA5BgRVHSAAMDEwLwYIKwYBBQUHAgEWI2h0dHA6Ly9hY2VkaWNv
  51632. bS5lZGljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWImfQwng4/F9tqg
  51633. aHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3gvoFNTPhNahXwOf9jU8/kzJP
  51634. eGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKeI6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1Pwk
  51635. zQSulgUV1qzOMPPKC8W64iLgpq0i5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1
  51636. ThCojz2GuHURwCRiipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oI
  51637. KiMnMCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZo5NjEFIq
  51638. nxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6zqylfDJKZ0DcMDQj3dcE
  51639. I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp
  51640. MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o
  51641. tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==
  51642. -----END CERTIFICATE-----
  51643. Microsec e-Szigno Root CA 2009
  51644. ==============================
  51645. -----BEGIN CERTIFICATE-----
  51646. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  51647. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  51648. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  51649. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  51650. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  51651. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  51652. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  51653. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  51654. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  51655. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  51656. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  51657. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  51658. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  51659. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  51660. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  51661. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  51662. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  51663. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  51664. LXpUq3DDfSJlgnCW
  51665. -----END CERTIFICATE-----
  51666. GlobalSign Root CA - R3
  51667. =======================
  51668. -----BEGIN CERTIFICATE-----
  51669. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  51670. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  51671. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  51672. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  51673. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  51674. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  51675. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  51676. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  51677. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  51678. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  51679. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  51680. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  51681. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  51682. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  51683. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  51684. kpeDMdmztcpHWD9f
  51685. -----END CERTIFICATE-----
  51686. Autoridad de Certificacion Firmaprofesional CIF A62634068
  51687. =========================================================
  51688. -----BEGIN CERTIFICATE-----
  51689. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  51690. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  51691. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  51692. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  51693. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  51694. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  51695. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  51696. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  51697. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  51698. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  51699. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  51700. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  51701. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  51702. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  51703. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  51704. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  51705. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  51706. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  51707. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  51708. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  51709. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  51710. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  51711. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  51712. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  51713. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  51714. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  51715. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  51716. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  51717. -----END CERTIFICATE-----
  51718. Izenpe.com
  51719. ==========
  51720. -----BEGIN CERTIFICATE-----
  51721. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  51722. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  51723. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  51724. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  51725. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  51726. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  51727. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  51728. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  51729. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  51730. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  51731. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  51732. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  51733. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  51734. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  51735. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  51736. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  51737. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  51738. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  51739. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  51740. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  51741. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  51742. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  51743. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  51744. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  51745. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  51746. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  51747. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  51748. -----END CERTIFICATE-----
  51749. Chambers of Commerce Root - 2008
  51750. ================================
  51751. -----BEGIN CERTIFICATE-----
  51752. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  51753. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  51754. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  51755. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  51756. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  51757. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  51758. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  51759. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  51760. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  51761. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  51762. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  51763. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  51764. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  51765. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  51766. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  51767. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  51768. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  51769. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  51770. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  51771. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  51772. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  51773. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  51774. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  51775. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  51776. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  51777. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  51778. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  51779. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  51780. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  51781. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  51782. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  51783. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  51784. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  51785. -----END CERTIFICATE-----
  51786. Global Chambersign Root - 2008
  51787. ==============================
  51788. -----BEGIN CERTIFICATE-----
  51789. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  51790. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  51791. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  51792. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  51793. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  51794. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  51795. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  51796. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  51797. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  51798. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  51799. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  51800. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  51801. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  51802. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  51803. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  51804. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  51805. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  51806. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  51807. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  51808. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  51809. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  51810. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  51811. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  51812. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  51813. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  51814. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  51815. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  51816. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  51817. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  51818. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  51819. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  51820. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  51821. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  51822. -----END CERTIFICATE-----
  51823. Go Daddy Root Certificate Authority - G2
  51824. ========================================
  51825. -----BEGIN CERTIFICATE-----
  51826. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  51827. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  51828. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  51829. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  51830. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  51831. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  51832. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  51833. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  51834. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  51835. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  51836. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  51837. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  51838. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  51839. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  51840. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  51841. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  51842. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  51843. -----END CERTIFICATE-----
  51844. Starfield Root Certificate Authority - G2
  51845. =========================================
  51846. -----BEGIN CERTIFICATE-----
  51847. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  51848. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  51849. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  51850. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  51851. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  51852. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  51853. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  51854. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  51855. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  51856. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  51857. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  51858. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  51859. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  51860. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  51861. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  51862. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  51863. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  51864. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  51865. -----END CERTIFICATE-----
  51866. Starfield Services Root Certificate Authority - G2
  51867. ==================================================
  51868. -----BEGIN CERTIFICATE-----
  51869. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  51870. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  51871. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  51872. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  51873. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  51874. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  51875. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  51876. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  51877. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  51878. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  51879. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  51880. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  51881. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  51882. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  51883. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  51884. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  51885. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  51886. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  51887. -----END CERTIFICATE-----
  51888. AffirmTrust Commercial
  51889. ======================
  51890. -----BEGIN CERTIFICATE-----
  51891. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  51892. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  51893. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  51894. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  51895. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  51896. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  51897. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  51898. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  51899. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  51900. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  51901. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  51902. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  51903. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  51904. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  51905. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  51906. -----END CERTIFICATE-----
  51907. AffirmTrust Networking
  51908. ======================
  51909. -----BEGIN CERTIFICATE-----
  51910. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  51911. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  51912. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  51913. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  51914. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  51915. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  51916. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  51917. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  51918. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  51919. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  51920. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  51921. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  51922. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  51923. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  51924. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  51925. -----END CERTIFICATE-----
  51926. AffirmTrust Premium
  51927. ===================
  51928. -----BEGIN CERTIFICATE-----
  51929. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  51930. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  51931. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  51932. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  51933. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  51934. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  51935. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  51936. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  51937. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  51938. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  51939. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  51940. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  51941. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  51942. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  51943. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  51944. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  51945. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  51946. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  51947. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  51948. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  51949. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  51950. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  51951. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  51952. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  51953. -----END CERTIFICATE-----
  51954. AffirmTrust Premium ECC
  51955. =======================
  51956. -----BEGIN CERTIFICATE-----
  51957. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  51958. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  51959. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  51960. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  51961. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  51962. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  51963. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  51964. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  51965. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  51966. eQ==
  51967. -----END CERTIFICATE-----
  51968. Certum Trusted Network CA
  51969. =========================
  51970. -----BEGIN CERTIFICATE-----
  51971. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  51972. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  51973. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  51974. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  51975. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  51976. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  51977. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  51978. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  51979. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  51980. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  51981. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  51982. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  51983. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  51984. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  51985. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  51986. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  51987. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  51988. -----END CERTIFICATE-----
  51989. Certinomis - Autorité Racine
  51990. ============================
  51991. -----BEGIN CERTIFICATE-----
  51992. MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  51993. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg
  51994. LSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkG
  51995. A1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYw
  51996. JAYDVQQDDB1DZXJ0aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQAD
  51997. ggIPADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jYF1AMnmHa
  51998. wE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N8y4oH3DfVS9O7cdxbwly
  51999. Lu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWerP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw
  52000. 2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92N
  52001. jMD2AR5vpTESOH2VwnHu7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9q
  52002. c1pkIuVC28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6lSTC
  52003. lrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1Enn1So2+WLhl+HPNb
  52004. xxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB0iSVL1N6aaLwD4ZFjliCK0wi1F6g
  52005. 530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql095gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna
  52006. 4NH4+ej9Uji29YnfAgMBAAGjWzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
  52007. A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ
  52008. KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x
  52009. WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva
  52010. R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40
  52011. nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B
  52012. CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv
  52013. JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE
  52014. qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b
  52015. WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE
  52016. wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/
  52017. vgt2Fl43N+bYdJeimUV5
  52018. -----END CERTIFICATE-----
  52019. TWCA Root Certification Authority
  52020. =================================
  52021. -----BEGIN CERTIFICATE-----
  52022. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  52023. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  52024. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  52025. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  52026. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  52027. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  52028. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  52029. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  52030. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  52031. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  52032. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  52033. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  52034. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  52035. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  52036. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  52037. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  52038. -----END CERTIFICATE-----
  52039. Security Communication RootCA2
  52040. ==============================
  52041. -----BEGIN CERTIFICATE-----
  52042. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  52043. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  52044. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  52045. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  52046. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  52047. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  52048. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  52049. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  52050. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  52051. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  52052. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  52053. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  52054. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  52055. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  52056. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  52057. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  52058. -----END CERTIFICATE-----
  52059. EC-ACC
  52060. ======
  52061. -----BEGIN CERTIFICATE-----
  52062. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  52063. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  52064. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  52065. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  52066. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  52067. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  52068. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  52069. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  52070. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  52071. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  52072. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  52073. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  52074. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  52075. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  52076. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  52077. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  52078. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  52079. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  52080. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  52081. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  52082. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  52083. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  52084. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  52085. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  52086. 5EI=
  52087. -----END CERTIFICATE-----
  52088. Hellenic Academic and Research Institutions RootCA 2011
  52089. =======================================================
  52090. -----BEGIN CERTIFICATE-----
  52091. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  52092. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  52093. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  52094. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  52095. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  52096. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  52097. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  52098. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  52099. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  52100. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  52101. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  52102. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  52103. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  52104. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  52105. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  52106. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  52107. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  52108. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  52109. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  52110. -----END CERTIFICATE-----
  52111. Actalis Authentication Root CA
  52112. ==============================
  52113. -----BEGIN CERTIFICATE-----
  52114. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  52115. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  52116. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  52117. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  52118. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  52119. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  52120. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  52121. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  52122. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  52123. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  52124. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  52125. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  52126. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  52127. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  52128. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  52129. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  52130. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  52131. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  52132. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  52133. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  52134. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  52135. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  52136. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  52137. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  52138. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  52139. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  52140. -----END CERTIFICATE-----
  52141. Trustis FPS Root CA
  52142. ===================
  52143. -----BEGIN CERTIFICATE-----
  52144. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  52145. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  52146. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  52147. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  52148. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  52149. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  52150. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  52151. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  52152. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  52153. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  52154. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  52155. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  52156. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  52157. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  52158. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  52159. iB6XzCGcKQENZetX2fNXlrtIzYE=
  52160. -----END CERTIFICATE-----
  52161. StartCom Certification Authority
  52162. ================================
  52163. -----BEGIN CERTIFICATE-----
  52164. MIIHhzCCBW+gAwIBAgIBLTANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  52165. U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
  52166. ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
  52167. NjM3WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
  52168. LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
  52169. U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
  52170. ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
  52171. o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
  52172. Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
  52173. eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
  52174. 2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
  52175. 6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
  52176. osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
  52177. untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
  52178. UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
  52179. 37uMdBNSSwIDAQABo4ICEDCCAgwwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD
  52180. VR0OBBYEFE4L7xqkQFulF2mHMMo0aEPQQa7yMB8GA1UdIwQYMBaAFE4L7xqkQFulF2mHMMo0aEPQ
  52181. Qa7yMIIBWgYDVR0gBIIBUTCCAU0wggFJBgsrBgEEAYG1NwEBATCCATgwLgYIKwYBBQUHAgEWImh0
  52182. dHA6Ly93d3cuc3RhcnRzc2wuY29tL3BvbGljeS5wZGYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cu
  52183. c3RhcnRzc2wuY29tL2ludGVybWVkaWF0ZS5wZGYwgc8GCCsGAQUFBwICMIHCMCcWIFN0YXJ0IENv
  52184. bW1lcmNpYWwgKFN0YXJ0Q29tKSBMdGQuMAMCAQEagZZMaW1pdGVkIExpYWJpbGl0eSwgcmVhZCB0
  52185. aGUgc2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBTdGFydENvbSBDZXJ0aWZpY2F0
  52186. aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6Ly93d3cuc3RhcnRzc2wuY29t
  52187. L3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBG
  52188. cmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQsFAAOCAgEAjo/n3JR5
  52189. fPGFf59Jb2vKXfuM/gTFwWLRfUKKvFO3lANmMD+x5wqnUCBVJX92ehQN6wQOQOY+2IirByeDqXWm
  52190. N3PH/UvSTa0XQMhGvjt/UfzDtgUx3M2FIk5xt/JxXrAaxrqTi3iSSoX4eA+D/i+tLPfkpLst0OcN
  52191. Org+zvZ49q5HJMqjNTbOx8aHmNrs++myziebiMMEofYLWWivydsQD032ZGNcpRJvkrKTlMeIFw6T
  52192. tn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKlCcWw0bdT82AUuoVpaiF8H3VhFyAX
  52193. e2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVFP0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA
  52194. 2MFrLH9ZXF2RsXAiV+uKa0hK1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBs
  52195. HvUwyKMQ5bLmKhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE
  52196. JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ8dCAWZvLMdib
  52197. D4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnmfyWl8kgAwKQB2j8=
  52198. -----END CERTIFICATE-----
  52199. StartCom Certification Authority G2
  52200. ===================================
  52201. -----BEGIN CERTIFICATE-----
  52202. MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
  52203. U3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg
  52204. RzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UE
  52205. ChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  52206. dHkgRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8O
  52207. o1XJJZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsDvfOpL9HG
  52208. 4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnooD/Uefyf3lLE3PbfHkffi
  52209. Aez9lInhzG7TNtYKGXmu1zSCZf98Qru23QumNK9LYP5/Q0kGi4xDuFby2X8hQxfqp0iVAXV16iul
  52210. Q5XqFYSdCI0mblWbq9zSOdIxHWDirMxWRST1HFSr7obdljKF+ExP6JV2tgXdNiNnvP8V4so75qbs
  52211. O+wmETRIjfaAKxojAuuKHDp2KntWFhxyKrOq42ClAJ8Em+JvHhRYW6Vsi1g8w7pOOlz34ZYrPu8H
  52212. vKTlXcxNnw3h3Kq74W4a7I/htkxNeXJdFzULHdfBR9qWJODQcqhaX2YtENwvKhOuJv4KHBnM0D4L
  52213. nMgJLvlblnpHnOl68wVQdJVznjAJ85eCXuaPOQgeWeU1FEIT/wCc976qUM/iUUjXuG+v+E5+M5iS
  52214. FGI6dWPPe/regjupuznixL0sAA7IF6wT700ljtizkC+p2il9Ha90OrInwMEePnWjFqmveiJdnxMa
  52215. z6eg6+OGCtP95paV1yPIN93EfKo2rJgaErHgTuixO/XWb/Ew1wIDAQABo0IwQDAPBgNVHRMBAf8E
  52216. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUS8W0QGutHLOlHGVuRjaJhwUMDrYwDQYJ
  52217. KoZIhvcNAQELBQADggIBAHNXPyzVlTJ+N9uWkusZXn5T50HsEbZH77Xe7XRcxfGOSeD8bpkTzZ+K
  52218. 2s06Ctg6Wgk/XzTQLwPSZh0avZyQN8gMjgdalEVGKua+etqhqaRpEpKwfTbURIfXUfEpY9Z1zRbk
  52219. J4kd+MIySP3bmdCPX1R0zKxnNBFi2QwKN4fRoxdIjtIXHfbX/dtl6/2o1PXWT6RbdejF0mCy2wl+
  52220. JYt7ulKSnj7oxXehPOBKc2thz4bcQ///If4jXSRK9dNtD2IEBVeC2m6kMyV5Sy5UGYvMLD0w6dEG
  52221. /+gyRr61M3Z3qAFdlsHB1b6uJcDJHgoJIIihDsnzb02CVAAgp9KP5DlUFy6NHrgbuxu9mk47EDTc
  52222. nIhT76IxW1hPkWLIwpqazRVdOKnWvvgTtZ8SafJQYqz7Fzf07rh1Z2AQ+4NQ+US1dZxAF7L+/Xld
  52223. blhYXzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5lIxKVCCIc
  52224. l85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoohdVddLHRDiBYmxOlsGOm
  52225. 7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulrso8uBtjRkcfGEvRM/TAXw8HaOFvjqerm
  52226. obp573PYtlNXLfbQ4ddI
  52227. -----END CERTIFICATE-----
  52228. Buypass Class 2 Root CA
  52229. =======================
  52230. -----BEGIN CERTIFICATE-----
  52231. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  52232. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  52233. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  52234. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  52235. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  52236. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  52237. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  52238. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  52239. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  52240. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  52241. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  52242. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  52243. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  52244. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  52245. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  52246. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  52247. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  52248. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  52249. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  52250. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  52251. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  52252. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  52253. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  52254. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  52255. rJgWVqA=
  52256. -----END CERTIFICATE-----
  52257. Buypass Class 3 Root CA
  52258. =======================
  52259. -----BEGIN CERTIFICATE-----
  52260. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  52261. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  52262. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  52263. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  52264. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  52265. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  52266. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  52267. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  52268. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  52269. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  52270. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  52271. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  52272. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  52273. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  52274. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  52275. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  52276. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  52277. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  52278. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  52279. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  52280. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  52281. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  52282. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  52283. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  52284. Cp/HuZc=
  52285. -----END CERTIFICATE-----
  52286. T-TeleSec GlobalRoot Class 3
  52287. ============================
  52288. -----BEGIN CERTIFICATE-----
  52289. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  52290. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  52291. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  52292. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  52293. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  52294. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  52295. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  52296. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  52297. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  52298. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  52299. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  52300. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  52301. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  52302. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  52303. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  52304. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  52305. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  52306. -----END CERTIFICATE-----
  52307. EE Certification Centre Root CA
  52308. ===============================
  52309. -----BEGIN CERTIFICATE-----
  52310. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  52311. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  52312. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  52313. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  52314. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  52315. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  52316. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  52317. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  52318. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  52319. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  52320. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  52321. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  52322. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  52323. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  52324. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  52325. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  52326. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  52327. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  52328. dcGWxZ0=
  52329. -----END CERTIFICATE-----
  52330. TURKTRUST Certificate Services Provider Root 2007
  52331. =================================================
  52332. -----BEGIN CERTIFICATE-----
  52333. MIIEPTCCAyWgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvzE/MD0GA1UEAww2VMOcUktUUlVTVCBF
  52334. bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP
  52335. MA0GA1UEBwwGQW5rYXJhMV4wXAYDVQQKDFVUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg
  52336. QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgQXJhbMSxayAyMDA3MB4X
  52337. DTA3MTIyNTE4MzcxOVoXDTE3MTIyMjE4MzcxOVowgb8xPzA9BgNVBAMMNlTDnFJLVFJVU1QgRWxl
  52338. a3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTELMAkGA1UEBhMCVFIxDzAN
  52339. BgNVBAcMBkFua2FyYTFeMFwGA1UECgxVVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  52340. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4gKGMpIEFyYWzEsWsgMjAwNzCCASIw
  52341. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKu3PgqMyKVYFeaK7yc9SrToJdPNM8Ig3BnuiD9N
  52342. YvDdE3ePYakqtdTyuTFYKTsvP2qcb3N2Je40IIDu6rfwxArNK4aUyeNgsURSsloptJGXg9i3phQv
  52343. KUmi8wUG+7RP2qFsmmaf8EMJyupyj+sA1zU511YXRxcw9L6/P8JorzZAwan0qafoEGsIiveGHtya
  52344. KhUG9qPw9ODHFNRRf8+0222vR5YXm3dx2KdxnSQM9pQ/hTEST7ruToK4uT6PIzdezKKqdfcYbwnT
  52345. rqdUKDT74eA7YH2gvnmJhsifLfkKS8RQouf9eRbHegsYz85M733WB2+Y8a+xwXrXgTW4qhe04MsC
  52346. AwEAAaNCMEAwHQYDVR0OBBYEFCnFkKslrxHkYb+j/4hhkeYO/pyBMA4GA1UdDwEB/wQEAwIBBjAP
  52347. BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAQDdr4Ouwo0RSVgrESLFF6QSU2TJ/s
  52348. Px+EnWVUXKgWAkD6bho3hO9ynYYKVZ1WKKxmLNA6VpM0ByWtCLCPyA8JWcqdmBzlVPi5RX9ql2+I
  52349. aE1KBiY3iAIOtsbWcpnOa3faYjGkVh+uX4132l32iPwa2Z61gfAyuOOI0JzzaqC5mxRZNTZPz/OO
  52350. Xl0XrRWV2N2y1RVuAE6zS89mlOTgzbUF2mNXi+WzqtvALhyQRNsaXRik7r4EW5nVcV9VZWRi1aKb
  52351. BFmGyGJ353yCRWo9F7/snXUMrqNvWtMvmDb08PUZqxFdyKbjKlhqQgnDvZImZjINXQhVdP+MmNAK
  52352. poRq0Tl9
  52353. -----END CERTIFICATE-----
  52354. D-TRUST Root Class 3 CA 2 2009
  52355. ==============================
  52356. -----BEGIN CERTIFICATE-----
  52357. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  52358. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  52359. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  52360. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  52361. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  52362. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  52363. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  52364. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  52365. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  52366. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  52367. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  52368. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  52369. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  52370. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  52371. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  52372. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  52373. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  52374. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  52375. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  52376. -----END CERTIFICATE-----
  52377. D-TRUST Root Class 3 CA 2 EV 2009
  52378. =================================
  52379. -----BEGIN CERTIFICATE-----
  52380. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  52381. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  52382. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  52383. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  52384. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  52385. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  52386. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  52387. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  52388. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  52389. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  52390. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  52391. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  52392. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  52393. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  52394. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  52395. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  52396. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  52397. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  52398. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  52399. w9y4AyHqnxbxLFS1
  52400. -----END CERTIFICATE-----
  52401. PSCProcert
  52402. ==========
  52403. -----BEGIN CERTIFICATE-----
  52404. MIIJhjCCB26gAwIBAgIBCzANBgkqhkiG9w0BAQsFADCCAR4xPjA8BgNVBAMTNUF1dG9yaWRhZCBk
  52405. ZSBDZXJ0aWZpY2FjaW9uIFJhaXogZGVsIEVzdGFkbyBWZW5lem9sYW5vMQswCQYDVQQGEwJWRTEQ
  52406. MA4GA1UEBxMHQ2FyYWNhczEZMBcGA1UECBMQRGlzdHJpdG8gQ2FwaXRhbDE2MDQGA1UEChMtU2lz
  52407. dGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMUMwQQYDVQQLEzpTdXBl
  52408. cmludGVuZGVuY2lhIGRlIFNlcnZpY2lvcyBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMSUw
  52409. IwYJKoZIhvcNAQkBFhZhY3JhaXpAc3VzY2VydGUuZ29iLnZlMB4XDTEwMTIyODE2NTEwMFoXDTIw
  52410. MTIyNTIzNTk1OVowgdExJjAkBgkqhkiG9w0BCQEWF2NvbnRhY3RvQHByb2NlcnQubmV0LnZlMQ8w
  52411. DQYDVQQHEwZDaGFjYW8xEDAOBgNVBAgTB01pcmFuZGExKjAoBgNVBAsTIVByb3ZlZWRvciBkZSBD
  52412. ZXJ0aWZpY2Fkb3MgUFJPQ0VSVDE2MDQGA1UEChMtU2lzdGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZp
  52413. Y2FjaW9uIEVsZWN0cm9uaWNhMQswCQYDVQQGEwJWRTETMBEGA1UEAxMKUFNDUHJvY2VydDCCAiIw
  52414. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANW39KOUM6FGqVVhSQ2oh3NekS1wwQYalNo97BVC
  52415. wfWMrmoX8Yqt/ICV6oNEolt6Vc5Pp6XVurgfoCfAUFM+jbnADrgV3NZs+J74BCXfgI8Qhd19L3uA
  52416. 3VcAZCP4bsm+lU/hdezgfl6VzbHvvnpC2Mks0+saGiKLt38GieU89RLAu9MLmV+QfI4tL3czkkoh
  52417. RqipCKzx9hEC2ZUWno0vluYC3XXCFCpa1sl9JcLB/KpnheLsvtF8PPqv1W7/U0HU9TI4seJfxPmO
  52418. EO8GqQKJ/+MMbpfg353bIdD0PghpbNjU5Db4g7ayNo+c7zo3Fn2/omnXO1ty0K+qP1xmk6wKImG2
  52419. 0qCZyFSTXai20b1dCl53lKItwIKOvMoDKjSuc/HUtQy9vmebVOvh+qBa7Dh+PsHMosdEMXXqP+UH
  52420. 0quhJZb25uSgXTcYOWEAM11G1ADEtMo88aKjPvM6/2kwLkDd9p+cJsmWN63nOaK/6mnbVSKVUyqU
  52421. td+tFjiBdWbjxywbk5yqjKPK2Ww8F22c3HxT4CAnQzb5EuE8XL1mv6JpIzi4mWCZDlZTOpx+FIyw
  52422. Bm/xhnaQr/2v/pDGj59/i5IjnOcVdo/Vi5QTcmn7K2FjiO/mpF7moxdqWEfLcU8UC17IAggmosvp
  52423. r2uKGcfLFFb14dq12fy/czja+eevbqQ34gcnAgMBAAGjggMXMIIDEzASBgNVHRMBAf8ECDAGAQH/
  52424. AgEBMDcGA1UdEgQwMC6CD3N1c2NlcnRlLmdvYi52ZaAbBgVghl4CAqASDBBSSUYtRy0yMDAwNDAz
  52425. Ni0wMB0GA1UdDgQWBBRBDxk4qpl/Qguk1yeYVKIXTC1RVDCCAVAGA1UdIwSCAUcwggFDgBStuyId
  52426. xuDSAaj9dlBSk+2YwU2u06GCASakggEiMIIBHjE+MDwGA1UEAxM1QXV0b3JpZGFkIGRlIENlcnRp
  52427. ZmljYWNpb24gUmFpeiBkZWwgRXN0YWRvIFZlbmV6b2xhbm8xCzAJBgNVBAYTAlZFMRAwDgYDVQQH
  52428. EwdDYXJhY2FzMRkwFwYDVQQIExBEaXN0cml0byBDYXBpdGFsMTYwNAYDVQQKEy1TaXN0ZW1hIE5h
  52429. Y2lvbmFsIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExQzBBBgNVBAsTOlN1cGVyaW50ZW5k
  52430. ZW5jaWEgZGUgU2VydmljaW9zIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExJTAjBgkqhkiG
  52431. 9w0BCQEWFmFjcmFpekBzdXNjZXJ0ZS5nb2IudmWCAQowDgYDVR0PAQH/BAQDAgEGME0GA1UdEQRG
  52432. MESCDnByb2NlcnQubmV0LnZloBUGBWCGXgIBoAwMClBTQy0wMDAwMDKgGwYFYIZeAgKgEgwQUklG
  52433. LUotMzE2MzUzNzMtNzB2BgNVHR8EbzBtMEagRKBChkBodHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52
  52434. ZS9sY3IvQ0VSVElGSUNBRE8tUkFJWi1TSEEzODRDUkxERVIuY3JsMCOgIaAfhh1sZGFwOi8vYWNy
  52435. YWl6LnN1c2NlcnRlLmdvYi52ZTA3BggrBgEFBQcBAQQrMCkwJwYIKwYBBQUHMAGGG2h0dHA6Ly9v
  52436. Y3NwLnN1c2NlcnRlLmdvYi52ZTBBBgNVHSAEOjA4MDYGBmCGXgMBAjAsMCoGCCsGAQUFBwIBFh5o
  52437. dHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52ZS9kcGMwDQYJKoZIhvcNAQELBQADggIBACtZ6yKZu4Sq
  52438. T96QxtGGcSOeSwORR3C7wJJg7ODU523G0+1ng3dS1fLld6c2suNUvtm7CpsR72H0xpkzmfWvADmN
  52439. g7+mvTV+LFwxNG9s2/NkAZiqlCxB3RWGymspThbASfzXg0gTB1GEMVKIu4YXx2sviiCtxQuPcD4q
  52440. uxtxj7mkoP3YldmvWb8lK5jpY5MvYB7Eqvh39YtsL+1+LrVPQA3uvFd359m21D+VJzog1eWuq2w1
  52441. n8GhHVnchIHuTQfiSLaeS5UtQbHh6N5+LwUeaO6/u5BlOsju6rEYNxxik6SgMexxbJHmpHmJWhSn
  52442. FFAFTKQAVzAswbVhltw+HoSvOULP5dAssSS830DD7X9jSr3hTxJkhpXzsOfIt+FTvZLm8wyWuevo
  52443. 5pLtp4EJFAv8lXrPj9Y0TzYS3F7RNHXGRoAvlQSMx4bEqCaJqD8Zm4G7UaRKhqsLEQ+xrmNTbSjq
  52444. 3TNWOByyrYDT13K9mmyZY+gAu0F2BbdbmRiKw7gSXFbPVgx96OLP7bx0R/vu0xdOIk9W/1DzLuY5
  52445. poLWccret9W6aAjtmcz9opLLabid+Qqkpj5PkygqYWwHJgD/ll9ohri4zspV4KuxPX+Y1zMOWj3Y
  52446. eMLEYC/HYvBhkdI4sPaeVdtAgAUSM84dkpvRabP/v/GSCmE1P93+hvS84Bpxs2Km
  52447. -----END CERTIFICATE-----
  52448. CA Disig Root R1
  52449. ================
  52450. -----BEGIN CERTIFICATE-----
  52451. MIIFaTCCA1GgAwIBAgIJAMMDmu5QkG4oMA0GCSqGSIb3DQEBBQUAMFIxCzAJBgNVBAYTAlNLMRMw
  52452. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  52453. ZyBSb290IFIxMB4XDTEyMDcxOTA5MDY1NloXDTQyMDcxOTA5MDY1NlowUjELMAkGA1UEBhMCU0sx
  52454. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  52455. c2lnIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCqw3j33Jijp1pedxiy
  52456. 3QRkD2P9m5YJgNXoqqXinCaUOuiZc4yd39ffg/N4T0Dhf9Kn0uXKE5Pn7cZ3Xza1lK/oOI7bm+V8
  52457. u8yN63Vz4STN5qctGS7Y1oprFOsIYgrY3LMATcMjfF9DCCMyEtztDK3AfQ+lekLZWnDZv6fXARz2
  52458. m6uOt0qGeKAeVjGu74IKgEH3G8muqzIm1Cxr7X1r5OJeIgpFy4QxTaz+29FHuvlglzmxZcfe+5nk
  52459. CiKxLU3lSCZpq+Kq8/v8kiky6bM+TR8noc2OuRf7JT7JbvN32g0S9l3HuzYQ1VTW8+DiR0jm3hTa
  52460. YVKvJrT1cU/J19IG32PK/yHoWQbgCNWEFVP3Q+V8xaCJmGtzxmjOZd69fwX3se72V6FglcXM6pM6
  52461. vpmumwKjrckWtc7dXpl4fho5frLABaTAgqWjR56M6ly2vGfb5ipN0gTco65F97yLnByn1tUD3AjL
  52462. LhbKXEAz6GfDLuemROoRRRw1ZS0eRWEkG4IupZ0zXWX4Qfkuy5Q/H6MMMSRE7cderVC6xkGbrPAX
  52463. ZcD4XW9boAo0PO7X6oifmPmvTiT6l7Jkdtqr9O3jw2Dv1fkCyC2fg69naQanMVXVz0tv/wQFx1is
  52464. XxYb5dKj6zHbHzMVTdDypVP1y+E9Tmgt2BLdqvLmTZtJ5cUoobqwWsagtQIDAQABo0IwQDAPBgNV
  52465. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUiQq0OJMa5qvum5EY+fU8PjXQ
  52466. 04IwDQYJKoZIhvcNAQEFBQADggIBADKL9p1Kyb4U5YysOMo6CdQbzoaz3evUuii+Eq5FLAR0rBNR
  52467. xVgYZk2C2tXck8An4b58n1KeElb21Zyp9HWc+jcSjxyT7Ff+Bw+r1RL3D65hXlaASfX8MPWbTx9B
  52468. LxyE04nH4toCdu0Jz2zBuByDHBb6lM19oMgY0sidbvW9adRtPTXoHqJPYNcHKfyyo6SdbhWSVhlM
  52469. CrDpfNIZTUJG7L399ldb3Zh+pE3McgODWF3vkzpBemOqfDqo9ayk0d2iLbYq/J8BjuIQscTK5Gfb
  52470. VSUZP/3oNn6z4eGBrxEWi1CXYBmCAMBrTXO40RMHPuq2MU/wQppt4hF05ZSsjYSVPCGvxdpHyN85
  52471. YmLLW1AL14FABZyb7bq2ix4Eb5YgOe2kfSnbSM6C3NQCjR0EMVrHS/BsYVLXtFHCgWzN4funodKS
  52472. ds+xDzdYpPJScWc/DIh4gInByLUfkmO+p3qKViwaqKactV2zY9ATIKHrkWzQjX2v3wvkF7mGnjix
  52473. lAxYjOBVqjtjbZqJYLhkKpLGN/R+Q0O3c+gB53+XD9fyexn9GtePyfqFa3qdnom2piiZk4hA9z7N
  52474. UaPK6u95RyG1/jLix8NRb76AdPCkwzryT+lf3xkK8jsTQ6wxpLPn6/wY1gGp8yqPNg7rtLG8t0zJ
  52475. a7+h89n07eLw4+1knj0vllJPgFOL
  52476. -----END CERTIFICATE-----
  52477. CA Disig Root R2
  52478. ================
  52479. -----BEGIN CERTIFICATE-----
  52480. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  52481. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  52482. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  52483. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  52484. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  52485. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  52486. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  52487. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  52488. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  52489. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  52490. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  52491. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  52492. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  52493. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  52494. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  52495. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  52496. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  52497. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  52498. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  52499. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  52500. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  52501. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  52502. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  52503. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  52504. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  52505. -----END CERTIFICATE-----
  52506. ACCVRAIZ1
  52507. =========
  52508. -----BEGIN CERTIFICATE-----
  52509. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  52510. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  52511. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  52512. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  52513. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  52514. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  52515. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  52516. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  52517. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  52518. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  52519. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  52520. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  52521. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  52522. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  52523. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  52524. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  52525. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  52526. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  52527. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  52528. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  52529. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  52530. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  52531. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  52532. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  52533. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  52534. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  52535. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  52536. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  52537. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  52538. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  52539. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  52540. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  52541. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  52542. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  52543. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  52544. EfbRD0tVNEYqi4Y7
  52545. -----END CERTIFICATE-----
  52546. TWCA Global Root CA
  52547. ===================
  52548. -----BEGIN CERTIFICATE-----
  52549. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  52550. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  52551. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  52552. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  52553. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  52554. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  52555. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  52556. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  52557. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  52558. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  52559. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  52560. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  52561. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  52562. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  52563. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  52564. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  52565. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  52566. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  52567. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  52568. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  52569. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  52570. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  52571. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  52572. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  52573. -----END CERTIFICATE-----
  52574. TeliaSonera Root CA v1
  52575. ======================
  52576. -----BEGIN CERTIFICATE-----
  52577. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  52578. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  52579. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  52580. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  52581. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  52582. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  52583. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  52584. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  52585. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  52586. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  52587. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  52588. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  52589. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  52590. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  52591. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  52592. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  52593. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  52594. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  52595. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  52596. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  52597. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  52598. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  52599. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  52600. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  52601. -----END CERTIFICATE-----
  52602. E-Tugra Certification Authority
  52603. ===============================
  52604. -----BEGIN CERTIFICATE-----
  52605. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  52606. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  52607. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  52608. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  52609. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  52610. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  52611. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  52612. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  52613. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  52614. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  52615. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  52616. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  52617. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  52618. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  52619. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  52620. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  52621. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  52622. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  52623. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  52624. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  52625. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  52626. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  52627. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  52628. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  52629. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  52630. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  52631. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  52632. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  52633. C7TbO6Orb1wdtn7os4I07QZcJA==
  52634. -----END CERTIFICATE-----
  52635. T-TeleSec GlobalRoot Class 2
  52636. ============================
  52637. -----BEGIN CERTIFICATE-----
  52638. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  52639. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  52640. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  52641. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  52642. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  52643. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  52644. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  52645. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  52646. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  52647. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  52648. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  52649. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  52650. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  52651. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  52652. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  52653. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  52654. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  52655. -----END CERTIFICATE-----
  52656. Atos TrustedRoot 2011
  52657. =====================
  52658. -----BEGIN CERTIFICATE-----
  52659. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  52660. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  52661. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  52662. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  52663. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  52664. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  52665. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  52666. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  52667. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  52668. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  52669. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  52670. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  52671. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  52672. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  52673. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  52674. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  52675. -----END CERTIFICATE-----
  52676. QuoVadis Root CA 1 G3
  52677. =====================
  52678. -----BEGIN CERTIFICATE-----
  52679. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  52680. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  52681. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  52682. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  52683. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  52684. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  52685. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  52686. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  52687. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  52688. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  52689. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  52690. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  52691. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  52692. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52693. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  52694. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  52695. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  52696. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  52697. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  52698. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  52699. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  52700. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  52701. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  52702. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  52703. hMJKzRwuJIczYOXD
  52704. -----END CERTIFICATE-----
  52705. QuoVadis Root CA 2 G3
  52706. =====================
  52707. -----BEGIN CERTIFICATE-----
  52708. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  52709. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  52710. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  52711. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  52712. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  52713. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  52714. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  52715. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  52716. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  52717. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  52718. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  52719. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  52720. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  52721. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52722. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  52723. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  52724. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  52725. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  52726. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  52727. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  52728. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  52729. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  52730. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  52731. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  52732. O3jtZsSOeWmD3n+M
  52733. -----END CERTIFICATE-----
  52734. QuoVadis Root CA 3 G3
  52735. =====================
  52736. -----BEGIN CERTIFICATE-----
  52737. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  52738. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  52739. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  52740. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  52741. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  52742. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  52743. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  52744. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  52745. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  52746. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  52747. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  52748. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  52749. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  52750. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  52751. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  52752. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  52753. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  52754. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  52755. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  52756. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  52757. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  52758. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  52759. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  52760. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  52761. PpxxVJkES/1Y+Zj0
  52762. -----END CERTIFICATE-----
  52763. DigiCert Assured ID Root G2
  52764. ===========================
  52765. -----BEGIN CERTIFICATE-----
  52766. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  52767. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  52768. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  52769. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  52770. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  52771. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  52772. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  52773. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  52774. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  52775. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  52776. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  52777. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  52778. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  52779. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  52780. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  52781. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  52782. IhNzbM8m9Yop5w==
  52783. -----END CERTIFICATE-----
  52784. DigiCert Assured ID Root G3
  52785. ===========================
  52786. -----BEGIN CERTIFICATE-----
  52787. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  52788. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  52789. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  52790. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  52791. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  52792. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  52793. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  52794. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  52795. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  52796. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  52797. 1vUhZscv6pZjamVFkpUBtA==
  52798. -----END CERTIFICATE-----
  52799. DigiCert Global Root G2
  52800. =======================
  52801. -----BEGIN CERTIFICATE-----
  52802. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  52803. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  52804. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  52805. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  52806. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  52807. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  52808. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  52809. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  52810. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  52811. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  52812. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  52813. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  52814. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  52815. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  52816. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  52817. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  52818. MrY=
  52819. -----END CERTIFICATE-----
  52820. DigiCert Global Root G3
  52821. =======================
  52822. -----BEGIN CERTIFICATE-----
  52823. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  52824. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  52825. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  52826. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  52827. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  52828. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  52829. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  52830. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  52831. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  52832. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  52833. VOKa5Vt8sycX
  52834. -----END CERTIFICATE-----
  52835. DigiCert Trusted Root G4
  52836. ========================
  52837. -----BEGIN CERTIFICATE-----
  52838. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  52839. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  52840. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  52841. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  52842. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  52843. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  52844. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  52845. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  52846. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  52847. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  52848. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  52849. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  52850. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  52851. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  52852. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  52853. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  52854. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  52855. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  52856. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  52857. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  52858. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  52859. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  52860. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  52861. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  52862. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  52863. 82Z+
  52864. -----END CERTIFICATE-----
  52865. WoSign
  52866. ======
  52867. -----BEGIN CERTIFICATE-----
  52868. MIIFdjCCA16gAwIBAgIQXmjWEXGUY1BWAGjzPsnFkTANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQG
  52869. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxKjAoBgNVBAMTIUNlcnRpZmljYXRpb24g
  52870. QXV0aG9yaXR5IG9mIFdvU2lnbjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMFUxCzAJ
  52871. BgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEqMCgGA1UEAxMhQ2VydGlmaWNh
  52872. dGlvbiBBdXRob3JpdHkgb2YgV29TaWduMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA
  52873. vcqNrLiRFVaXe2tcesLea9mhsMMQI/qnobLMMfo+2aYpbxY94Gv4uEBf2zmoAHqLoE1UfcIiePyO
  52874. CbiohdfMlZdLdNiefvAA5A6JrkkoRBoQmTIPJYhTpA2zDxIIFgsDcSccf+Hb0v1naMQFXQoOXXDX
  52875. 2JegvFNBmpGN9J42Znp+VsGQX+axaCA2pIwkLCxHC1l2ZjC1vt7tj/id07sBMOby8w7gLJKA84X5
  52876. KIq0VC6a7fd2/BVoFutKbOsuEo/Uz/4Mx1wdC34FMr5esAkqQtXJTpCzWQ27en7N1QhatH/YHGkR
  52877. +ScPewavVIMYe+HdVHpRaG53/Ma/UkpmRqGyZxq7o093oL5d//xWC0Nyd5DKnvnyOfUNqfTq1+ez
  52878. EC8wQjchzDBwyYaYD8xYTYO7feUapTeNtqwylwA6Y3EkHp43xP901DfA4v6IRmAR3Qg/UDaruHqk
  52879. lWJqbrDKaiFaafPz+x1wOZXzp26mgYmhiMU7ccqjUu6Du/2gd/Tkb+dC221KmYo0SLwX3OSACCK2
  52880. 8jHAPwQ+658geda4BmRkAjHXqc1S+4RFaQkAKtxVi8QGRkvASh0JWzko/amrzgD5LkhLJuYwTKVY
  52881. yrREgk/nkR4zw7CT/xH8gdLKH3Ep3XZPkiWvHYG3Dy+MwwbMLyejSuQOmbp8HkUff6oZRZb9/D0C
  52882. AwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFOFmzw7R
  52883. 8bNLtwYgFP6HEtX2/vs+MA0GCSqGSIb3DQEBBQUAA4ICAQCoy3JAsnbBfnv8rWTjMnvMPLZdRtP1
  52884. LOJwXcgu2AZ9mNELIaCJWSQBnfmvCX0KI4I01fx8cpm5o9dU9OpScA7F9dY74ToJMuYhOZO9sxXq
  52885. T2r09Ys/L3yNWC7F4TmgPsc9SnOeQHrAK2GpZ8nzJLmzbVUsWh2eJXLOC62qx1ViC777Y7NhRCOj
  52886. y+EaDveaBk3e1CNOIZZbOVtXHS9dCF4Jef98l7VNg64N1uajeeAz0JmWAjCnPv/So0M/BVoG6kQC
  52887. 2nz4SNAzqfkHx5Xh9T71XXG68pWpdIhhWeO/yloTunK0jF02h+mmxTwTv97QRCbut+wucPrXnbes
  52888. 5cVAWubXbHssw1abR80LzvobtCHXt2a49CUwi1wNuepnsvRtrtWhnk/Yn+knArAdBtaP4/tIEp9/
  52889. EaEQPkxROpaw0RPxx9gmrjrKkcRpnd8BKWRRb2jaFOwIQZeQjdCygPLPwj2/kWjFgGcexGATVdVh
  52890. mVd8upUPYUk6ynW8yQqTP2cOEvIo4jEbwFcW3wh8GcF+Dx+FHgo2fFt+J7x6v+Db9NpSvd4MVHAx
  52891. kUOVyLzwPt0JfjBkUO1/AaQzZ01oT74V77D2AhGiGxMlOtzCWfHjXEa7ZywCRuoeSKbmW9m1vFGi
  52892. kpbbqsY3Iqb+zCB0oy2pLmvLwIIRIbWTee5Ehr7XHuQe+w==
  52893. -----END CERTIFICATE-----
  52894. WoSign China
  52895. ============
  52896. -----BEGIN CERTIFICATE-----
  52897. MIIFWDCCA0CgAwIBAgIQUHBrzdgT/BtOOzNy0hFIjTANBgkqhkiG9w0BAQsFADBGMQswCQYDVQQG
  52898. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMMEkNBIOayg+mAmuagueiv
  52899. geS5pjAeFw0wOTA4MDgwMTAwMDFaFw0zOTA4MDgwMTAwMDFaMEYxCzAJBgNVBAYTAkNOMRowGAYD
  52900. VQQKExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAwwSQ0Eg5rKD6YCa5qC56K+B5LmmMIICIjAN
  52901. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0EkhHiX8h8EqwqzbdoYGTufQdDTc7WU1/FDWiD+k
  52902. 8H/rD195L4mx/bxjWDeTmzj4t1up+thxx7S8gJeNbEvxUNUqKaqoGXqW5pWOdO2XCld19AXbbQs5
  52903. uQF/qvbW2mzmBeCkTVL829B0txGMe41P/4eDrv8FAxNXUDf+jJZSEExfv5RxadmWPgxDT74wwJ85
  52904. dE8GRV2j1lY5aAfMh09Qd5Nx2UQIsYo06Yms25tO4dnkUkWMLhQfkWsZHWgpLFbE4h4TV2TwYeO5
  52905. Ed+w4VegG63XX9Gv2ystP9Bojg/qnw+LNVgbExz03jWhCl3W6t8Sb8D7aQdGctyB9gQjF+BNdeFy
  52906. b7Ao65vh4YOhn0pdr8yb+gIgthhid5E7o9Vlrdx8kHccREGkSovrlXLp9glk3Kgtn3R46MGiCWOc
  52907. 76DbT52VqyBPt7D3h1ymoOQ3OMdc4zUPLK2jgKLsLl3Az+2LBcLmc272idX10kaO6m1jGx6KyX2m
  52908. +Jzr5dVjhU1zZmkR/sgO9MHHZklTfuQZa/HpelmjbX7FF+Ynxu8b22/8DU0GAbQOXDBGVWCvOGU6
  52909. yke6rCzMRh+yRpY/8+0mBe53oWprfi1tWFxK1I5nuPHa1UaKJ/kR8slC/k7e3x9cxKSGhxYzoacX
  52910. GKUN5AXlK8IrC6KVkLn9YDxOiT7nnO4fuwECAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1Ud
  52911. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFOBNv9ybQV0T6GTwp+kVpOGBwboxMA0GCSqGSIb3DQEBCwUA
  52912. A4ICAQBqinA4WbbaixjIvirTthnVZil6Xc1bL3McJk6jfW+rtylNpumlEYOnOXOvEESS5iVdT2H6
  52913. yAa+Tkvv/vMx/sZ8cApBWNromUuWyXi8mHwCKe0JgOYKOoICKuLJL8hWGSbueBwj/feTZU7n85iY
  52914. r83d2Z5AiDEoOqsuC7CsDCT6eiaY8xJhEPRdF/d+4niXVOKM6Cm6jBAyvd0zaziGfjk9DgNyp115
  52915. j0WKWa5bIW4xRtVZjc8VX90xJc/bYNaBRHIpAlf2ltTW/+op2znFuCyKGo3Oy+dCMYYFaA6eFN0A
  52916. kLppRQjbbpCBhqcqBT/mhDn4t/lXX0ykeVoQDF7Va/81XwVRHmyjdanPUIPTfPRm94KNPQx96N97
  52917. qA4bLJyuQHCH2u2nFoJavjVsIE4iYdm8UXrNemHcSxH5/mc0zy4EZmFcV5cjjPOGG0jfKq+nwf/Y
  52918. jj4Du9gqsPoUJbJRa4ZDhS4HIxaAjUz7tGM7zMN07RujHv41D198HRaG9Q7DlfEvr10lO1Hm13ZB
  52919. ONFLAzkopR6RctR9q5czxNM+4Gm2KHmgCY0c0f9BckgG/Jou5yD5m6Leie2uPAmvylezkolwQOQv
  52920. T8Jwg0DXJCxr5wkf09XHwQj02w47HAcLQxGEIYbpgNR12KvxAmLBsX5VYc8T1yaw15zLKYs4SgsO
  52921. kI26oQ==
  52922. -----END CERTIFICATE-----
  52923. COMODO RSA Certification Authority
  52924. ==================================
  52925. -----BEGIN CERTIFICATE-----
  52926. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  52927. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  52928. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  52929. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  52930. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  52931. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  52932. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  52933. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  52934. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  52935. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  52936. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  52937. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  52938. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  52939. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  52940. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  52941. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  52942. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  52943. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  52944. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  52945. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  52946. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  52947. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  52948. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  52949. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  52950. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  52951. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  52952. LaZRfyHBNVOFBkpdn627G190
  52953. -----END CERTIFICATE-----
  52954. USERTrust RSA Certification Authority
  52955. =====================================
  52956. -----BEGIN CERTIFICATE-----
  52957. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  52958. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  52959. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  52960. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  52961. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  52962. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  52963. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  52964. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  52965. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  52966. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  52967. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  52968. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  52969. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  52970. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  52971. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  52972. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  52973. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  52974. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  52975. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  52976. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  52977. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  52978. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  52979. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  52980. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  52981. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  52982. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  52983. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  52984. -----END CERTIFICATE-----
  52985. USERTrust ECC Certification Authority
  52986. =====================================
  52987. -----BEGIN CERTIFICATE-----
  52988. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  52989. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  52990. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  52991. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  52992. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  52993. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  52994. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  52995. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  52996. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  52997. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  52998. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  52999. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  53000. -----END CERTIFICATE-----
  53001. GlobalSign ECC Root CA - R4
  53002. ===========================
  53003. -----BEGIN CERTIFICATE-----
  53004. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  53005. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53006. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  53007. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53008. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  53009. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  53010. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  53011. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  53012. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  53013. -----END CERTIFICATE-----
  53014. GlobalSign ECC Root CA - R5
  53015. ===========================
  53016. -----BEGIN CERTIFICATE-----
  53017. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  53018. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53019. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  53020. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  53021. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  53022. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  53023. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  53024. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  53025. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  53026. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  53027. -----END CERTIFICATE-----
  53028. Staat der Nederlanden Root CA - G3
  53029. ==================================
  53030. -----BEGIN CERTIFICATE-----
  53031. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53032. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53033. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  53034. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  53035. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  53036. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  53037. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  53038. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  53039. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  53040. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  53041. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  53042. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  53043. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  53044. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  53045. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  53046. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  53047. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  53048. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  53049. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  53050. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  53051. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  53052. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  53053. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  53054. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  53055. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  53056. -----END CERTIFICATE-----
  53057. Staat der Nederlanden EV Root CA
  53058. ================================
  53059. -----BEGIN CERTIFICATE-----
  53060. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53061. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53062. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  53063. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  53064. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  53065. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  53066. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  53067. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  53068. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  53069. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  53070. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  53071. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  53072. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  53073. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  53074. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  53075. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  53076. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  53077. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  53078. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  53079. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  53080. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  53081. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  53082. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  53083. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  53084. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  53085. -----END CERTIFICATE-----
  53086. IdenTrust Commercial Root CA 1
  53087. ==============================
  53088. -----BEGIN CERTIFICATE-----
  53089. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  53090. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  53091. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  53092. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  53093. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  53094. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  53095. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  53096. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  53097. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  53098. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  53099. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  53100. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  53101. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  53102. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  53103. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  53104. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  53105. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  53106. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  53107. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  53108. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  53109. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  53110. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  53111. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  53112. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  53113. cGzM7vRX+Bi6hG6H
  53114. -----END CERTIFICATE-----
  53115. IdenTrust Public Sector Root CA 1
  53116. =================================
  53117. -----BEGIN CERTIFICATE-----
  53118. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  53119. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  53120. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  53121. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  53122. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  53123. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  53124. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  53125. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  53126. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  53127. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  53128. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  53129. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  53130. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  53131. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  53132. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  53133. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  53134. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  53135. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  53136. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  53137. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  53138. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  53139. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  53140. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  53141. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  53142. 3Wl9af0AVqW3rLatt8o+Ae+c
  53143. -----END CERTIFICATE-----
  53144. Entrust Root Certification Authority - G2
  53145. =========================================
  53146. -----BEGIN CERTIFICATE-----
  53147. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  53148. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  53149. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  53150. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  53151. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  53152. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  53153. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  53154. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  53155. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  53156. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  53157. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  53158. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  53159. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  53160. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  53161. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  53162. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  53163. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  53164. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  53165. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  53166. e4pIb4tF9g==
  53167. -----END CERTIFICATE-----
  53168. Entrust Root Certification Authority - EC1
  53169. ==========================================
  53170. -----BEGIN CERTIFICATE-----
  53171. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  53172. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  53173. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  53174. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  53175. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  53176. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  53177. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  53178. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  53179. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  53180. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  53181. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  53182. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  53183. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  53184. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  53185. -----END CERTIFICATE-----
  53186. CFCA EV ROOT
  53187. ============
  53188. -----BEGIN CERTIFICATE-----
  53189. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  53190. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  53191. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  53192. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  53193. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  53194. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  53195. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  53196. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  53197. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  53198. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  53199. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  53200. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  53201. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  53202. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  53203. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  53204. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  53205. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  53206. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  53207. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  53208. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  53209. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  53210. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  53211. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  53212. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  53213. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  53214. -----END CERTIFICATE-----
  53215. TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5
  53216. ====================================================
  53217. -----BEGIN CERTIFICATE-----
  53218. MIIEJzCCAw+gAwIBAgIHAI4X/iQggTANBgkqhkiG9w0BAQsFADCBsTELMAkGA1UEBhMCVFIxDzAN
  53219. BgNVBAcMBkFua2FyYTFNMEsGA1UECgxEVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
  53220. bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4xQjBABgNVBAMMOVTDnFJLVFJVU1Qg
  53221. RWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSBINTAeFw0xMzA0MzAw
  53222. ODA3MDFaFw0yMzA0MjgwODA3MDFaMIGxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMU0w
  53223. SwYDVQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnE
  53224. n2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBFbGVrdHJvbmlrIFNlcnRp
  53225. ZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg1MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  53226. CgKCAQEApCUZ4WWe60ghUEoI5RHwWrom/4NZzkQqL/7hzmAD/I0Dpe3/a6i6zDQGn1k19uwsu537
  53227. jVJp45wnEFPzpALFp/kRGml1bsMdi9GYjZOHp3GXDSHHmflS0yxjXVW86B8BSLlg/kJK9siArs1m
  53228. ep5Fimh34khon6La8eHBEJ/rPCmBp+EyCNSgBbGM+42WAA4+Jd9ThiI7/PS98wl+d+yG6w8z5UNP
  53229. 9FR1bSmZLmZaQ9/LXMrI5Tjxfjs1nQ/0xVqhzPMggCTTV+wVunUlm+hkS7M0hO8EuPbJbKoCPrZV
  53230. 4jI3X/xml1/N1p7HIL9Nxqw/dV8c7TKcfGkAaZHjIxhT6QIDAQABo0IwQDAdBgNVHQ4EFgQUVpkH
  53231. HtOsDGlktAxQR95DLL4gwPswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZI
  53232. hvcNAQELBQADggEBAJ5FdnsXSDLyOIspve6WSk6BGLFRRyDN0GSxDsnZAdkJzsiZ3GglE9Rc8qPo
  53233. BP5yCccLqh0lVX6Wmle3usURehnmp349hQ71+S4pL+f5bFgWV1Al9j4uPqrtd3GqqpmWRgqujuwq
  53234. URawXs3qZwQcWDD1YIq9pr1N5Za0/EKJAWv2cMhQOQwt1WbZyNKzMrcbGW3LM/nfpeYVhDfwwvJl
  53235. lpKQd/Ct9JDpEXjXk4nAPQu6KfTomZ1yju2dL+6SfaHx/126M2CFYv4HAqGEVka+lgqaE9chTLd8
  53236. B59OTj+RdPsnnRHM3eaxynFNExc5JsUpISuTKWqW+qtB4Uu2NQvAmxU=
  53237. -----END CERTIFICATE-----
  53238. Certinomis - Root CA
  53239. ====================
  53240. -----BEGIN CERTIFICATE-----
  53241. MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
  53242. Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAbBgNVBAMTFENlcnRpbm9taXMg
  53243. LSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMzMTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIx
  53244. EzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRD
  53245. ZXJ0aW5vbWlzIC0gUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQos
  53246. P5L2fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJflLieY6pOo
  53247. d5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQVWZUKxkd8aRi5pwP5ynap
  53248. z8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDFTKWrteoB4owuZH9kb/2jJZOLyKIOSY00
  53249. 8B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09x
  53250. RLWtwHkziOC/7aOgFLScCbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE
  53251. 6OXWk6RiwsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJwx3t
  53252. FvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SGm/lg0h9tkQPTYKbV
  53253. PZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4F2iw4lNVYC2vPsKD2NkJK/DAZNuH
  53254. i5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZngWVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGj
  53255. YzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I
  53256. 6tNxIqSSaHh02TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF
  53257. AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/0KGRHCwPT5iV
  53258. WVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWwF6YSjNRieOpWauwK0kDDPAUw
  53259. Pk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZSg081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAX
  53260. lCOotQqSD7J6wWAsOMwaplv/8gzjqh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJ
  53261. y29SWwNyhlCVCNSNh4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9
  53262. Iff/ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8Vbtaw5Bng
  53263. DwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwjY/M50n92Uaf0yKHxDHYi
  53264. I0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nM
  53265. cyrDflOR1m749fPH0FFNjkulW+YZFzvWgQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVr
  53266. hkIGuUE=
  53267. -----END CERTIFICATE-----
  53268. OISTE WISeKey Global Root GB CA
  53269. ===============================
  53270. -----BEGIN CERTIFICATE-----
  53271. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  53272. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  53273. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  53274. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  53275. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  53276. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  53277. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  53278. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  53279. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  53280. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  53281. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  53282. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  53283. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  53284. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  53285. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  53286. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  53287. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  53288. -----END CERTIFICATE-----
  53289. Certification Authority of WoSign G2
  53290. ====================================
  53291. -----BEGIN CERTIFICATE-----
  53292. MIIDfDCCAmSgAwIBAgIQayXaioidfLwPBbOxemFFRDANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQG
  53293. EwJDTjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxLTArBgNVBAMTJENlcnRpZmljYXRpb24g
  53294. QXV0aG9yaXR5IG9mIFdvU2lnbiBHMjAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMFgx
  53295. CzAJBgNVBAYTAkNOMRowGAYDVQQKExFXb1NpZ24gQ0EgTGltaXRlZDEtMCsGA1UEAxMkQ2VydGlm
  53296. aWNhdGlvbiBBdXRob3JpdHkgb2YgV29TaWduIEcyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  53297. CgKCAQEAvsXEoCKASU+/2YcRxlPhuw+9YH+v9oIOH9ywjj2X4FA8jzrvZjtFB5sg+OPXJYY1kBai
  53298. XW8wGQiHC38Gsp1ij96vkqVg1CuAmlI/9ZqD6TRay9nVYlzmDuDfBpgOgHzKtB0TiGsOqCR3A9Du
  53299. W/PKaZE1OVbFbeP3PU9ekzgkyhjpJMuSA93MHD0JcOQg5PGurLtzaaNjOg9FD6FKmsLRY6zLEPg9
  53300. 5k4ot+vElbGs/V6r+kHLXZ1L3PR8du9nfwB6jdKgGlxNIuG12t12s9R23164i5jIFFTMaxeSt+BK
  53301. v0mUYQs4kI9dJGwlezt52eJ+na2fmKEG/HgUYFf47oB3sQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  53302. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU+mCp62XF3RYUCE4MD42b4Pdkr2cwDQYJKoZI
  53303. hvcNAQELBQADggEBAFfDejaCnI2Y4qtAqkePx6db7XznPWZaOzG73/MWM5H8fHulwqZm46qwtyeY
  53304. P0nXYGdnPzZPSsvxFPpahygc7Y9BMsaV+X3avXtbwrAh449G3CE4Q3RM+zD4F3LBMvzIkRfEzFg3
  53305. TgvMWvchNSiDbGAtROtSjFA9tWwS1/oJu2yySrHFieT801LYYRf+epSEj3m2M1m6D8QL4nCgS3gu
  53306. +sif/a+RZQp4OBXllxcU3fngLDT4ONCEIgDAFFEYKwLcMFrw6AF8NTojrwjkr6qOKEJJLvD1mTS+
  53307. 7Q9LGOHSJDy7XUe3IfKN0QqZjuNuPq1w4I+5ysxugTH2e5x6eeRncRg=
  53308. -----END CERTIFICATE-----
  53309. CA WoSign ECC Root
  53310. ==================
  53311. -----BEGIN CERTIFICATE-----
  53312. MIICCTCCAY+gAwIBAgIQaEpYcIBr8I8C+vbe6LCQkDAKBggqhkjOPQQDAzBGMQswCQYDVQQGEwJD
  53313. TjEaMBgGA1UEChMRV29TaWduIENBIExpbWl0ZWQxGzAZBgNVBAMTEkNBIFdvU2lnbiBFQ0MgUm9v
  53314. dDAeFw0xNDExMDgwMDU4NThaFw00NDExMDgwMDU4NThaMEYxCzAJBgNVBAYTAkNOMRowGAYDVQQK
  53315. ExFXb1NpZ24gQ0EgTGltaXRlZDEbMBkGA1UEAxMSQ0EgV29TaWduIEVDQyBSb290MHYwEAYHKoZI
  53316. zj0CAQYFK4EEACIDYgAE4f2OuEMkq5Z7hcK6C62N4DrjJLnSsb6IOsq/Srj57ywvr1FQPEd1bPiU
  53317. t5v8KB7FVMxjnRZLU8HnIKvNrCXSf4/CwVqCXjCLelTOA7WRf6qU0NGKSMyCBSah1VES1ns2o0Iw
  53318. QDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUqv3VWqP2h4syhf3R
  53319. MluARZPzA7gwCgYIKoZIzj0EAwMDaAAwZQIxAOSkhLCB1T2wdKyUpOgOPQB0TKGXa/kNUTyh2Tv0
  53320. Daupn75OcsqF1NnstTJFGG+rrQIwfcf3aWMvoeGY7xMQ0Xk/0f7qO3/eVvSQsRUR2LIiFdAvwyYu
  53321. a/GRspBl9JrmkO5K
  53322. -----END CERTIFICATE-----
  53323. SZAFIR ROOT CA2
  53324. ===============
  53325. -----BEGIN CERTIFICATE-----
  53326. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  53327. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  53328. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  53329. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  53330. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  53331. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  53332. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  53333. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  53334. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  53335. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  53336. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  53337. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  53338. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  53339. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  53340. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  53341. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  53342. -----END CERTIFICATE-----
  53343. Certum Trusted Network CA 2
  53344. ===========================
  53345. -----BEGIN CERTIFICATE-----
  53346. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  53347. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  53348. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  53349. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  53350. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  53351. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  53352. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  53353. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  53354. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  53355. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  53356. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  53357. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  53358. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  53359. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  53360. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  53361. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53362. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  53363. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  53364. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  53365. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  53366. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  53367. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  53368. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  53369. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  53370. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  53371. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  53372. zAYspsbiDrW5viSP
  53373. -----END CERTIFICATE-----
  53374. Hellenic Academic and Research Institutions RootCA 2015
  53375. =======================================================
  53376. -----BEGIN CERTIFICATE-----
  53377. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  53378. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  53379. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  53380. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  53381. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  53382. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  53383. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  53384. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  53385. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  53386. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  53387. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  53388. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  53389. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  53390. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  53391. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  53392. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  53393. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53394. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  53395. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  53396. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  53397. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  53398. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  53399. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  53400. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  53401. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  53402. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  53403. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  53404. p/UsQu0yrbYhnr68
  53405. -----END CERTIFICATE-----
  53406. Hellenic Academic and Research Institutions ECC RootCA 2015
  53407. ===========================================================
  53408. -----BEGIN CERTIFICATE-----
  53409. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  53410. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  53411. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  53412. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  53413. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  53414. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  53415. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  53416. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  53417. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  53418. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  53419. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  53420. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  53421. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  53422. -----END CERTIFICATE-----
  53423. Certplus Root CA G1
  53424. ===================
  53425. -----BEGIN CERTIFICATE-----
  53426. MIIFazCCA1OgAwIBAgISESBVg+QtPlRWhS2DN7cs3EYRMA0GCSqGSIb3DQEBDQUAMD4xCzAJBgNV
  53427. BAYTAkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTAe
  53428. Fw0xNDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhD
  53429. ZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMTCCAiIwDQYJKoZIhvcNAQEBBQAD
  53430. ggIPADCCAgoCggIBANpQh7bauKk+nWT6VjOaVj0W5QOVsjQcmm1iBdTYj+eJZJ+622SLZOZ5KmHN
  53431. r49aiZFluVj8tANfkT8tEBXgfs+8/H9DZ6itXjYj2JizTfNDnjl8KvzsiNWI7nC9hRYt6kuJPKNx
  53432. Qv4c/dMcLRC4hlTqQ7jbxofaqK6AJc96Jh2qkbBIb6613p7Y1/oA/caP0FG7Yn2ksYyy/yARujVj
  53433. BYZHYEMzkPZHogNPlk2dT8Hq6pyi/jQu3rfKG3akt62f6ajUeD94/vI4CTYd0hYCyOwqaK/1jpTv
  53434. LRN6HkJKHRUxrgwEV/xhc/MxVoYxgKDEEW4wduOU8F8ExKyHcomYxZ3MVwia9Az8fXoFOvpHgDm2
  53435. z4QTd28n6v+WZxcIbekN1iNQMLAVdBM+5S//Ds3EC0pd8NgAM0lm66EYfFkuPSi5YXHLtaW6uOrc
  53436. 4nBvCGrch2c0798wct3zyT8j/zXhviEpIDCB5BmlIOklynMxdCm+4kLV87ImZsdo/Rmz5yCTmehd
  53437. 4F6H50boJZwKKSTUzViGUkAksnsPmBIgJPaQbEfIDbsYIC7Z/fyL8inqh3SV4EJQeIQEQWGw9CEj
  53438. jy3LKCHyamz0GqbFFLQ3ZU+V/YDI+HLlJWvEYLF7bY5KinPOWftwenMGE9nTdDckQQoRb5fc5+R+
  53439. ob0V8rqHDz1oihYHAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0G
  53440. A1UdDgQWBBSowcCbkahDFXxdBie0KlHYlwuBsTAfBgNVHSMEGDAWgBSowcCbkahDFXxdBie0KlHY
  53441. lwuBsTANBgkqhkiG9w0BAQ0FAAOCAgEAnFZvAX7RvUz1isbwJh/k4DgYzDLDKTudQSk0YcbX8ACh
  53442. 66Ryj5QXvBMsdbRX7gp8CXrc1cqh0DQT+Hern+X+2B50ioUHj3/MeXrKls3N/U/7/SMNkPX0XtPG
  53443. YX2eEeAC7gkE2Qfdpoq3DIMku4NQkv5gdRE+2J2winq14J2by5BSS7CTKtQ+FjPlnsZlFT5kOwQ/
  53444. 2wyPX1wdaR+v8+khjPPvl/aatxm2hHSco1S1cE5j2FddUyGbQJJD+tZ3VTNPZNX70Cxqjm0lpu+F
  53445. 6ALEUz65noe8zDUa3qHpimOHZR4RKttjd5cUvpoUmRGywO6wT/gUITJDT5+rosuoD6o7BlXGEilX
  53446. CNQ314cnrUlZp5GrRHpejXDbl85IULFzk/bwg2D5zfHhMf1bfHEhYxQUqq/F3pN+aLHsIqKqkHWe
  53447. tUNy6mSjhEv9DKgma3GX7lZjZuhCVPnHHd/Qj1vfyDBviP4NxDMcU6ij/UgQ8uQKTuEVV/xuZDDC
  53448. VRHc6qnNSlSsKWNEz0pAoNZoWRsz+e86i9sgktxChL8Bq4fA1SCC28a5g4VCXA9DO2pJNdWY9BW/
  53449. +mGBDAkgGNLQFwzLSABQ6XaCjGTXOqAHVcweMcDvOrRl++O/QmueD6i9a5jc2NvLi6Td11n0bt3+
  53450. qsOR0C5CB8AMTVPNJLFMWx5R9N/pkvo=
  53451. -----END CERTIFICATE-----
  53452. Certplus Root CA G2
  53453. ===================
  53454. -----BEGIN CERTIFICATE-----
  53455. MIICHDCCAaKgAwIBAgISESDZkc6uo+jF5//pAq/Pc7xVMAoGCCqGSM49BAMDMD4xCzAJBgNVBAYT
  53456. AkZSMREwDwYDVQQKDAhDZXJ0cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjAeFw0x
  53457. NDA1MjYwMDAwMDBaFw0zODAxMTUwMDAwMDBaMD4xCzAJBgNVBAYTAkZSMREwDwYDVQQKDAhDZXJ0
  53458. cGx1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  53459. BM0PW1aC3/BFGtat93nwHcmsltaeTpwftEIRyoa/bfuFo8XlGVzX7qY/aWfYeOKmycTbLXku54uN
  53460. Am8xIk0G42ByRZ0OQneezs/lf4WbGOT8zC5y0xaTTsqZY1yhBSpsBqNjMGEwDgYDVR0PAQH/BAQD
  53461. AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMB8GA1Ud
  53462. IwQYMBaAFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMAoGCCqGSM49BAMDA2gAMGUCMHD+sAvZ94OX7PNV
  53463. HdTcswYO/jOYnYs5kGuUIe22113WTNchp+e/IQ8rzfcq3IUHnQIxAIYUFuXcsGXCwI4Un78kFmjl
  53464. vPl5adytRSv3tjFzzAalU5ORGpOucGpnutee5WEaXw==
  53465. -----END CERTIFICATE-----
  53466. OpenTrust Root CA G1
  53467. ====================
  53468. -----BEGIN CERTIFICATE-----
  53469. MIIFbzCCA1egAwIBAgISESCzkFU5fX82bWTCp59rY45nMA0GCSqGSIb3DQEBCwUAMEAxCzAJBgNV
  53470. BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcx
  53471. MB4XDTE0MDUyNjA4NDU1MFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
  53472. CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzEwggIiMA0GCSqGSIb3DQEB
  53473. AQUAA4ICDwAwggIKAoICAQD4eUbalsUwXopxAy1wpLuwxQjczeY1wICkES3d5oeuXT2R0odsN7fa
  53474. Yp6bwiTXj/HbpqbfRm9RpnHLPhsxZ2L3EVs0J9V5ToybWL0iEA1cJwzdMOWo010hOHQX/uMftk87
  53475. ay3bfWAfjH1MBcLrARYVmBSO0ZB3Ij/swjm4eTrwSSTilZHcYTSSjFR077F9jAHiOH3BX2pfJLKO
  53476. YheteSCtqx234LSWSE9mQxAGFiQD4eCcjsZGT44ameGPuY4zbGneWK2gDqdkVBFpRGZPTBKnjix9
  53477. xNRbxQA0MMHZmf4yzgeEtE7NCv82TWLxp2NX5Ntqp66/K7nJ5rInieV+mhxNaMbBGN4zK1FGSxyO
  53478. 9z0M+Yo0FMT7MzUj8czxKselu7Cizv5Ta01BG2Yospb6p64KTrk5M0ScdMGTHPjgniQlQ/GbI4Kq
  53479. 3ywgsNw2TgOzfALU5nsaqocTvz6hdLubDuHAk5/XpGbKuxs74zD0M1mKB3IDVedzagMxbm+WG+Oi
  53480. n6+Sx+31QrclTDsTBM8clq8cIqPQqwWyTBIjUtz9GVsnnB47ev1CI9sjgBPwvFEVVJSmdz7QdFG9
  53481. URQIOTfLHzSpMJ1ShC5VkLG631UAC9hWLbFJSXKAqWLXwPYYEQRVzXR7z2FwefR7LFxckvzluFqr
  53482. TJOVoSfupb7PcSNCupt2LQIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  53483. /zAdBgNVHQ4EFgQUl0YhVyE12jZVx/PxN3DlCPaTKbYwHwYDVR0jBBgwFoAUl0YhVyE12jZVx/Px
  53484. N3DlCPaTKbYwDQYJKoZIhvcNAQELBQADggIBAB3dAmB84DWn5ph76kTOZ0BP8pNuZtQ5iSas000E
  53485. PLuHIT839HEl2ku6q5aCgZG27dmxpGWX4m9kWaSW7mDKHyP7Rbr/jyTwyqkxf3kfgLMtMrpkZ2Cv
  53486. uVnN35pJ06iCsfmYlIrM4LvgBBuZYLFGZdwIorJGnkSI6pN+VxbSFXJfLkur1J1juONI5f6ELlgK
  53487. n0Md/rcYkoZDSw6cMoYsYPXpSOqV7XAp8dUv/TW0V8/bhUiZucJvbI/NeJWsZCj9VrDDb8O+WVLh
  53488. X4SPgPL0DTatdrOjteFkdjpY3H1PXlZs5VVZV6Xf8YpmMIzUUmI4d7S+KNfKNsSbBfD4Fdvb8e80
  53489. nR14SohWZ25g/4/Ii+GOvUKpMwpZQhISKvqxnUOOBZuZ2mKtVzazHbYNeS2WuOvyDEsMpZTGMKcm
  53490. GS3tTAZQMPH9WD25SxdfGbRqhFS0OE85og2WaMMolP3tLR9Ka0OWLpABEPs4poEL0L9109S5zvE/
  53491. bw4cHjdx5RiHdRk/ULlepEU0rbDK5uUTdg8xFKmOLZTW1YVNcxVPS/KyPu1svf0OnWZzsD2097+o
  53492. 4BGkxK51CUpjAEggpsadCwmKtODmzj7HPiY46SvepghJAwSQiumPv+i2tCqjI40cHLI5kqiPAlxA
  53493. OXXUc0ECd97N4EOH1uS6SsNsEn/+KuYj1oxx
  53494. -----END CERTIFICATE-----
  53495. OpenTrust Root CA G2
  53496. ====================
  53497. -----BEGIN CERTIFICATE-----
  53498. MIIFbzCCA1egAwIBAgISESChaRu/vbm9UpaPI+hIvyYRMA0GCSqGSIb3DQEBDQUAMEAxCzAJBgNV
  53499. BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcy
  53500. MB4XDTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM
  53501. CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzIwggIiMA0GCSqGSIb3DQEB
  53502. AQUAA4ICDwAwggIKAoICAQDMtlelM5QQgTJT32F+D3Y5z1zCU3UdSXqWON2ic2rxb95eolq5cSG+
  53503. Ntmh/LzubKh8NBpxGuga2F8ORAbtp+Dz0mEL4DKiltE48MLaARf85KxP6O6JHnSrT78eCbY2albz
  53504. 4e6WiWYkBuTNQjpK3eCasMSCRbP+yatcfD7J6xcvDH1urqWPyKwlCm/61UWY0jUJ9gNDlP7ZvyCV
  53505. eYCYitmJNbtRG6Q3ffyZO6v/v6wNj0OxmXsWEH4db0fEFY8ElggGQgT4hNYdvJGmQr5J1WqIP7wt
  53506. UdGejeBSzFfdNTVY27SPJIjki9/ca1TSgSuyzpJLHB9G+h3Ykst2Z7UJmQnlrBcUVXDGPKBWCgOz
  53507. 3GIZ38i1MH/1PCZ1Eb3XG7OHngevZXHloM8apwkQHZOJZlvoPGIytbU6bumFAYueQ4xncyhZW+vj
  53508. 3CzMpSZyYhK05pyDRPZRpOLAeiRXyg6lPzq1O4vldu5w5pLeFlwoW5cZJ5L+epJUzpM5ChaHvGOz
  53509. 9bGTXOBut9Dq+WIyiET7vycotjCVXRIouZW+j1MY5aIYFuJWpLIsEPUdN6b4t/bQWVyJ98LVtZR0
  53510. 0dX+G7bw5tYee9I8y6jj9RjzIR9u701oBnstXW5DiabA+aC/gh7PU3+06yzbXfZqfUAkBXKJOAGT
  53511. y3HCOV0GEfZvePg3DTmEJwIDAQABo2MwYTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
  53512. /zAdBgNVHQ4EFgQUajn6QiL35okATV59M4PLuG53hq8wHwYDVR0jBBgwFoAUajn6QiL35okATV59
  53513. M4PLuG53hq8wDQYJKoZIhvcNAQENBQADggIBAJjLq0A85TMCl38th6aP1F5Kr7ge57tx+4BkJamz
  53514. Gj5oXScmp7oq4fBXgwpkTx4idBvpkF/wrM//T2h6OKQQbA2xx6R3gBi2oihEdqc0nXGEL8pZ0keI
  53515. mUEiyTCYYW49qKgFbdEfwFFEVn8nNQLdXpgKQuswv42hm1GqO+qTRmTFAHneIWv2V6CG1wZy7HBG
  53516. S4tz3aAhdT7cHcCP009zHIXZ/n9iyJVvttN7jLpTwm+bREx50B1ws9efAvSyB7DH5fitIw6mVskp
  53517. EndI2S9G/Tvw/HRwkqWOOAgfZDC2t0v7NqwQjqBSM2OdAzVWxWm9xiNaJ5T2pBL4LTM8oValX9YZ
  53518. 6e18CL13zSdkzJTaTkZQh+D5wVOAHrut+0dSixv9ovneDiK3PTNZbNTe9ZUGMg1RGUFcPk8G97kr
  53519. gCf2o6p6fAbhQ8MTOWIaNr3gKC6UAuQpLmBVrkA9sHSSXvAgZJY/X0VdiLWK2gKgW0VU3jg9CcCo
  53520. SmVGFvyqv1ROTVu+OEO3KMqLM6oaJbolXCkvW0pujOotnCr2BXbgd5eAiN1nE28daCSLT7d0geX0
  53521. YJ96Vdc+N9oWaz53rK4YcJUIeSkDiv7BO7M/Gg+kO14fWKGVyasvc0rQLW6aWQ9VGHgtPFGml4vm
  53522. u7JwqkwR3v98KzfUetF3NI/n+UL3PIEMS1IK
  53523. -----END CERTIFICATE-----
  53524. OpenTrust Root CA G3
  53525. ====================
  53526. -----BEGIN CERTIFICATE-----
  53527. MIICITCCAaagAwIBAgISESDm+Ez8JLC+BUCs2oMbNGA/MAoGCCqGSM49BAMDMEAxCzAJBgNVBAYT
  53528. AkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEczMB4X
  53529. DTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCU9w
  53530. ZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzMwdjAQBgcqhkjOPQIBBgUrgQQA
  53531. IgNiAARK7liuTcpm3gY6oxH84Bjwbhy6LTAMidnW7ptzg6kjFYwvWYpa3RTqnVkrQ7cG7DK2uu5B
  53532. ta1doYXM6h0UZqNnfkbilPPntlahFVmhTzeXuSIevRHr9LIfXsMUmuXZl5mjYzBhMA4GA1UdDwEB
  53533. /wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAf
  53534. BgNVHSMEGDAWgBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAKBggqhkjOPQQDAwNpADBmAjEAj6jcnboM
  53535. BBf6Fek9LykBl7+BFjNAk2z8+e2AcG+qj9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta
  53536. 3U1fJAuwACEl74+nBCZx4nxp5V2a+EEfOzmTk51V6s2N8fvB
  53537. -----END CERTIFICATE-----
  53538. ISRG Root X1
  53539. ============
  53540. -----BEGIN CERTIFICATE-----
  53541. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  53542. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  53543. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  53544. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  53545. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  53546. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  53547. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  53548. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  53549. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  53550. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  53551. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  53552. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  53553. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  53554. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  53555. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  53556. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  53557. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  53558. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  53559. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  53560. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  53561. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  53562. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  53563. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  53564. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  53565. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  53566. -----END CERTIFICATE-----
  53567. AC RAIZ FNMT-RCM
  53568. ================
  53569. -----BEGIN CERTIFICATE-----
  53570. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  53571. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  53572. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  53573. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  53574. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  53575. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  53576. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  53577. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  53578. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  53579. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  53580. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  53581. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  53582. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  53583. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  53584. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  53585. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  53586. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  53587. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  53588. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  53589. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  53590. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  53591. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  53592. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  53593. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  53594. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  53595. -----END CERTIFICATE-----
  53596. Amazon Root CA 1
  53597. ================
  53598. -----BEGIN CERTIFICATE-----
  53599. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  53600. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  53601. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  53602. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  53603. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  53604. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  53605. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  53606. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  53607. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  53608. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  53609. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  53610. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  53611. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  53612. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  53613. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  53614. -----END CERTIFICATE-----
  53615. Amazon Root CA 2
  53616. ================
  53617. -----BEGIN CERTIFICATE-----
  53618. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  53619. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  53620. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  53621. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  53622. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  53623. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  53624. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  53625. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  53626. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  53627. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  53628. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  53629. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  53630. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  53631. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  53632. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  53633. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  53634. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  53635. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  53636. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  53637. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  53638. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  53639. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  53640. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  53641. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  53642. -----END CERTIFICATE-----
  53643. Amazon Root CA 3
  53644. ================
  53645. -----BEGIN CERTIFICATE-----
  53646. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  53647. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  53648. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  53649. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  53650. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  53651. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  53652. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  53653. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  53654. -----END CERTIFICATE-----
  53655. Amazon Root CA 4
  53656. ================
  53657. -----BEGIN CERTIFICATE-----
  53658. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  53659. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  53660. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  53661. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  53662. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  53663. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  53664. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  53665. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  53666. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  53667. -----END CERTIFICATE-----
  53668. LuxTrust Global Root 2
  53669. ======================
  53670. -----BEGIN CERTIFICATE-----
  53671. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  53672. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  53673. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  53674. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  53675. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  53676. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  53677. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  53678. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  53679. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  53680. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  53681. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  53682. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  53683. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  53684. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  53685. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  53686. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  53687. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  53688. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  53689. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  53690. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  53691. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  53692. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  53693. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  53694. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  53695. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  53696. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  53697. -----END CERTIFICATE-----
  53698. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  53699. =============================================
  53700. -----BEGIN CERTIFICATE-----
  53701. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  53702. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  53703. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  53704. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  53705. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  53706. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  53707. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  53708. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  53709. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  53710. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  53711. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  53712. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  53713. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  53714. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  53715. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  53716. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  53717. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  53718. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  53719. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  53720. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  53721. -----END CERTIFICATE-----
  53722. <?php
  53723. if (PHP_SAPI !== 'cli') {
  53724. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  53725. }
  53726. require __DIR__.'/../src/bootstrap.php';
  53727. use Composer\Factory;
  53728. use Composer\XdebugHandler;
  53729. use Composer\Console\Application;
  53730. error_reporting(-1);
  53731. // Create output for XdebugHandler and Application
  53732. $output = Factory::createOutput();
  53733. $xdebug = new XdebugHandler($output);
  53734. $xdebug->check();
  53735. unset($xdebug);
  53736. if (function_exists('ini_set')) {
  53737. @ini_set('display_errors', 1);
  53738. $memoryInBytes = function ($value) {
  53739. $unit = strtolower(substr($value, -1, 1));
  53740. $value = (int) $value;
  53741. switch($unit) {
  53742. case 'g':
  53743. $value *= 1024;
  53744. // no break (cumulative multiplier)
  53745. case 'm':
  53746. $value *= 1024;
  53747. // no break (cumulative multiplier)
  53748. case 'k':
  53749. $value *= 1024;
  53750. }
  53751. return $value;
  53752. };
  53753. $memoryLimit = trim(ini_get('memory_limit'));
  53754. // Increase memory_limit if it is lower than 1.5GB
  53755. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  53756. @ini_set('memory_limit', '1536M');
  53757. }
  53758. // Set user defined memory limit
  53759. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  53760. @ini_set('memory_limit', $memoryLimit);
  53761. }
  53762. unset($memoryInBytes, $memoryLimit);
  53763. }
  53764. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  53765. // run the command application
  53766. $application = new Application();
  53767. $application->run(null, $output);
  53768. Copyright (c) Nils Adermann, Jordi Boggiano
  53769. Permission is hereby granted, free of charge, to any person obtaining a copy
  53770. of this software and associated documentation files (the "Software"), to deal
  53771. in the Software without restriction, including without limitation the rights
  53772. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  53773. copies of the Software, and to permit persons to whom the Software is furnished
  53774. to do so, subject to the following conditions:
  53775. The above copyright notice and this permission notice shall be included in all
  53776. copies or substantial portions of the Software.
  53777. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53778. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53779. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53780. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53781. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53782. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  53783. THE SOFTWARE.
  53784. =ÂâFzI)6#õŽŸaw&ã¬���GBMB